The Mainframe Blueprint — Build Your Own Instance

Version 1.0 — 2026-10-04 · distilled from the production ProDG mainframe

What is a "Mainframe"?

A single self-sovereign server that provides:

  • Tailnet mesh networking (Headscale) for private access from anywhere
  • A2A agent mesh (Linux Foundation A2A v1.0) — your Hermes agent callable by and calling other agents
  • Agent tooling — web browser (webcmd/Cloak), docs intelligence (Context7 MCP)
  • Self-hosted SaaS suite — CRM, calendar, chat, secrets, vault, docs, monitoring
  • AI operator — Hermes Agent gateway with full root tools, reachable via Telegram/Discord/A2A/SSH

One machine. One agent. Everything else follows.


Bill of Materials

LayerComponentWhy
OS (Track A)Ubuntu 24.04 LTSsystemd, docker-compose, SSH — the proven recipe
OS (Track B)Talos Linuximmutable, API-driven, K8s-only — see §8
RuntimeDocker + Compose23-service stack, single yaml
NetworkHeadscale + Tailscale clientsself-hosted tailnet, DERP+STUN embedded
Reverse proxyCaddyautomatic TLS, unix-socket bridging to host apps
DataPostgreSQL, Redis, MinIOshared by all services
SecretsInfisical + Vaultwardenenv secrets + password vault
ObservabilityPrometheus, Grafana, Loki, promtail, cAdvisor, node-exporterfull stack metrics/logs/alerts
AI operatorHermes Agent (gateway + dashboard)Telegram/Discord/CLI/A2A surfaces
Agent meshHermes A2A platform (port 9900)Agent Card, JSON-RPC v1.0, SSE, push
Agent browserwebcmd + Cloak + Xvfbstealth browser automation
Docs intelContext7 MCPup-to-date library docs
AppsTwenty CRM, Cal.com, Mattermost, DocuSeal, Cryptgeon, Stirling-PDF, Passboltthe SaaS suite
Backupsrclone → Backblaze B2daily 03:00 UTC, Telegram notify

The Recipe (Track A — Ubuntu)

Phase 0 — Host (2h)

apt-get update && apt-get upgrade -y
apt-get install -y docker.io docker-compose-plugin xvfb
useradd -r prodg && usermod -aG docker prodg
ufw default deny incoming && ufw allow 22,80,443/tcp && ufw allow 3478/udp && ufw enable

DNS: one wildcard-ish set of A records (grey-cloud/DNS-only if behind Cloudflare!): mainframe, headscale, hermes, vault, secrets, s3, metrics, api, + one per app — all *.mainframe.<domain> style.

Phase 1 — Directory skeleton

/opt/prodg/{compose,data,backups,scripts,docs}
/opt/prodg/data/{postgres,redis,minio,vaultwarden,caddy,grafana,prometheus,loki,...per-app}

Phase 2 — Core stack (compose)

Order matters: postgres → redis → minio → headscale → infisical → vaultwarden → caddy → prometheus → grafana → node-exporter → cadvisor → loki → promtail → hermes-api then app tier. All restart: unless-stopped. Secrets in .env (chmod 600) — generate with openssl rand.

Phase 3 — Tailnet

# headscale config: server_url: https://headscale.<domain> (HTTPS mandatory for macOS clients!)

Caddy proxies headscale:8080. Mint pre-auth keys: docker exec headscale headscale preauthkeys create --user prodg --reusable --expiration 7d

Phase 4 — AI operator (Hermes)

  1. Install: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash
  2. Gateway as systemd user service (hermes-gateway.service under /root/.config/systemd/user/)
  3. Dashboard on :9119 with dashboard.basic_auth set in config.yaml, then --host 0.0.0.0
  4. Expose via Caddy using the socat unix-socket bridge pattern (host process ↔ dockerized Caddy): socat UNIX-LISTEN:/opt/prodg/data/hermes-dashboard/dashboard.sock,fork,mode=666 TCP:127.0.0.1:9119 Caddy: reverse_proxy unix//data/hermes-dashboard.sock (note double slash!)

Phase 5 — A2A agent mesh (the differentiator)

# ~/.hermes/config.yaml
gateway:
  platforms:
    a2a: {enabled: true, extra: {port: 9900}}
# ~/.hermes/.env
A2A_HOST=<tailnet-IP>          # binds tailnet-only; 0.0.0.0 requires token
A2A_PORT=9900
A2A_AGENT_NAME=<hostname>
A2A_PUBLIC_URL=http://<tailnet-IP>:9900
A2A_PEER_TOKENS=<peer>:<token>  # per-peer bearer auth
hermes tools enable a2a --platform a2a --platform telegram
# restart gateway OUTSIDE the gateway process tree:
systemd-run --user --unit=gw-restart /path/to/restart-gateway.sh

