Skip to content
Skip to article
View as Markdown

Deployment

Build the release

On a build machine compatible with the target operating system and architecture, run the following from the repository root. The release includes Erlang's runtime.

export MIX_ENV=prod
mix deps.get --only prod
mix compile
mix assets.deploy
mix release

Start a new installation

Place the unpacked release on the target host and make PostgreSQL reachable. Set the runtime environment for the migration process and the application service. Generate SECRET_KEY_BASE once with mix phx.gen.secret on the build machine, store it with the service's secrets, and reuse it across restarts. Set PHX_SERVER=true to start the HTTP listener. Production environment variables.

From the unpacked release directory, migrate the database before starting the server.

bin/dodo_router eval 'DodoRouter.Release.migrate()'
bin/dodo_router start

Check GET /api/version for the running version and GET /health for readiness. A healthy instance returns 200 with {"status":"ok"}. The endpoint returns 503 while the application is draining or the database is unavailable.

GitHub Actions and Tailscale

The app and website deployment workflows use tailscale/github-action@v4 with the existing TS_OAUTH_CLIENT_ID, TS_OAUTH_SECRET, and tag:github. The OAuth client needs permission to create auth keys for that tag, as described in the action's setup instructions.

The older v2 action installs Tailscale 1.42.0, whose OAuth support requires an experimental environment flag. On runners where sudo -E does not preserve the environment, it exits with oauth authkeys are in experimental status before authenticating. Use v4's newer client; rotating credentials does not repair a missing environment flag.

After merging a workflow correction, start a fresh run from the updated branch. GitHub's Re-run jobs uses the original commit and therefore the old workflow. Website documentation changes on main automatically start Deploy Website; workflow-only changes require its Run workflow action.

The Build & Release workflow publishes with GITHUB_TOKEN, whose release event does not trigger another workflow. Start Deploy to Production with Run workflow, select main, and enter the published version without its v prefix. Leave Force full install disabled for a normal hot upgrade; enable it only when required by an OTP/ERTS change. Confirm the running version at GET /api/version and health at GET /health after deployment.

OAuth configuration caches are cleared during the application's hot-upgrade configuration callback. After an OAuth policy update, check /.well-known/oauth-authorization-server for the new advertised methods; they must agree with registration and token exchange. For the Claude registration fix, the list is client_secret_basic, client_secret_post, and none. Previously broken confidential clients need a fresh registration: remove and re-add the connector after upgrading.

Upgrading to multiple router API keys

For migration 20260925222451_create_router_api_keys, stop all application instances, run migrations, then start the new release. This transition needs a restart rather than a hot or rolling upgrade: the old release can create or regenerate a key after the migration has copied the existing credentials, leaving the new key out of the new table.

Existing credentials are preserved as keys named Default. Once the new release is running, additional keys can be created and revoked independently. Do not roll back to a single-key release after managing keys: it cannot authenticate additional keys and its legacy router columns do not reflect revocations.