Run production on one VM

This playbook takes you from an empty Linux machine to a prod Server you can operate: it tells you when it is dead, warns you before its disk fills, and lets you put the previous release back with one click. It links to the other playbooks for the parts they already cover.

One machine runs one Server. Everything below runs on that machine, in the Server folder <your-server-folder> (for example /srv/adops), as the user that owns it (<runner-user>).

Before you start

Install the Server

Follow Promotion for the parts every Server shares, with prod in mind:

  1. Step 1: clone the Project into <your-server-folder>, fill in .env, and set ADOPS_ENVIRONMENT=prod. Set ALERT_WEBHOOK_URL to your alert webhook.
  2. One-time move to release folders, then start the Server.
  3. Step 2 and Step 3: a runner with the label adops-prod, and ADOPS_SERVER_DIR.
  4. Step 5: the prod environment. Set required reviewers on prod. The rollback workflow below is a one-click button that changes prod, and required reviewers are what makes a second person approve it. If your GitHub plan cannot set them, limit who has write access to the repository instead.
  5. Step 6: turn on prod in adops.yaml.

Check the Server is up: docker compose --profile server ps lists dagster_daemon and dagster_webserver as running. On the Dagster page (through an SSH tunnel to DAGSTER_WEBSERVER_PORT), Automation lists the sensors adops_heartbeat and adops_disk_alert as running.

Set up the Heartbeat

The Heartbeat tells an outside service, once a minute, that the Server is alive. When the daemon, its container or the whole machine dies, the pings stop and that service alerts you. adops cannot send that alert itself, because a dead Server sends nothing.

  1. In your dead-man's-switch service, create one check. Set its period to 1 minute and its grace period to a few minutes (3 is a good start), so that one slow tick does not wake you up. Copy its ping URL.

  2. Add it to the Server's .env:

    ADOPS_HEARTBEAT_URL=https://<your-check-ping-url>
    

    The URL is read from .env on every tick, so no restart is needed. It is masked in logs like a password. Never commit it.

  3. Within a minute the check shows a ping. On the Dagster page, the adops_heartbeat sensor's latest tick says heartbeat sent. A failed ping says heartbeat failed: <error type> and nothing else, because the error message could hold the URL.

With ADOPS_HEARTBEAT_URL unset or empty, nothing is sent.

What it does not catch: a Server whose daemon still ticks but whose runs are stuck. The Heartbeat only proves the daemon is running sensors. Stuck and dead runs are reported by the Stale Alert and the dead-run alert, through your alert webhook.

Set up the Disk Alert

The Server sends one Disk Alert through your alert webhook when the disk holding the Server folder reaches a level, and one Recovery Notice when it drops below it again. Nothing is sent in between, and a daemon restart does not send it again.

The level is 85% used by default. To change it, set a whole number from 1 to 99 in .env:

ADOPS_DISK_ALERT_PERCENT=80

This one is read when the Server starts, so apply it with docker compose --profile server up -d, which recreates the containers. With a value outside 1–99 the containers still run, but the Server loads no Pipelines, Schedules or sensors: the Dagster page shows an error for the code location adops.interface.server:defs, the daemon's log names ADOPS_DISK_ALERT_PERCENT, and the Heartbeat stops, so your dead-man's-switch service alerts you.

The percent is measured the way df shows it in the Use% column, for the disk that holds <your-server-folder>: df -P <your-server-folder>. Without ALERT_WEBHOOK_URL nothing is sent; the adops_disk_alert sensor's tick still shows the reading.

When the alert comes, see what grew: du -sh <your-server-folder>/.adops <your-server-folder>/releases and docker system df. Old release folders are deleted by each deploy; the Warehouse and Dagster's run history are what usually grow.

Roll back a bad release

Rollback puts prod back on the release it ran before the last deploy. It points current at the previous release folder and clears prod's saved Step Fingerprints and Deploy State.

What it does not do:

With the workflow

adops init (or adops upgrade) writes .github/workflows/adops-prod-rollback.yml. On GitHub, open Actions > adops prod rollback > Run workflow. It runs on the prod runner in the prod environment, so a required reviewer must approve it, and it never runs at the same time as a prod deploy. It rolls back, then reloads the Server's Pipelines and Schedules.

By hand

