Every time you runDocumentation Index
Fetch the complete documentation index at: https://docs.compartment.dev/llms.txt
Use this file to discover all available pages before exploring further.
compartment deploy, Compartment creates a candidate deployment alongside your currently active one. The candidate progresses through a series of stages before it ever receives live traffic. If anything goes wrong — at any stage — you can roll back to the previous active deployment without any downtime.
The promotion lifecycle
A deployment moves through thesepromotionStage values in order:
| Stage | What is happening |
|---|---|
building | Compartment is building the container image for the new deployment. |
starting_candidate | The new container has started and Compartment is waiting for it to initialize. |
checking_readiness | Compartment is polling the readiness endpoint (if configured) until the service reports healthy. |
switching_route | Traffic is being atomically moved from the previous active container to the new one. |
draining_previous | The old container is finishing any in-flight requests before it is stopped. |
active | The new deployment is fully live and serving all traffic. |
rolled_back | A rollback was triggered; a previous deployment has been restored to active. |
compartment status always reflects the latest promotionStage. A deployment does not receive any live traffic until it reaches switching_route.
Check deployment history
List recent deployments for a project to see their stages and IDs:--service to filter by a single service, or --limit to control how many records are returned:
--output json if you need machine-readable output for scripting:
Promote a deployment across environments
compartment deploy deploys to production by default. To move a build that is already active in one environment into another — for example from staging to production — use promote:
--from and --to are both required. Compartment finds the currently active deployment in the source environment and promotes it through the full candidate lifecycle in the target environment. Add --verbose to stream stage-by-stage progress:
Promotion creates a new deployment record in the target environment and runs the full readiness check cycle. It does not simply re-tag an existing container — the candidate goes through every stage as if it were a fresh deploy.
Roll back to the previous deployment
If the active deployment is behaving incorrectly, roll back immediately:active in the target environment, going through switching_route and draining_previous to maintain zero downtime.
To roll back in a specific environment:
compartment deployment list):
Next steps
- Set up environment-specific deployments — see Environments.
- Configure readiness checks so the candidate stage works correctly — see Build options.
- Promote builds as part of a CI pipeline by passing
--output jsonand parsing the result.