Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Deployment

ZERG deploys in two variants per the Spacebeam brand architecture:

ZERG at zergs.net — Spacebeam-hosted control plane; user connects hardware via Luna worker WILDZERG at wildzerg.com — self-hosted via the wild blueprint (runit + podman + OpenResty); full sovereignty, air-gap capable

This guide covers WILDZERG self-hosted deployment. For ZERG, sign up at zergs.net.

Deployment Options

MethodUse CaseDetails
wild blueprint (recommended, the ONLY production model)Production self-hostedrunit + podman + OpenResty GitOps; provisioned from the wild repo (clone URL + WILD_REF below)
k0s KubernetesWILDZERG Enterprise + MCP Gatewayk0s single-node or multi-node; see corp/docs/k0s-evaluation.md
ManualDevelopment onlyErlang/OTP + Python/Tornado installed directly — NOT a production deployment model

Services

ServiceTechnologyPortAccess
zerg-solErlang/OTP 29.121434localhost only
zerg-mangoPython/Tornado5800localhost only
OpenRestyTLS reverse proxy80/443public
postgresqlDatabase5432localhost only

Production Deployment (wild blueprint)

Production deployment is owned by the wild repo — the only supported production model. Docker is banned company-wide; there is no Docker Compose stack. Wild provides the canonical runit + podman + OpenResty GitOps model and its autonomous CD pipeline (Crow CI, podman backend) builds the 8 ZERG images hermetically and deploys them on a tag push.

Wild repo / WILD_REF (pinned dependency): wild is NOT part of this tree and is not a public URL on this page — the clone URL and the per-release pin (ci/wild-pin, git checkout $(cat ci/wild-pin), see .crow.yml) are documented in the operator runbook docs/production-runbook.md (§Deployment — Primary Path). For the current topology, service table, provisioning scripts and deploy paths, see wild/AGENTS.md in that repo (§“CD Build Execution”). From-scratch production host: follow wild’s provisioning scripts (wild/scripts/provision/) rather than any manual steps — the manual section below exists for local development only. Operator runbooks: the deploy / upgrade / rollback flow is in the WILDZERG Runbook; day-2 procedures in the Production Runbook; offline sites in Air-Gap Install.

Manual Dev Deploy (development only)

⚠ NOT a production deployment model. These steps run the components directly on the host for local development. Production deploys via the wild blueprint above; runit supervision, OpenResty TLS and image provisioning are wild’s job, never manual sv/systemd units on a production host.

Prerequisites

apt-get install -y postgresql postgresql-contrib OpenResty certbot python3-pip
pip3 install --break-system-packages tornado bcrypt aiosqlite

Install Erlang/OTP 29.1 via asdf:

mkdir -p ~/.asdf/bin
curl -sL https://github.com/asdf-vm/asdf/releases/download/v0.15.0/asdf-v0.15.0-linux-amd64.tar.gz \
  | tar xz -C ~/.asdf/bin/
export ASDF_DIR=~/.asdf
export PATH=~/.asdf/bin:$PATH
asdf plugin add erlang
asdf install erlang 29.1
asdf set -u erlang 29.1

Step-by-Step Manual Deploy

⚠ ARCHIVED / DEVELOPMENT-ONLY. This manual path is not a production deployment model and is not exercised by CD. The paths below (/opt/zerg) belong to the retired on-host layout; the shipped container root is /opt/sol, and production is wild’s runit + podman GitOps model (see Production Deployment and docs/production-runbook.md). Do not copy these steps onto a wild-managed host.

1. PostgreSQL Setup

sudo -u postgres psql -c "CREATE USER zerg WITH PASSWORD 'CHANGE_ME';"
sudo -u postgres psql -c "CREATE DATABASE zerg OWNER zerg;"
sudo -u postgres psql -c "CREATE DATABASE zerg_auth OWNER zerg;"
sudo -u postgres psql -c "ALTER USER zerg CREATEDB;"

2. Build Sol Server

PATH=~/.asdf/installs/erlang/29.1/bin:$PATH rebar3 as prod release

3. Deploy Release

