Upgrade a Server

Use this playbook when a stage or prod deploy stops with This commit changes the Server config: <files>. That happens after you merge the pull request that adops upgrade made, or any commit that changes Dockerfile, docker-compose.yml or a server/*.yaml file.

Those files sit at the root of <your-server-folder>. Every release folder shares them, and Docker reads them only when it builds and starts the containers. A deploy never changes them, because that would restart the Server under a run in progress. So adops server-release stops, changes no file, and you rebuild the Server once by hand. The Dockerfile holds the adops version the Server runs (ARG ADOPS_PACKAGE=adops==<version>), so a new version reaches the Server only through this rebuild.

Before you start

Rebuild the Server at the merged commit

Run these on the Server machine, not on your own checkout.

  1. Make sure no run is in progress: on the Dagster page, open Runs; nothing may be Queued, Starting or Started. A rebuild restarts the Server, and a restart kills runs in progress.

  2. Bring the Server config files to that commit. git restore also deletes a server/*.yaml file the commit removed:

    cd <your-server-folder>
    sudo -u <runner-user> git fetch origin
    sudo -u <runner-user> git restore --source=<commit> --worktree -- Dockerfile docker-compose.yml server
    
  3. Build the new image and restart the Server. --build is what installs the new adops version; without it the old image keeps running and the next deploy stops again. --wait returns once every container is running and healthy, and fails if one is not:

    sudo -u <runner-user> COMPOSE_PROFILES=server docker compose up -d --build --wait
    

    If you also run Grafana on this Server, use COMPOSE_PROFILES=server,grafana.

  4. Check it worked. Every service shows running (and healthy for dagster_meta), and the version printed is the one on the ARG ADOPS_PACKAGE line of the Dockerfile:

    sudo -u <runner-user> docker compose --profile server ps
    sudo -u <runner-user> docker compose --profile server exec dagster_daemon adops --version
    grep ADOPS_PACKAGE= Dockerfile
    

Re-run the deploy

Open the deploy that stopped (under Actions in the Project repository) and click Re-run jobs. The files now match, so adops server-release goes on; its log ends with current: releases/<commit>.