Verify: curl http://<IP>:9900/.well-known/agent-card.json

Joining agents (the recipe's replication protocol):

  1. tailscale up --login-server=https://headscale.<domain> --auth-key=<preauth>
  2. Same A2A config block on their side (own tailnet IP, own token)
  3. Register mainframe in their a2a_agents: config; round-trip test via a2a_call

Phase 6 — Agent browser (webcmd)

Cloak Chromium is headed by design (anti-fingerprint). On a headless server:

# /etc/systemd/system/xvfb-webcmd.service   → Xvfb :99 -screen 0 1920x1080x24
# /etc/systemd/system/webcmd.service        → Environment=DISPLAY=:99, daemon on :9777

Both enabled. Verify webcmd doctor all green. Install skill: webcmd skills add --provider agents --scope user then copy to ~/.hermes/skills/.

Phase 7 — Docs intelligence

hermes config set mcp_servers.context7.url https://mcp.context7.com/mcp
hermes config set mcp_servers.context7.headers.CONTEXT7_API_KEY <key>  # optional

Phase 8 — Apps, observability, backups

Follow the app-integration workflow in the prodg-mainframe-deployment skill (shared Postgres/Redis, UID table, port deconfliction, Caddy subdomain blocks). Backups: rclone → B2 nightly with Telegram notifications.

Final verification checklist

  • [ ] docker compose ps — all containers Up
  • [ ] tailscale status — client machines online
  • [ ] curl https://<each-subdomain>/ — 200
  • [ ] A2A Agent Card reachable from a tailnet peer
  • [ ] webcmd doctor green
  • [ ] B2 backup verified, Grafana alert delivered to Telegram

§8 Track B — Talos Linux variant (evaluation)

Talos Linux (Sidero Labs, MPL-2.0) is an immutable, API-driven OS for Kubernetes: no SSH, no shell, no package manager; the whole machine is one YAML applied over mTLS gRPC. Reboot = back to declared state.

What changes on Talos

Blueprint layerUbuntu recipeTalos equivalent
Host configssh + bash + filestalosctl apply machine-config YAML
Compose stackdocker-compose.ymlKustomize/Helm manifests (or .machine.pods static pods for a no-K8s edge node)
Caddycontainer in composeingress-nginx/Traefik or Caddy pod + Service/Ingress
Hermes gatewaysystemd user serviceStatefulSet/Deployment + PVC; platform bots reconnect on pod restart
Xvfb/webcmdtwo systemd unitspod with Xvfb sidecar + webcmd container (or drop webcmd for Playwright headless)
Headscalecompose containerHelm chart / manifest (expose via LoadBalancer/NodePort)
Node accessSSH roottalosctl API only (+ kubectl debug ephemeral pods)

Verdict

  • Choose Talos when: you want drift-proof infrastructure, fleet growth beyond one node, atomic OS+k8s upgrades, minimal CVE surface, or plan to run workloads as real Kubernetes services. Enterprise tier adds FIPS/NIS2 evidence if you ever need audit compliance.
  • Stay on Ubuntu (Track A) when: single node, you want SSH, systemd services (Hermes gateway, Xvfb bridges, socat sockets), docker-compose simplicity, and the battle-tested recipe in this document. The current mainframe's host-level patterns (unix-socket bridging, user services, webcmd+Xvfb) do not translate 1:1 to Talos.
  • Pragmatic hybrid: keep the mainframe on Ubuntu; use Talos for additional agent-worker nodes that join the tailnet and run Hermes agents as pods — the A2A mesh doesn't care what OS peers run.

Talos quick-start (for a new agent node)

# 1. Generate configs
talosctl gen config mainframe https://<node-ip>:6443
# 2. Apply (no SSH needed — ever)
talosctl apply-config --insecure --nodes <node-ip> --file controlplane.yaml
# 3. Bootstrap + kubeconfig
talosctl bootstrap --nodes <node-ip>
talosctl kubeconfig .
# 4. Make single controlplane schedulable
kubectl taint nodes <node> node-role.kubernetes.io/control-plane:NoSchedule-

Then deploy: Tailscale operator (or host-level tailscale via machine config extension), Headscale (if this node is the control plane), Hermes agent pod exposing A2A :9900 via Service.


Operating principles (what makes it a mainframe)

  1. One agent holds root. Hermes is the operator; humans supervise via Telegram/Discord.
  2. Tailnet-first. Nothing management-grade exposed publicly except Caddy-fronted apps.
  3. A2A over ad-hoc. Agents join by protocol, not by hand-copied SSH keys.
  4. Everything is a skill. Each hard-won fix becomes a reusable procedure.
  5. Declarative where possible. Compose yaml today; Talos machine-config tomorrow.

§9 Curated Talos Toolbox (from awesome-talos)

Community resources relevant to building Mainframe Track B/C instances

Bootstrap & config generation

  • talhelper (budimanjojo/talhelper) — declarative Talos config generation; the talosctl gen config step above, but as maintainable YAML+patches. Recommended for Mainframe instances.
  • talos-bootstrap (aenix-io) — interactive installer
  • Talm (aenix-io/talm) — Helm-like layered config management
  • ClusterTool (TrueCharts) — opinionated full-cluster deploy tool
  • TOPF (postfinance/topf) — lifecycle with layered patches + SOPS (fits the Infisical/secrets story)

Converting existing machines (no reinstall!)

  • nextboot-talos (Debian salsa) — convert an installed Linux VPS to Talos on next boot ★ (relevant: could convert a future mainframe VM without reprovisioning)
  • boot-to-talos (cozystack) — convert any live Linux distro to Talos

VM / hypervisor recipes (Mainframe = VM scenario)

  • proxmox-talos-opentofu (max-pfeiffer) — turnkey single-node Talos on Proxmox with OpenTofu — closest match to a Mainframe VM build
  • harbor-turnkey — single-node Talos on Proxmox, incl. image-cache registry
  • Hcloud Kubernetes (hcloud-k8s) — HA Talos on Hetzner (a mainframe hosting candidate)
  • terraform-talos (sergelogvinov) — multi-cloud examples

Fleet management & ops

  • Omni infra providers — official: bare-metal, KubeVirt, Libvirt, vSphere, Proxmox; community: Hetzner, AWS, DO, Scaleway, OVH
  • Kangal-Patch — safe rolling upgrades (drain → update → reboot)
  • tuppr — K8s controller for Talos+K8s upgrades
  • talos-pilot — TUI for node monitoring, logs, etcd health (operator console!)

Libraries

  • talos-linux-api (Python bindings for Talos gRPC) — ★ means a Hermes agent can drive Talos nodes natively via Python tools — no SSH needed, fits the A2A/mainframe operator model perfectly.

Recommended Mainframe Track C stack

talhelper (config) + Proxmox/Hetzner provider (VM) + Tailscale operator (mesh) + Hermes pod (A2A :9900) + talos-pilot (ops TUI) + Kangal-Patch (upgrades)

§10 Track C Prototype — Validated 2026-10-04 (real run)

Proven end-to-end on mainframe (libvirt/KVM):

  1. talhelper 3.1.17 → single-CP cluster prodg-trackc (Talos v1.14.2, K8s v1.37.0, flannel)
  2. ISO boot → talosctl apply-config --insecure → bootstrap → healthy cluster → kubectl green
  3. boot-to-talos v0.7.1 (cozystack) -mode boot (kexec): converted a running Ubuntu 24.04 VM into a Talos worker in RAM, joined cluster, pod scheduled + served via NodePort. "nextboot-style" conversion PROVEN.
  4. boot-to-talos -mode install FAILED on Ubuntu 24.04 (FSCONFIG_CMD_CREATE EINVAL — installer v1.14 userspace/kernel incompat). Use -mode boot then apply-config.

Gotchas (real, hit during prototype):

  • Talos raw disk images are .raw.zst now (not .raw.xz)
  • libvirt DHCP leases vary per boot → pin MAC per VM (--network ...,mac=52:54:00:xx:xx:xx); config endpoint IP must match actual lease, else apiserver endpoint-watch errors
  • talhelper ipAddress sets talosconfig endpoints only — NOT static node IP
  • talosctl reset wipes disk; if booted from ISO the cdrom may end up detached (virt-install --cdrom + reboot ejects) → re-create domain with ISO attached
  • Worker configs must NOT contain KubeFlannelCNIConfig doc (CP-only) — talhelper puts it in all nodes' configs; strip it from workers: python split('---') filter
  • First-boot NoCloud seed only applies on first disk boot — rebuild disk for new cloud-init
  • Nginx demo: PodSecurity restricted warnings are non-fatal

Files: /opt/prodg/talos/trackc/{talconfig.yaml,talsecret.yaml,clusterconfig/} VMs: trackc-node (192.168.100.207, CP), convert-test (Ubuntu→Talos worker)