ProDG Studios Mainframe — Orchestration Infrastructure Plan v2.0
For Hermes: Use subagent-driven-development skill to implement this plan task-by-task.
Date: 2026-04-27
Version: 2.0
Domain: prodg.studio (owned)
Target: Hardened central orchestrator for multi-agent workloads over a Tailscale mesh.
Architecture: Self-hosted Headscale control plane on the VPS; mainframe and all agent nodes join the Tailnet. Trusted agents run in Docker containers on-box. Untrusted code and burst inference run on remote Tailscale nodes or Modal. All internal services (DBs, caches, dashboards) communicate over Tailscale. Caddy reverse-proxies Tailscale-internal services. Infisical handles secrets; Vaultwarden handles team passwords. Backblaze B2 provides offsite backup.
Tech Stack: Ubuntu 24.04, Docker CE + Compose, Headscale/Tailscale, PostgreSQL 16, Redis 7, Caddy, Prometheus + Grafana, Infisical, Vaultwarden, Backblaze B2 (restic).
1. Current State (v1.0 → v2.0 Additions)
| Resource | Value |
|---|---|
| OS | Ubuntu 24.04.3 LTS |
| CPU | AMD Ryzen 5 3600 (6c/12t) |
| RAM | 62 GB |
| Storage | 2×476 GB NVMe RAID1 → 436 GB usable |
| Public IPv4 | 65.109.89.215 |
| Domain | prodg.studio (owned) |
| Hermes | v0.11.0, gateway active |
| SSH Key | Mitch ed25519 key present in /root/.ssh/authorized_keys |
| Firewall | ufw inactive |
| Docker | Not installed |
| VPN | Not installed |
New Context Since v1.0:
- Web Search: Tavily API key provided (
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) — replaces Perplexity as primary web backend. - Object Storage: Backblaze B2 App Key ID
K005+ixrAG8niwbXZmjfHUMVfiwn8Hg— offsite backup target. - Secrets Management: Infisical (self-hosted) for structured secrets; Vaultwarden (self-hosted) for team passwords.
- Agent Workload Model:
- Trusted agents (research, infra) → on-box Docker containers.
- Untrusted code / burst inference → remote Tailscale nodes or Modal.
- Hermes API: Routed through Tailscale (not public internet).
2. Target Architecture v2.0
┌─────────────────────────────────────────────────────────────────────┐
│ ProDG Studios Mainframe │
│ 65.109.89.215 • Ubuntu 24.04 • Hetzner │
└─────────────────────────────────────────────────────────────────────┘
│ Public (22, 80, 443)
┌─────────────────────────────────────────────┐
│ Tailscale Mesh (Headscale) │
│ 100.64.0.0/10 • WireGuard • Magic DNS │
└─────────────────────────────────────────────┘
│ │ │
┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐
│Dev Laptop│ │GPU Node │ │Modal │ │CI Runner │
│(Mitch) │ │(Tailscale│ │(Burst) │ │(Tailscale│
└──────────┘ └──────────┘ └──────────┘ └──────────┘
┌─────────────────────────────────────────────────────────────────────┐
│ MAINFRAME INTERNAL STACK │
├─────────────────────────────────────────────────────────────────────┤
│ Caddy RP │ PostgreSQL │ Redis │ Hermes GW/API │ Prometheus/Grafana │
│ Infisical│ Vaultwarden│ MinIO │ (Tavily) │ (Backups) │
└─────────────────────────────────────────────────────────────────────┘
3. Implementation Phases
Phase 0: Security Hardening — Before anything else
| Step | Action | Command / Config |
|---|---|---|
| 0.1 | Create service user | useradd -m -s /bin/bash prodg |
| 0.2 | Add Mitch SSH key to prodg user | Copy /root/.ssh/authorized_keys → /home/prodg/.ssh/ |
| 0.3 | Set hostname | hostnamectl set-hostname mainframe.prodg.studio |
| 0.4 | Activate ufw | ufw default deny incoming, ufw allow ssh, ufw allow http, ufw allow https, ufw enable |
| 0.5 | Harden SSH | PasswordAuthentication no, PermitRootLogin prohibit-password, PubkeyAuthentication yes |
| 0.6 | Install & configure fail2ban | apt install fail2ban, jail for ssh |
| 0.7 | Auto-updates | apt install unattended-upgrades, configure 50unattended-upgrades |
Validation: ss -tlnp shows only 22/80/443 externally; ufw status verbose confirms default deny.
Phase 1: Container Runtime & Compose Stack
| Step | Action | Rationale |
|---|---|---|
| 1.1 | Install Docker CE + Compose plugin | Official repo for latest compose |
| 1.2 | Add prodg user to docker group | Non-root container management |
| 1.3 | Verify with docker run hello-world | Sanity check |
| 1.4 | Create /opt/prodg/compose/ | Central stack definitions |
| 1.5 | Create /opt/prodg/data/ | Persistent data volumes |
| 1.6 | Create /opt/prodg/backups/ | Backup staging |
Validation: docker compose version returns v2.x; docker ps works as prodg user.
Phase 2: Tailscale Mesh (Headscale Control Server)
The mainframe hosts the Headscale control plane. All nodes (dev laptop, GPU nodes, CI) join this Tailnet.
| Step | Action | Details |
|---|---|---|
| 2.1 | Create Headscale directories | /opt/prodg/compose/headscale/{config,data} |
| 2.2 | Write config.yaml | server_url: https://headscale.prodg.studio; listen_addr: 0.0.0.0:8080; magic_dns: true; base_domain: prodg.studio |
| 2.3 | Deploy Headscale via Docker Compose | Image headscale/headscale:latest |
| 2.4 | Create initial user | headscale users create prodg |
| 2.5 | Generate pre-auth key | headscale preauthkeys create --user prodg --reusable --expiration 30d |
| 2.6 | Install Tailscale client on mainframe | curl -fsSL https://tailscale.com/install.sh | sh |
| 2.7 | Join mainframe to Tailnet | tailscale up --login-server https://headscale.prodg.studio --authkey <preauth-key> |
| 2.8 | Enable IP forwarding | sysctl -w net.ipv4.ip_forward=1, net.ipv6.conf.all.forwarding=1 |
Key ports: Headscale control (8080/tcp), DERP/STUN (3478/udp).
Validation: tailscale status shows mainframe; headscale nodes list returns entries.
Phase 3: Data Layer (PostgreSQL 16 + Redis 7 + MinIO)
3.1 PostgreSQL 16
| Property | Value |
|---|---|
| Container | postgres:16-alpine |
| Data dir | /opt/prodg/data/postgres/ |
| Databases | hermes, agents, infisical |
| Network | Tailscale IP only |
| Backups | Daily pg_dump → /opt/prodg/backups/ |
3.2 Redis 7
| Property | Value |
|---|---|
| Container | redis:7-alpine |
| Use | Hermes cache, agent queue broker |
| Persistence | AOF + RDB |
| Password | Via Docker secret |
3.3 MinIO
| Property | Value |
|---|---|
| Container | minio/minio:latest |
| Buckets | prodg-artifacts, prodg-logs, prodg-backups |
| Use | S3-compatible local object store |
| Console | Tailscale-only via Caddy |
Phase 4: Secrets & Password Management
4.1 Infisical (Self-Hosted)
- Image:
infisical/infisical:latest-postgres - Database: Uses the shared PostgreSQL instance (DB
infisical) - Use: Structured secrets for services (Tavily, B2, API keys)
- Access: Tailscale-internal at
secrets.mainframe.prodg.studio
4.2 Vaultwarden (Self-Hosted)
- Image:
vaultwarden/server:latest - Data:
/opt/prodg/data/vaultwarden/ - Use: Team password manager (Bitwarden-compatible)
- Access: Tailscale-internal at
vault.mainframe.prodg.studio
First Migration: Move the Tavily key and B2 key from plaintext chat into Infisical vaults immediately after deployment.
Phase 5: Hermes Mainframe Hardening
| Step | Action | Details |
|---|---|---|
| 5.1 | Update Hermes | hermes update (16 commits behind) |
| 5.2 | Enable web toolset | web backend → Tavily |
| 5.3 | Configure Tavily | TAVILY_API_KEY=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 |
| 5.4 | Enable core toolsets | file, terminal, browser, web |
| 5.5 | Configure fallback model | OpenRouter anthropic/claude-sonnet-4 |
| 5.6 | Enable API server | API_SERVER_HOST=0.0.0.0, API_SERVER_KEY=<strong-secret>; bind to Tailscale IP only |
| 5.7 | Move Hermes to Docker Compose | Use existing docker-compose.yml with UID/GID mapping |
| 5.8 | Mount persistent volumes | ~/.hermes:/opt/data, Docker socket for container ops |
Hermes API Routing:
- API server listens on Tailscale IP (
100.x.x.x:8000) - Caddy reverse-proxies
api.mainframe.prodg.studio→ Tailscale IP:8000 - No public internet exposure for API
Phase 6: Reverse Proxy & Ingress (Caddy)
| Service | Exposure | Caddy Route |
|---|---|---|
| Hermes Dashboard | Tailscale only | dash.mainframe.prodg.studio |
| Hermes API | Tailscale + mTLS | api.mainframe.prodg.studio |
| Headscale UI | Tailscale only | headscale.prodg.studio |
| Grafana | Tailscale only | metrics.mainframe.prodg.studio |
| MinIO Console | Tailscale only | s3.mainframe.prodg.studio |
| Infisical | Tailscale only | secrets.mainframe.prodg.studio |
| Vaultwarden | Tailscale only | vault.mainframe.prodg.studio |
Why Caddy: Auto HTTPS (Tailscale certs), HTTP/3, simple config.
Phase 7: Observability
| Component | Stack | Purpose |
|---|---|---|
| Metrics | Prometheus + node_exporter + cadvisor | CPU, RAM, disk, network, container stats |
| Logs | Promtail + Loki | Centralized log aggregation |
| Dashboards | Grafana | Pre-built dashboards |
| Alerting | Grafana Alerting → Telegram | High CPU, disk full, service down |
Phase 8: Multi-Agent Orchestration
Agent Registry: PostgreSQL table agents tracking agent_id, name, tailscale_ip, capabilities[], trust_tier, last_heartbeat, status.
Trust Tiers:
| Tier | Agents | Runtime |
|---|---|---|
| Trusted | Research, Infra, Internal Tools | Docker containers on mainframe |
| Untrusted | External code review, sandboxed tasks | Remote Tailscale nodes |
| Burst | LLM inference, media generation | Modal / Daytona ephemeral |
Inter-Agent Communication:
- Synchronous: Hermes
delegate_task→ ACP subagents - Asynchronous: Redis pub/sub per agent topic
- Persistent: PostgreSQL job queue
Phase 9: Backup & Disaster Recovery
| Data | Frequency | Target | Method |
|---|---|---|---|
~/.hermes/ | Hourly | MinIO prodg-backups | restic |
| PostgreSQL | Daily | MinIO + Backblaze B2 | pg_dump + restic |
| Redis | Hourly | MinIO | redis-cli --rdb |
| Headscale DB | Daily | MinIO + B2 | Volume snapshot |
| Vaultwarden | Daily | MinIO + B2 | rsync + restic |
Offsite: Backblaze B2 bucket prodg-mainframe-backups using restic with B2 App Key.
4. Port & Service Matrix
| Port | Protocol | Service | Exposure |
|---|---|---|---|
| 22 | TCP | SSH | Public (fail2ban hardened) |
| 80 | TCP | Caddy HTTP redirect | Public |
| 443 | TCP | Caddy HTTPS | Public |
| 8080 | TCP | Headscale control | Public (mTLS/auth) |
| 3478 | UDP | Headscale DERP/STUN | Public |
| 5432 | TCP | PostgreSQL | Tailscale only |
| 6379 | TCP | Redis | Tailscale only |
| 9000 | TCP | MinIO S3 API | Tailscale only |
| 9001 | TCP | MinIO Console | Tailscale only |
| 9090 | TCP | Prometheus | Tailscale only |
| 3000 | TCP | Grafana | Tailscale only |
| 8000 | TCP | Hermes API | Tailscale + API key only |
| 8081 | TCP | Hermes Dashboard | Tailscale only |
5. Files Likely to Change
~/.hermes/config.yaml— toolsets, Tavily provider, fallback model/opt/prodg/compose/docker-compose.yml— full stack definition/opt/prodg/compose/Caddyfile— reverse proxy routes/opt/prodg/compose/headscale/config.yaml— Tailnet control plane/etc/ssh/sshd_config— SSH hardening/etc/fail2ban/jail.local— brute-force protection/opt/prodg/scripts/backup.sh— automated backup orchestration
6. Success Criteria
The mainframe is fully operational when:
- [ ]
ufwactive; only 22/80/443 public; DBs Tailscale-internal. - [ ] Headscale running; mainframe joined; Mitch's laptop can
tailscale pingit. - [ ]
docker compose psshows healthy containers for Postgres, Redis, Caddy. - [ ] Hermes web toolset uses Tavily and returns grounded results.
- [ ] Hermes API answers authenticated requests only from Tailscale IPs.
- [ ] Infisical and Vaultwarden accessible via Tailscale DNS.
- [ ] Grafana displays node + Docker metrics.
- [ ] Nightly backups run to B2; restore test passes.
- [ ] A
delegate_taskto a trusted on-box agent succeeds; an untrusted task can target Modal.
End of Plan v2.0