Deploy¶
RetroSpeedLab runs on two own servers with Dokku, plus external platforms for the stream and the community. GitHub is the only way in: a push to main deploys itself.
Two servers¶
| Server | Runs |
|---|---|
| Web server | The backend, the website, the stream view, the games site, the docs, the object store, the vault, Bugsink, Uptime Kuma, Umami and the owner's sign-in gate |
| GPU server | The runner (search, PPO, lab), the maintainer, the lakehouse (Kafka, Spark, Airflow), Grafana, Tempo, the backups and the autodeploy |
A rented OBS host broadcasts the stream view to Twitch.
Apps¶
deploy/ holds the Dokku apps and the server scripts. One folder per app:
| Folder | App | Server |
|---|---|---|
runner/ |
The rotation image with FFmpeg and the Claude Code CLI; power-on runs before every deploy, the lab runs from its cron |
GPU |
backend/ |
uvicorn retrospeedlab.backend.main:app with a health check on /health |
Web |
www/ |
The website, built with Node and served by nginx | Web |
stream/ |
The stream view, served by nginx with an uncached index.html |
Web |
docs/ |
These docs, built with Zensical and served by nginx; rebuilt hourly for fresh numbers | Web |
site/ |
The games site, built by retrospeedlab.arcade.site and served by nginx |
Web |
maintainer/ |
repo-steward with its sandbox users; inbox with the owner's console and the article board run always, run, article and launch from cron; console-setup.sh carries steward.retrospeedlab.com from Main through an ssh tunnel |
GPU |
ask/ |
Ask me anything: uvicorn retrospeedlab.ask.main:app serves the page and the analyst on /api |
Web |
lake/ |
The lakehouse processes (stream, relay, chat, airflow), Kafka, Grafana, Tempo, the object store and the host metrics collectors |
Both |
The nginx apps send a Content Security Policy, a referrer policy and nosniff with every response.
Autodeploy¶
deploy/autodeploy/ runs every five minutes on the GPU server. It fetches main into one mirror of this repository and deploys each app one at a time, only when the app's folders changed since its last deploy and only after the commit's CI run passed. The shared Python is pyproject.toml, uv.lock and the modules directly in src/retrospeedlab/.
| App | Deploys when these change | Server |
|---|---|---|
| Runner | The shared Python, engine, games, search, runner, deploy/runner/ |
GPU |
| Backend | The shared Python, engine, games, backend, deploy/backend/ |
Web |
| Website | web/ with site/ and shared/, deploy/www/ |
Web |
| Stream view | web/ with stream/ and shared/, deploy/stream/ |
Web |
| Docs | The shared Python, engine, docs code, collection.yaml, docs-site/, deploy/docs/ |
Web |
| Games site | The shared Python, engine, games, arcade, deploy/site/ |
Web |
| Lakehouse | The shared Python, engine, games, search, lake, deploy/lake/ |
GPU |
| Maintainer | The shared Python, src/retrospeedlab/articles/, deploy/maintainer/ |
GPU |
| Ask me anything | The shared Python, web/ with ask/ and shared/, ask, the lake's ask transport, deploy/ask/ |
Web |
The web server's apps and the maintainer build the pushed commit with the Dockerfile in their deploy/ folder; the runner and the lakehouse build through their deploy.sh. On top:
- The runner deploys only in the last 30 minutes of a search turn, never during a lab session, and at most every three hours.
- The lakehouse pauses its DAGs and waits until no task runs.
- The maintainer deploys only between sessions, checks its health afterwards and rolls back to the last good commit when unhealthy; a refused commit stays refused until the maintainer's folders change again.
- The docs read the API's numbers when they build, so the autodeploy rebuilds them every hour with a new build argument that skips Docker's cache for that step.
- The coverage site follows the latest green CI run on
main.
A failed fetch is retried three times; a failed deploy is retried at the next run.
The autodeploy ships the apps, not itself. After a merge that changes them, run from WSL:
deploy/autodeploy/setup.shwhenautodeploy.sh,secrets.pyorsecrets.yamlchange: the Home Lab runs installed copies, so a new app or a new secret mapping waits for it.deploy/wheelhouse.shwhenuv.lockchanges a pin of thelakeorrunnerextra: the lakehouse and the runner build offline from the Home Lab's wheelhouse.
Secrets¶
Every secret lives in the self-hosted Vaultwarden, in the organisation RetroSpeedLab. Dokku configuration is only the sync target: deploy/autodeploy/secrets.yaml names every secret and the apps that get it, and secrets.py syncs the values every 15 minutes, restarting an app only when it is idle.
| Secret names | Apps |
|---|---|
ANTHROPIC_API_KEY, BLUESKY_APP_PASSWORD, BUGSINK_ALERTS_DSN, CHAT_COMMAND_KEY, DEVTO_API_KEY, DISCORD_CLIENT_SECRET, GITHUB_WEBHOOK_SECRET, KOFI_VERIFICATION_TOKEN, KUMA_WEBHOOK_TOKEN, LINKEDIN_CLIENT_SECRET, OPENROUTER_API_KEY, OPS_SIGNING_KEY, PLAYER_SESSION_KEY, RESTREAM_CLIENT_SECRET, SSO_SECRET, STREAM_API_KEY, WEBSITE_GITHUB_TOKEN, YOUTUBE_UPLOAD_REFRESH_TOKEN |
Backend |
STREAM_ELEMENTS_JWT, TWITCH_CLIENT_SECRET, UPTIME_URL, YOUTUBE_CLIENT_SECRET, LAKE_ACCESS_KEY_ID, LAKE_SECRET_ACCESS_KEY |
Backend, lakehouse |
BUGSINK_API_BASE, BUGSINK_API_TOKEN, DISCORD_BOT_TOKEN |
Backend, lakehouse, maintainer |
CONSOLE_API_KEY |
Backend, maintainer |
DISCORD_CLIENT_SECRET, CONSOLE_SESSION_SECRET, VAPID_PRIVATE_KEY (the console) |
Maintainer |
GITHUB_TOKEN |
Backend, lakehouse, maintainer, runner |
UPLOAD_API_KEY |
Backend, lakehouse, maintainer, runner, host collectors |
BUGSINK_DSN |
Backend, maintainer, runner |
CLAUDE_CODE_OAUTH_TOKEN |
Maintainer, runner |
BACKEND_API_KEY (the value of UPLOAD_API_KEY), BUGSINK_TEAM_ID |
Maintainer |
DISCORD_OWNER_ID |
Backend, maintainer |
UMAMI_PASSWORD, AIRFLOW__API_AUTH__JWT_SECRET, YOUTUBE_REFRESH_TOKEN |
Lakehouse |
GARAGE_RPC_SECRET |
Object store |
ASK_ANTHROPIC_API_KEY |
Ask me anything |
ASK_ALTCHA_KEY |
Ask me anything |
ORACLE_FEED_KEY |
Backend, Ask me anything |
Setup scripts¶
The setup scripts run once from a workstation. They read server names, folders and accounts from the environment and stop when one is missing; nothing private is in the repository. They share the helpers for dokku over SSH in deploy/dokku.sh.
| Script | Requires |
|---|---|
autodeploy/setup.sh |
RUNNER_SERVER, RUNNER_DOKKU, SPEEDLAB_DIR, FASTDATA_DIR, RUNNER_WORKING_DIR, WHEELHOUSE_DIR |
maintainer/setup.sh |
RUNNER_SERVER, RUNNER_DOKKU, SPEEDLAB_DIR, FASTDATA_DIR, RUNNER_WORKING_DIR |
autodeploy/pypi.sh |
RUNNER_SERVER, RUNNER_DOKKU, FASTDATA_DIR |
runner/setup.sh |
RUNNER_SERVER, RUNNER_DOKKU, BACKEND_DOKKU, RUNNER_WORKING_DIR |
runner/deploy.sh, lake/dokku/deploy.sh |
RUNNER_SERVER, RUNNER_DOKKU, WHEELHOUSE_DIR |
wheelhouse.sh |
RUNNER_SERVER, WHEELHOUSE_DIR |
backups/setup.sh |
RUNNER_SERVER, RUNNER_DOKKU, MAIN_SERVER, SPEEDLAB_DIR, FASTDATA_DIR |
backups/authorize-main.sh |
RUNNER_SERVER, MAIN_SERVER, SPEEDLAB_DIR |
ops/setup.sh |
RUNNER_SERVER, MAIN_SERVER, RUNNER_DOKKU, SPEEDLAB_DIR |
vaultwarden/setup.sh |
MAIN_SERVER, VAULT_HOST, VAULTWARDEN_OWNER_EMAIL |
lake/dokku/setup.sh |
RUNNER_SERVER, RUNNER_DOKKU, MAIN_SERVER, FASTDATA_DIR, RUNNER_WORKING_DIR |
lake/dokku/kafka-setup.sh, hosts-setup.sh |
RUNNER_SERVER, RUNNER_DOKKU, FASTDATA_DIR |
lake/dokku/grafana-setup.sh |
RUNNER_SERVER, RUNNER_DOKKU, MAIN_SERVER, FASTDATA_DIR |
lake/dokku/gate-setup.sh |
RUNNER_SERVER, RUNNER_DOKKU, MAIN_SERVER, DISCORD_OWNER_ID |
maintainer/console-setup.sh |
RUNNER_SERVER, RUNNER_DOKKU, MAIN_SERVER, after lake/dokku/gate-setup.sh |
lake/dokku/lan-setup.sh |
UMAMI_URL, BUGSINK_URL, UPTIME_URL, VAULT_HOST, DISCORD_GUILD_ID, LAN_DNS_SERVER and the server names |
certs/setup.sh |
MAIN_SERVER, OWNER_EMAIL |
The backend's and Ask me anything's start commands need TRUSTED_PROXY_IPS, Ask me anything also its own read-only LAKE_ACCESS_KEY_ID and LAKE_SECRET_ACCESS_KEY; the host metrics collector needs HOST_NAME, GPU, UPLOAD_API_KEY and BACKEND_URL.
Backups¶
deploy/backups/ makes encrypted restic backups every night at 20:30 UTC to an offsite store: every Postgres database, the vault, the brand masters, the videos, the object store and the lake's bronze layer. It keeps 7 daily, 4 weekly and 6 monthly snapshots.
On the 1st of every month a restore test restores the main database into a scratch Postgres, the vault (and checks it opens), and the bronze table bronze.source_watermarks, which Spark must read. Uptime Kuma watches both jobs and alerts when the last restore test is older than 35 days; failures also go to Bugsink.
Disk watch¶
deploy/disk/ installs a watch on both servers that checks every local disk every 10 minutes. Above 85 % it reports to Uptime Kuma and Bugsink (rule disk_full), above 90 % as critical; it reports itself down when the check fails.
Ops gate¶
deploy/ops/ installs the ops gate on both servers: ops-gate from PyPI in a root-owned venv at /opt/ops-gate, a user whose SSH key may only run ops-gate serve, sudo rules generated by ops-gate sudoers from verbs.toml, the backend's public signing key as /etc/ops-gate/approver.pub, the backend's approvals URL and a timer that runs ops-gate update every two minutes to install newly enabled verb tables.
Vaultwarden¶
deploy/vaultwarden/ sets up the vault hardened: no sign-ups, invitations, hints, Sends or emergency access, rate-limited logins and fail2ban. A watch every 15 minutes reports admin logins, failed logins, bans and new devices to Bugsink, and a weekly update backs up first and rolls back when the new version is unhealthy.
Unknown subdomains¶
deploy/certs/ gives every unknown subdomain of retrospeedlab.com and datenwissenschaften.com the branded 404 page over HTTPS instead of a TLS error. lego gets one Let's Encrypt wildcard certificate per domain with the DNS-01 challenge: a hook writes the challenge record into the self-hosted NSD zone, bumps its serial and reloads the zone. A timer renews both certificates twice a day once they have less than 30 days left and reloads nginx after nginx -t passes. Every other unknown name still gets no answer.
Monitoring¶
| Tool | Watches |
|---|---|
| Bugsink | Application errors, the backend's alert rules, deploy rollbacks, secrets sync, backups, the vault |
| Uptime Kuma | Every public service, the nightly backup, the restore test and the vault watch |
| Grafana + Tempo | OpenTelemetry traces of the lab, experiments, the search bandit, search turns, PPO training and both machines |
All three sit behind the owner's single sign-on and are never linked from the public site.
Releases¶
Every game-version change ships the itch.io pack: the release notes are python -m retrospeedlab.arcade.itch notes, and when they differ from the last release the pack is built, pushed to itch.io with butler and tagged as a new release. Players never wait for a manual release.