Skip to content

Commit 9f1a169

Browse files
Prometheus — AI-Powered Edge ML Training Orchestrator
Full-stack Rust platform for the DigitalOcean Gradient AI Hackathon. 8 crates, 13 neural network architectures, Gradient AI agent with RAG, ONNX/HEF conversion, edge deployment, AES-256-GCM security, Stripe billing. By Andrew Jewell Sr. — AutomataNexus
0 parents  commit 9f1a169

274 files changed

Lines changed: 73357 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/docs.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Rustdoc
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
permissions:
8+
contents: read
9+
pages: write
10+
id-token: write
11+
12+
concurrency:
13+
group: pages
14+
cancel-in-progress: true
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Install Rust
23+
uses: dtolnay/rust-toolchain@stable
24+
with:
25+
targets: wasm32-unknown-unknown
26+
27+
- name: Clone AxonML
28+
run: git clone https://github.com/AutomataNexus/AxonML.git /opt/AxonML || true
29+
30+
- name: Clone Aegis-DB
31+
run: git clone https://github.com/AutomataNexus/Aegis-DB.git /opt/Aegis-DB || true
32+
33+
- name: Generate docs
34+
run: cargo doc --workspace --no-deps --document-private-items
35+
36+
- name: Add redirect index.html
37+
run: echo '<meta http-equiv="refresh" content="0; url=prometheus_server/index.html">' > target/doc/index.html
38+
39+
- name: Upload Pages artifact
40+
uses: actions/upload-pages-artifact@v3
41+
with:
42+
path: target/doc
43+
44+
deploy:
45+
needs: build
46+
runs-on: ubuntu-latest
47+
environment:
48+
name: github-pages
49+
url: ${{ steps.deployment.outputs.page_url }}
50+
steps:
51+
- name: Deploy to GitHub Pages
52+
id: deployment
53+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# Build artifacts
2+
/target/
3+
/dist/
4+
*.wasm
5+
*.d
6+
7+
# Rust
8+
**/*.rs.bk
9+
Cargo.lock
10+
11+
# Pre-built binaries
12+
prometheus-server-bin
13+
14+
# Secrets & credentials
15+
.secrets/
16+
*.p8
17+
*.jks
18+
*.pem
19+
*.key
20+
credentials.json
21+
google-services.json
22+
*.env
23+
.env.*
24+
!.env.example
25+
!crates/prometheus-agent/.env.example
26+
27+
# HashiCorp Vault (secrets, data, keys — NEVER commit)
28+
vault/data/
29+
vault/.vault-keys
30+
vault/vault.pid
31+
vault/vault.log
32+
33+
# Internal docs and deployment config (not for public repo)
34+
Internal_docs/
35+
PRD.md
36+
restartprometheus.sh
37+
38+
# Node / Mobile
39+
node_modules/
40+
.expo/
41+
*.tsbuildinfo
42+
mobile/
43+
44+
# Python virtualenvs
45+
tools/converter-venv/
46+
__pycache__/
47+
*.pyc
48+
*.pyo
49+
50+
# ML model files (runtime/generated)
51+
*.onnx
52+
*.hef
53+
*.axonml
54+
*.ozl
55+
56+
# OS files
57+
.DS_Store
58+
Thumbs.db
59+
*.Zone.Identifier
60+
61+
# IDE
62+
.vscode/
63+
.idea/
64+
*.swp
65+
*.swo
66+
*~
67+
68+
# Claude Code
69+
.claude/
70+
71+
# Data & models (runtime)
72+
/data/
73+
/models/
74+
75+
# Datasets (large binary/CSV collections)
76+
/opt/datasets/
77+
tools/bulk_ingest/
78+
tools/converter-venv/
79+
80+
# Compression dictionaries
81+
*.ozl-dict
82+
83+
# Logs
84+
*.log
85+
86+
# Media (demo recordings, narration)
87+
*.mp4
88+
*.mp3
89+
*.webm
90+
screenshots/
91+
demo-recording/
92+
93+
# Demo/recording tools with credentials (use .example versions)
94+
tools/record-demo-synced.js
95+
tools/take-screenshots.js
96+
tools/cli-auth.sh
97+
tools/cli-demo.tape
98+
tools/tui-demo.tape
99+
tools/record-demo-synced.js
100+
101+
# Package manager lockfiles (puppeteer tests)
102+
tests/puppeteer/package-lock.json
103+
package-lock.json
104+
package.json
105+
106+
# Test artifacts
107+
tests/e2e/test-results/
108+
tests/e2e/playwright-report/
109+
tests/puppeteer/screenshots/
110+
*.Zone.Identifier

Cargo.toml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
[workspace]
2+
resolver = "2"
3+
members = [
4+
"crates/prometheus-server",
5+
"crates/prometheus-ui",
6+
"crates/prometheus-training",
7+
"crates/prometheus-edge",
8+
"crates/prometheus-reports",
9+
"crates/prometheus-shield",
10+
"crates/prometheus-email",
11+
"crates/prometheus-cli",
12+
]
13+
14+
[workspace.package]
15+
version = "0.1.0"
16+
edition = "2021"
17+
rust-version = "1.75"
18+
authors = ["AutomataNexus Development Team"]
19+
license = "MIT OR Apache-2.0"
20+
repository = "https://github.com/AutomataNexus/Prometheus"
21+
homepage = "https://automatanexus.com"
22+
23+
[workspace.dependencies]
24+
# Internal crates
25+
prometheus-ui = { path = "crates/prometheus-ui" }
26+
prometheus-training = { path = "crates/prometheus-training" }
27+
prometheus-reports = { path = "crates/prometheus-reports" }
28+
prometheus-shield = { path = "crates/prometheus-shield" }
29+
prometheus-email = { path = "crates/prometheus-email" }
30+
31+
# AxonML (from /opt/AxonML)
32+
axonml-core = { path = "/opt/AxonML/crates/axonml-core" }
33+
axonml-tensor = { path = "/opt/AxonML/crates/axonml-tensor" }
34+
axonml-autograd = { path = "/opt/AxonML/crates/axonml-autograd" }
35+
axonml-nn = { path = "/opt/AxonML/crates/axonml-nn" }
36+
axonml-optim = { path = "/opt/AxonML/crates/axonml-optim" }
37+
axonml-data = { path = "/opt/AxonML/crates/axonml-data" }
38+
axonml-serialize = { path = "/opt/AxonML/crates/axonml-serialize" }
39+
axonml-quant = { path = "/opt/AxonML/crates/axonml-quant" }
40+
axonml-vision = { path = "/opt/AxonML/crates/axonml-vision" }
41+
axonml-text = { path = "/opt/AxonML/crates/axonml-text" }
42+
axonml-audio = { path = "/opt/AxonML/crates/axonml-audio" }
43+
axonml-llm = { path = "/opt/AxonML/crates/axonml-llm" }
44+
axonml-profile = { path = "/opt/AxonML/crates/axonml-profile" }
45+
axonml-onnx = { path = "/opt/AxonML/crates/axonml-onnx" }
46+
axonml-jit = { path = "/opt/AxonML/crates/axonml-jit" }
47+
48+
# Aegis-DB (from /opt/Aegis-DB)
49+
aegis-client = { path = "/opt/Aegis-DB/crates/aegis-client" }
50+
51+
# Async runtime
52+
tokio = { version = "1.35", features = ["full"] }
53+
async-trait = "0.1"
54+
futures = "0.3"
55+
56+
# Web framework
57+
axum = { version = "0.7", features = ["ws", "multipart", "macros"] }
58+
axum-extra = { version = "0.9", features = ["typed-header"] }
59+
tower = { version = "0.4", features = ["util"] }
60+
tower-http = { version = "0.5", features = ["cors", "trace", "fs", "compression-gzip"] }
61+
62+
# Leptos
63+
leptos = { version = "0.7", features = ["csr"] }
64+
leptos_router = "0.7"
65+
leptos_meta = "0.7"
66+
67+
# Serialization
68+
serde = { version = "1.0", features = ["derive"] }
69+
serde_json = "1.0"
70+
71+
# HTTP client
72+
reqwest = { version = "0.12", features = ["json", "multipart"] }
73+
74+
# Error handling
75+
thiserror = "1.0"
76+
anyhow = "1.0"
77+
78+
# Logging
79+
tracing = "0.1"
80+
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
81+
82+
# Auth
83+
84+
# Time & IDs
85+
chrono = { version = "0.4", features = ["serde"] }
86+
uuid = { version = "1.6", features = ["v4", "serde"] }
87+
88+
# Misc
89+
rand = "0.8"
90+
csv = "1.3"
91+
base64 = "0.22"
92+
totp-rs = { version = "5.6", features = ["gen_secret", "otpauth"] }
93+
hmac = "0.12"
94+
data-encoding = "2.6"
95+
96+
# Security (prometheus-shield)
97+
sqlparser = "0.41"
98+
sha2 = "0.10"
99+
hex = "0.4"
100+
parking_lot = "0.12"
101+
url = "2"
102+
aes-gcm = "0.10"
103+
104+
[profile.release]
105+
lto = "thin"
106+
codegen-units = 1
107+
opt-level = 3

Dockerfile

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# ═══════════════════════════════════════════════════════════════
2+
# Prometheus — Multi-stage Docker build
3+
#
4+
# Stages:
5+
# 1. chef — cargo-chef for dependency caching
6+
# 2. planner — generate dependency recipe
7+
# 3. wasm — compile Leptos UI to WebAssembly
8+
# 4. tailwind — generate optimized CSS
9+
# 5. builder — compile Rust server binary
10+
# 6. runtime — minimal production image
11+
# ═══════════════════════════════════════════════════════════════
12+
13+
# ── Stage 1: cargo-chef base ──────────────────────────────────
14+
FROM rust:1.75-bookworm AS chef
15+
RUN cargo install cargo-chef
16+
WORKDIR /app
17+
18+
# ── Stage 2: Dependency planner ───────────────────────────────
19+
FROM chef AS planner
20+
COPY . .
21+
RUN cargo chef prepare --recipe-path recipe.json
22+
23+
# ── Stage 3: WASM build (Leptos UI) ──────────────────────────
24+
FROM rust:1.75-bookworm AS wasm
25+
RUN rustup target add wasm32-unknown-unknown && \
26+
cargo install trunk wasm-bindgen-cli
27+
28+
WORKDIR /app
29+
30+
# Copy workspace files needed for WASM build
31+
COPY Cargo.toml Cargo.lock ./
32+
COPY crates/prometheus-ui/ crates/prometheus-ui/
33+
34+
# Build WASM output
35+
RUN cd crates/prometheus-ui && \
36+
trunk build --release --dist /app/dist/wasm
37+
38+
# ── Stage 4: Tailwind CSS ────────────────────────────────────
39+
FROM node:20-slim AS tailwind
40+
WORKDIR /app
41+
42+
# Install Tailwind CLI
43+
RUN npm install -g tailwindcss
44+
45+
COPY tailwind.config.js input.css ./
46+
COPY crates/prometheus-ui/src/ crates/prometheus-ui/src/
47+
COPY crates/prometheus-server/src/ crates/prometheus-server/src/
48+
49+
RUN npx tailwindcss -i input.css -o /app/dist/css/prometheus.css --minify
50+
51+
# ── Stage 5: Rust server build ───────────────────────────────
52+
FROM chef AS builder
53+
54+
# Cook dependencies first (cached layer)
55+
COPY --from=planner /app/recipe.json recipe.json
56+
RUN cargo chef cook --release --recipe-path recipe.json
57+
58+
# Copy full source
59+
COPY . .
60+
61+
# Copy WASM artifacts into the static directory
62+
COPY --from=wasm /app/dist/wasm/ static/wasm/
63+
64+
# Copy Tailwind CSS output
65+
COPY --from=tailwind /app/dist/css/ static/css/
66+
67+
# Build the server binary
68+
RUN cargo build --release --bin prometheus-server
69+
70+
# Also cross-compile the edge daemon for ARM (optional, if cross is available)
71+
# RUN rustup target add armv7-unknown-linux-musleabihf && \
72+
# cargo build --release --target armv7-unknown-linux-musleabihf --bin prometheus-edge
73+
74+
# ── Stage 6: Runtime ─────────────────────────────────────────
75+
FROM debian:bookworm-slim AS runtime
76+
77+
# Install runtime dependencies
78+
RUN apt-get update && \
79+
apt-get install -y --no-install-recommends \
80+
ca-certificates \
81+
libssl3 \
82+
chromium \
83+
fonts-inter \
84+
&& rm -rf /var/lib/apt/lists/*
85+
86+
# Create non-root user
87+
RUN groupadd --gid 1000 prometheus && \
88+
useradd --uid 1000 --gid prometheus --shell /bin/bash --create-home prometheus
89+
90+
WORKDIR /app
91+
92+
# Copy the compiled binary
93+
COPY --from=builder /app/target/release/prometheus-server /app/prometheus-server
94+
95+
# Copy static assets (WASM + CSS + other statics)
96+
COPY --from=builder /app/static/ /app/static/
97+
COPY assets/ /app/assets/
98+
99+
# Copy Gradient agent source (for reference / sidecar deployment)
100+
COPY crates/prometheus-agent/ /app/agent/
101+
102+
# Set environment defaults
103+
ENV PROMETHEUS_PORT=3030 \
104+
PROMETHEUS_HOST=0.0.0.0 \
105+
AEGIS_DB_URL=http://aegis-db:9091 \
106+
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium \
107+
RUST_LOG=prometheus_server=info,tower_http=info
108+
109+
EXPOSE 3030
110+
111+
# Health check
112+
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
113+
CMD curl -f http://localhost:3030/health || exit 1
114+
115+
# Run as non-root
116+
USER prometheus
117+
118+
ENTRYPOINT ["/app/prometheus-server"]
119+
CMD ["--port", "3030"]

0 commit comments

Comments
 (0)