Title: Deploy has no release-phase hook, so database migrations run by hand after the health gate · Issue #88 · cloudfall-dev/cloudfall · GitHub
Open Graph Title: Deploy has no release-phase hook, so database migrations run by hand after the health gate · Issue #88 · cloudfall-dev/cloudfall
X Title: Deploy has no release-phase hook, so database migrations run by hand after the health gate · Issue #88 · cloudfall-dev/cloudfall
Description: Problem Found while deploying Abecra's staging on 2026-10-19. The API's schema is managed by Alembic. cloudfall_deploy unpacks the release, runs uv sync, switches current, restarts the unit and gates on the health check; there is no step...
Open Graph Description: Problem Found while deploying Abecra's staging on 2026-10-19. The API's schema is managed by Alembic. cloudfall_deploy unpacks the release, runs uv sync, switches current, restarts the unit and gat...
X Description: Problem Found while deploying Abecra's staging on 2026-10-19. The API's schema is managed by Alembic. cloudfall_deploy unpacks the release, runs uv sync, switches current, restarts the unit...
Opengraph URL: https://github.com/cloudfall-dev/cloudfall/issues/88
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Deploy has no release-phase hook, so database migrations run by hand after the health gate","articleBody":"## Problem\n\nFound while deploying Abecra's staging on 2026-10-19. The API's schema is managed by Alembic. `cloudfall_deploy` unpacks the release, runs `uv sync`, switches `current`, restarts the unit and gates on the health check; there is no step where a declared command runs against the new release before (or after) traffic moves to it. `component.schema.json` has no field for one: `service.command` is the only command a component declares.\n\nThe workaround, after `cloudfall deploy` returns, is an SSH command that sources `shared/env/\u003ccomponent>.env` by hand and runs `.venv/bin/alembic upgrade head` from `current/` as the app user. That means:\n\n- the health gate checks a release against the old schema, so a release whose code needs the new schema either fails the gate (and rolls back) or passes it and then serves errors until the manual step runs\n- a failed migration leaves no receipt and does not stop or roll back the deploy\n- the environment the migration sees is reassembled by hand instead of the unit's own `EnvironmentFile`\n\n## Proposal\n\nA declared release command, run by the deploy role on one server after `uv sync` and before the `current` switch:\n\n```yaml\nspec:\n release:\n command: [.venv/bin/alembic, upgrade, head]\n workingDirectory: services/api\n timeoutSeconds: 300\n```\n\n- Runs as the application's `linuxUser`, in the new release directory, with the same environment file the systemd unit gets\n- Runs once per deploy even when `deployment.servers` lists several servers (on the first server only, recorded in the receipt)\n- A non-zero exit or timeout fails the deploy before `current` moves; the previous release keeps serving. The command's exit code and the tail of its output go into the release receipt\n- `cloudfall deploy` without `--yes` shows the command in the plan\n- Rollback does not run it (downgrades stay a human decision); the plan says so\n\n## Alternatives\n\n- Run migrations at application start: works for one server but races on several, and turns a failed migration into a failed health check with less evidence\n- A separate `cloudfall run \u003ccomponent> -- \u003ccommand>` one-off command: useful on its own (shells, backfills), but it leaves ordering with the deploy to the operator\n\n## Acceptance\n\n- A component with `release.command` that adds a table: after `cloudfall deploy --yes` the table exists, and the receipt records the command, exit code 0 and output tail\n- A release command that exits 1: the deploy fails with `ENGINE_STEP_FAILED`, `current` still points at the previous release, and the service was not restarted\n- With two servers declared, the command runs once\n- The command sees every variable from the component's `environment` and `secretRefs`\n\nDepends on cloudfall-dev/cloudfall#119\nDepends on cloudfall-dev/cloudfall#120","author":{"url":"https://github.com/apps/shipmill-romamo","@type":"Person","name":"shipmill-romamo"},"datePublished":"2026-10-19T18:01:50Z","url":"https://github.com/cloudfall-dev/cloudfall/issues/88"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7729d279-3206-c6b2-fa53-817242644991 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 841E:265693:1CD022F:26BEE8F:6B0554D9 |
| html-safe-nonce | 981422733a17ba5a764a252657f555c5640832a31f77635b5b71182b21092ac7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NDFFOjI2NTY5MzoxQ0QwMjJGOjI2QkVFOEY6NkIwNTU0RDkiLCJ2aXNpdG9yX2lkIjoiNzExMjc4MTY0NDMyNjg1MTgwMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8d80744f6da824248fd3b004046b9291bc5fb9f5e27d368d3b82679618086a4c |
| hovercard-subject-tag | issue:5928925982 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/cloudfall-dev/cloudfall/88/issue_layout |
| twitter:image | https://opengraph.githubassets.com/22fab82d621a1e119b0a362b03b5461a2efcbccdb7d6dca38ba7fb7b2ac7341e/cloudfall-dev/cloudfall/issues/88 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/22fab82d621a1e119b0a362b03b5461a2efcbccdb7d6dca38ba7fb7b2ac7341e/cloudfall-dev/cloudfall/issues/88 |
| og:image:alt | Problem Found while deploying Abecra's staging on 2026-10-19. The API's schema is managed by Alembic. cloudfall_deploy unpacks the release, runs uv sync, switches current, restarts the unit and gat... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | shipmill-romamo[bot] |
| hostname | github.com |
| expected-hostname | github.com |
| None | 854d880890b5e847b3fce9d1b31f032107baeddeebad2aa379c48aa4f1451f6b |
| turbo-cache-control | no-preview |
| go-import | github.com/cloudfall-dev/cloudfall git https://github.com/cloudfall-dev/cloudfall.git |
| octolytics-dimension-user_id | 339512759 |
| octolytics-dimension-user_login | cloudfall-dev |
| octolytics-dimension-repository_id | 1360999777 |
| octolytics-dimension-repository_nwo | cloudfall-dev/cloudfall |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1360999777 |
| octolytics-dimension-repository_network_root_nwo | cloudfall-dev/cloudfall |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 220e980097d94ce616d5d11fbd5316d208e3fc93 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width