On the Server machine:

cd <your-server-folder>
sudo -u <runner-user> docker compose --profile server run --rm --no-deps -T dagster_daemon adops server-rollback --server-dir /project --env prod
sudo -u <runner-user> docker compose --profile server restart dagster_daemon dagster_webserver

The second command makes the Server load the previous release. Skip it and the Server keeps running the code it loaded before.

When it refuses

Rollback changes nothing and says why when:

It says What to do
... has no release older than the current one to roll back to. There is nothing to go back to: deploy a fixed release instead.
Release <commit> needs different Server config: ... The previous release needs another Dockerfile, docker-compose.yml or server/*.yaml. Rebuild the Server at that commit: Upgrade a Server.
<n> run(s) of the prod Environment ... are not finished. Wait for them, then run it again.
Another run is using the prod Warehouse; roll back later. Wait for that run, then run it again.
Could not reach the prod Warehouse. Start the Warehouse, then run it again.

Then fix the release on a branch and deploy it the usual way.

After a reboot

The Server's containers start by themselves after a reboot, and runs the reboot cut off are marked failed with one alert each. See Promotion: After a reboot. The Heartbeat check goes quiet while the machine is down; if the reboot takes longer than its grace period, you get one alert and then one "back up" message.

Back up and upgrade

Recorded trial

Date Where Result
2026-12-03 A prod Server on an AWS m7i-flex.large machine (Ubuntu 24.04, 2 cores, 8 GB, 20 GB disk, made by scripts/trial-ec2.sh), Postgres Warehouse. The Project was made with adops init --demo in a local Git repository standing in for GitHub, cloned into the Server folder and moved to release folders as above, with ADOPS_ENVIRONMENT=prod. Server image built from the unreleased wheel adops-0.7.0 with this horizon's changes. Alerts went to a local receiver (scripts/soak/alert_receiver.py); the Heartbeat went to a healthchecks.io check with a 1-minute period and 3-minute grace. Deploys and the rollback workflow were run by hand, as the same commands adops-prod.yml and adops-prod-rollback.yml run, with no GitHub runner All five checks passed; one playbook statement was corrected. 1. Install: pass. All five containers came up, and the Dagster page listed adops_heartbeat and adops_disk_alert as running. 2. Rollback, then a full rerun: pass. Release A deployed in full. Release B changed one dbt model, but its deploy reran every Step, because the demo Pipeline had no Schedule (a Pipeline without one always runs in full). Release C added a nightly Schedule, and release D then changed one model: its deploy printed step sync_shop: unchanged in prod and reran only the Transform and the reverse sync. The rollback workflow's two steps switched current from D to C and reloaded the Server (rolled back: ... -> ..., Step Fingerprints and Deploy State of prod were cleared). Deploying D again then reran all three Steps, with no unchanged line. The by-hand rollback and restart, as written above, also passed. Rollback refused with no change while a prod run held its Pipeline Lock (1 run(s) of the prod Environment ... are not finished), and when the oldest kept release was current (no release older than the current one). 3. Disk Alert: pass. A file filled the root disk to 93% for 4 minutes. The sensor read 93%, the same as df -P. The receiver got exactly one Disk Alert (The Server's disk is 93% full, at or above its Disk Alert level of 85%), nothing on the next three ticks, and exactly one Recovery Notice (back to 33% full) on the first tick after the file was removed. ADOPS_DISK_ALERT_PERCENT=90 took effect after up -d. A value of 100 left the containers running but the code location failed to load; the playbook said "refuses to start" and was corrected. 4. Missed Heartbeat: pass. The first tick after ADOPS_HEARTBEAT_URL was added to .env said heartbeat sent, with no restart. After docker compose stop dagster_daemon, healthchecks.io marked the check down 4 minutes after the last ping (1 minute period plus 3 minutes grace), the event that sends its email alert (the email itself was not captured), then marked it up again when the daemon was started. 5. Reboot: pass. After sudo systemctl reboot, every container was running again within 15 seconds of SSH coming back, with no command. The Heartbeat and Disk Alert sensors ticked again within a minute. The 72-hour shutdown was set again for the time left since first boot. Not tried: a GitHub runner and reviewers for the rollback workflow, a DuckDB Warehouse, a disk filled to 100%.