learning_ai_common_plat/docs/devops/single_azure_vm
saravanakumardb1 8a568932b4 feat(infra): add production-grade k3s Kubernetes setup for single VM
Complete K8s deployment alternative to Docker Compose, targeting
~50 beta users on a Standard_D8s_v5 Azure VM (8 vCPU, 32 GB RAM).

setup-k8s.sh (6 phases):
  1. Pre-flight: verify docker phases 1-5 ran, disk/RAM checks
  2. Install k3s: Docker runtime, NodePort range 1024-32767
  3. Build images: docker compose build + tag as bytelyst/<svc>
  4. Config: namespaces, ConfigMap (3 copies), Secrets (JWT + blob keys), Ollama
  5. Deploy: infra -> platform -> dashboards -> products (ordered)
  6. Health check: 32 endpoints + kubectl pod status

K8s manifests (18 files):
  - 4 namespaces (infra, platform, dashboards, products)
  - 6 infra (cosmos StatefulSet+PVC, azurite StatefulSet+PVC,
    mailpit, loki StatefulSet+PVC, grafana+PVC, ollama external)
  - 3 platform (Deployment+Service+NodePort each)
  - 2 dashboards (Deployment+Service+NodePort each)
  - 10 backends + 9 webs (all with readiness+liveness probes,
    resource limits, product-specific NEXT_PUBLIC_* env vars)

Design decisions:
  - k3s --docker: reuses existing Docker images, no containerd import
  - Same ports as Docker Compose (NodePort with extended range)
  - ConfigMap replaces .env.ecosystem, copied to 3 app namespaces
  - Blob storage keys injected at deploy time via Secret (not in YAML)
  - Cross-namespace DNS: <svc>.<ns>.svc for service discovery
  - Ollama as Endpoints+Service pointing to host node IP
  - Resource limits: ~19 Gi total, fits in 32 GB with 13 GB headroom
  - Teardown: --teardown flag deletes namespaces, keeps k3s
2026-03-24 14:47:17 -07:00
..
docker refactor(infra): reorganize single_azure_vm into docker/ and k8s/ subfolders 2026-03-24 14:11:50 -07:00
k8s feat(infra): add production-grade k3s Kubernetes setup for single VM 2026-03-24 14:47:17 -07:00
README.md refactor(infra): reorganize single_azure_vm into docker/ and k8s/ subfolders 2026-03-24 14:11:50 -07:00

ByteLyst Single-VM Deployment

Deploy the entire ByteLyst ecosystem (30 services, 10 products) on a single Azure VM. Two orchestration approaches — pick one or learn both side by side.


Approaches

docker/ — Docker Compose (Production-ready)

Proven, battle-tested deployment using docker-compose.ecosystem.yml. Installs everything from scratch on a raw Ubuntu VM in ~20 minutes.

sudo ./docker/setup.sh              # Full install
sudo ./docker/setup.sh --resume     # Resume after disconnect
/opt/bytelyst/check-health.sh       # Verify all 30 services

Use this if: You want reliable deployment now.

k8s/ — Kubernetes via k3s (Learning / Future-ready)

Same 30 services orchestrated by Kubernetes on a single VM using k3s. Builds on the same Docker images — no Dockerfile changes needed.

Use this if: You want to learn K8s with real services, practice kubectl, and prepare for multi-node scaling later.


Architecture (shared by both approaches)

Raw Ubuntu 24.04 VM (Standard_D8s_v5: 8 vCPU, 32 GB RAM)
├── Ollama (systemd, :11434) ─── local LLM inference
├── Gitea (Docker/:3300) ──────── npm package registry
└── 30 Services
    ├── Infrastructure (6): cosmos-emulator, azurite, mailpit, loki, grafana, traefik
    ├── Platform (3): platform-service, extraction-service, mcp-server
    ├── Dashboards (2): admin-web, tracker-web
    ├── Backends (10): peakpulse, chronomind, jarvisjr, nomgap, mindlyst,
    │                   lysnrai, notelett, flowmonk, actiontrail, localmemgpt
    └── Web Apps (9): lysnrai-dashboard, chronomind-web, jarvisjr-web, flowmonk-web,
                      notelett-web, mindlyst-web, nomgap-web, actiontrail-web, localmemgpt-web

Comparison

Docker Compose K8s (k3s)
Setup time ~20 min ~30 min
RAM overhead ~100 MB ~600 MB
Config files 1 compose + 1 .env ~30 manifests (or Helm)
Scaling Manual kubectl scale / HPA
Rolling updates Restart-based Zero-downtime
Resource limits Basic Fine-grained per pod
Multi-VM ready Docker Swarm Native kubectl join
Learning value Low High (transferable to AKS/EKS/GKE)