mkdir -p /opt/zerg/{bin,etc,log,data,luna,limon,mango,plugins}
cp -a _build/prod/rel/sol/* /opt/zerg/
cp sys.config /opt/zerg/releases/{VERSION}/sys.config
cp vm.args /opt/zerg/releases/{VERSION}/vm.args

4. Deploy Luna Agent

cp client/build/luna /opt/zerg/luna/luna
chmod +x /opt/zerg/luna/luna

5. Deploy Mango Auth

cp -a mango/* /opt/zerg/mango/

6. Deploy Limon Dashboard

cp -a limon/dist/* /opt/zerg/limon/

7. Create Admin User

import bcrypt, json, uuid, sqlite3, time
db = sqlite3.connect('/opt/zerg/mango/data/mango.db')
pw_hash = bcrypt.hashpw(b'YOUR_PASSWORD', bcrypt.gensalt()).decode()
user_uuid = str(uuid.uuid4())
db.execute(
    'INSERT INTO users (uuid, account, password, email, role, data, created_at) VALUES (?,?,?,?,?,?,?)',
    (user_uuid, 'admin', pw_hash, 'admin@example.com', 'admin',
     json.dumps({"account":"admin","email":"admin@example.com","role":"admin","nickname":"Admin"}), time.time()))
db.commit()
db.close()

8. Bootstrap Admin RBAC

Mango’s setup_db auto-seeds admin RBAC on startup. Restart Mango (dev: python3 server.py from the mango/ checkout, after stopping the previous instance):

cd /opt/zerg/mango
python3 scripts/bootstrap_admin.py --auto

The RBAC chain is: admin user -> system-admin team -> admin role -> permissions: ["*"]

9. SSL Certificates

Dev-only convenience for exercising TLS locally. Production TLS is provisioned by wild (OpenResty + certbot on the operator host).

certbot certonly --webroot -w /var/www/html -d YOUR_DOMAIN -d www.YOUR_DOMAIN \
 non-interactive --agree-tos --email admin@YOUR_DOMAIN
certbot certonly --webroot -w /var/www/html -d api.YOUR_DOMAIN \
 non-interactive --agree-tos --email admin@YOUR_DOMAIN

10. OpenResty Configuration

Dev-only reverse-proxy example. Production nginx configuration lives in wild (runit/sv/openresty/conf/sites/*.conf).

server {
    listen 443 ssl http2;
    server_name YOUR_DOMAIN;

    ssl_certificate /etc/letsencrypt/live/YOUR_DOMAIN/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/YOUR_DOMAIN/privkey.pem;
    ssl_protocols TLSv1.2 TLSv1.3;

    root /opt/zerg/limon;
    index index.html;

    location / { try_files $uri $uri/ /index.html =404; }
    location /api/ { proxy_pass http://127.0.0.1:21434; proxy_buffering off; }
    location /v1/  { proxy_pass http://127.0.0.1:21434; proxy_buffering off; }
    location /events { proxy_pass http://127.0.0.1:21434; proxy_buffering off; proxy_read_timeout 86400s; }
    location /auth/ { proxy_pass http://127.0.0.1:5800; }
    location /health { proxy_pass http://127.0.0.1:21434; }
}

server {
    listen 443 ssl http2;
    server_name api.YOUR_DOMAIN;
    ssl_certificate /etc/letsencrypt/live/api.YOUR_DOMAIN/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/api.YOUR_DOMAIN/privkey.pem;

    location / { proxy_pass http://127.0.0.1:21434; proxy_buffering off; }
    location /events { proxy_pass http://127.0.0.1:21434; proxy_buffering off; proxy_read_timeout 86400s; }
    location /auth/ { proxy_pass http://127.0.0.1:5800; }
}

# Metrics are NOT served by the public site. This monitoring-only listener
# binds loopback; the same-host Prometheus scrapes it directly. Sol's gate
# admits a tokenless scrape only from a LOOPBACK TCP peer whose
# X-Forwarded-For chain (if present) is entirely loopback.
server {
    listen 127.0.0.1:9110;
    server_name _;
    location /metrics { proxy_pass http://127.0.0.1:21434; }
}

A REMOTE Prometheus must scrape Sol directly with Authorization: Bearer <token> (the token needs metrics:read) or through a private listener like the loopback one above; never publish /metrics or /api/v1/metrics from the public server_name blocks.

11. Run for Development

The components run directly in dev (no service manager involved):

# Sol (in server/): rebar3 shell
# Mango (in mango/): python3 server.py
# Limon (in limon/): npm run dev

Production supervision is runit via wild (runit/sv/zerg-*); the systemd-unit era ended with the deploy model. Do not install hand-rolled units on a production host.

12. Verify

curl -sk https://YOUR_DOMAIN/health
curl -sk https://api.YOUR_DOMAIN/health

Environment Variables

Most SOL_* variables map through sol_app:apply_env_overrides/0 into the sol application env; a few are consumed by server/bin/entrypoint.sh (for example SOL_PLUGIN_DIR creates the container mount directory and has no Sol app-env reader). See docs/configuration-reference.md for the authoritative per-key table. The commonly used ones:

VariableDefaultDescription
SOL_CLUSTER_COOKIEunset (dev) / required (prod)Erlang distribution cookie — installed as a 0400 $HOME/.erlang.cookie (never in argv); prod requires an explicit ≥16-char non-dev value
SOL_PGVECTOR_ENABLEDfalseEnable pgvector search
SOL_WORKER_HEARTBEAT_TIMEOUT_MSshipped sys.config/sys.prod.config = 15000 (code fallback 45000)Worker heartbeat eviction timeout

SOL_CONTAINER_ENGINE is not read by Sol — there is no such env mapping or config key; the runtime is wild’s podman model.

Notes:

The /metrics Prometheus endpoint is always mounted (loopback-gated in production); there is no enable flag for it. The heartbeat check interval (worker_heartbeat_check_ms, default 10000) is sys.config-only — it has no SOL_* environment override.

Production Checklist

[ ] Change default passwords and secrets [ ] Enable TLS via OpenResty reverse proxy [ ] Set auth_enabled to true [ ] Configure firewall rules (allow 80/443 only) [ ] Bootstrap admin RBAC [ ] Verify /metrics responds and Grafana scrapes it [ ] Configure PostgreSQL for memory/embeddings [ ] Verify health endpoints respond [ ] Test admin-gated endpoints return 200 [ ] Enable automatic certificate renewal (certbot renew)

Rollback (wild-provisioned host)

Image-level rollback is driven by wild’s CD pipeline (flip IMAGE back to IMAGE.prev in runit/sv/<svc>/env/); on a runit-managed host the manual service restart is:

sv stop zerg-sol
cp -a /opt/zerg/releases/{VERSION} /opt/zerg/releases/{VERSION}.bak
sv start zerg-sol

Maintenance Mode

Enable maintenance mode to gracefully drain traffic during deployments:

curl -X POST https://api.YOUR_DOMAIN/api/v1/infra/maintenance/enable \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"reason": "deploying v{VERSION}"}'

curl -X POST https://api.YOUR_DOMAIN/api/v1/infra/maintenance/disable \
  -H "Authorization: Bearer $TOKEN"

Health and auth endpoints remain accessible during maintenance mode.