Release an application through staging before production. Environments organize resources, and workflows define the actions in a release.
You will need the following to get started:
- An application image that builds and starts successfully
- Resources and configuration for staging and production
- A release policy, a database migration plan, and a recovery procedure
1. Define the environments
Create the environments for staging and production. Identify the services, jobs, databases, and secrets that each environment uses.
Use separate secret groups where the values differ. Make sure that a staging deployment cannot write to production data through an unintended connection.
2. Define the release workflow
Configure a workflow for the build, database operations, and deployments that the application needs. Use the environment tutorial for an assembled example.
If a release changes a database schema, read Run migrations. Put required backups and migrations in the correct order for your application.
3. Exercise the release in staging
Run the workflow for staging. Inspect each node result and the application logs.
Make sure that the application serves requests and uses the intended data. Check the revision in your release records before proceeding to production.
4. Release to production
Use the production workflow after the staging checks and your release policy permit the change. Observe workflow results and health checks.
Define recovery before the release. Restoring an earlier image does not reverse a database migration. Review release strategies and database restore procedures for the application's requirements.
For gradual traffic changes, review canary rollouts. The release is complete when the intended revision is ready and the application checks succeed.