Deploying
Promotion and approvals
Promote an app's image from another app (staging to production), and protect an app so that its releases wait for an admin's approval.
There's no separate notion of environments: staging and production are two apps (in one project), production promoted from staging.
Promoting
The app's Settings → Releases → Promote from, stackd promote web-staging web, or POST /api/apps/{id}/promote {"from": "<app id>"}: the app gets
the image the other one runs now (its newest healthy web replica's, else
its image) and deploys it. Only the image moves: variables, domains and
settings are each app's own. Deploy tokens may promote.
Protected apps
An admin turns protection on (Settings → Releases, stackd apps protect web on, PUT /api/apps/{id}/protection). From then on these become
deploy requests rather than deploys, unless an admin asks with all
their rights (in the panel, or with a full, unlimited token):
- deploying (
POST /api/apps/{id}/deploy, with or without an image); - rolling back (
POST /api/deploys/{batch_id}/rollback); - promoting to it;
- the deploy after a build: pushes through the webhook, and builds anyone else started.
So CI with a deploy token, members, and git pushes ask;
admins approve. The API answers those with 202 and the deploy request
instead of 201 and the deploy; stackd deploy says so and exits 0. A
newer request for the app supersedes the pending one.
Restarts, retries, scaling and redeploys after domain or setting changes aren't releases and go ahead as usual.
Deciding
Admins see pending requests on the app (Settings → Releases), in
stackd approvals list and GET /api/deploy-requests, and get a
Deploy awaiting approval alert on their channels.
Approving (POST /api/deploy-requests/{id}/approve, stackd approvals approve <id>) makes the request's image the app's and deploys it;
rejecting (…/reject) only records it. A request whose deploy can't
start (no server online) is marked failed, with why. Each request keeps
who asked, who decided and when, and the deploy it became.