Promote Configs Across Environments
Massdriver promotes one instance at a time. mass instance copy, aliased promote, writes the configuration of one instance to another instance of the same component. Deploying the destination is a separate step.
mass instance promote ecomm-staging-db --to ecomm-production-db

The source here is a PostgreSQL instance in a preview environment, on latest+dev with tuned params:

The destination, in production, is still on v0.0.0:

After the promote, the destination has the source's params and version, ready to deploy:

What is copied​
- The source's params, except fields the bundle marks
$md.copyable: false - The source's version constraint and release strategy (
stableordevelopment)
| Flag | |
|---|---|
--to | Required. The destination instance. |
-o, --overrides | A JSON or YAML file of params, deep-merged onto the source params before they are written. Use it for values that differ between environments, such as instance size or replica count. |
--copy-secrets | Copy the source's secret values. Needs instance:configure on the source. |
--copy-remote-references | Copy the source's remote references. Needs resource:view on each referenced resource, and a resource grant that shares it with the destination environment. |
The copy runs in one transaction. If a step or a permission check fails, nothing is copied.
Without overrides, the destination gets the same configuration as the source.
Flow​
# Copy staging's database config to production
mass instance promote ecomm-staging-db --to ecomm-production-db
# Or with production sizes
mass instance promote ecomm-staging-db --to ecomm-production-db \
--overrides ./prod-db.yaml
# Review the change with a plan, then deploy
mass instance deploy ecomm-production-db --plan
mass instance deploy ecomm-production-db
Components must match​
The source and destination must be instances of the same component. The API refuses any other copy.
In CI​
- name: Promote staging configs to production
if: github.ref == 'refs/heads/main'
run: |
mass instance promote ecomm-staging-db --to ecomm-production-db
mass instance promote ecomm-staging-app --to ecomm-production-app
A promote changes configuration only, so production does not change until someone deploys it. To require approval, give the CI service account instance:propose in production and deploy with --propose. Refer to Two ways to deploy a change.
Beyond two environments​
Any two instances of the same component work:
- Regions:
mass instance promote api-prod-uswest-db --to api-prod-useast-db - Tenants:
mass instance promote api-template-cache --to api-acme-cache - Disaster recovery rehearsals: promote production into a parallel environment and deploy there.
Reference​
mass instance copy, aliaspromotecopyInstancein the V2 API- Fork an environment to copy a whole environment