# Release through staging

Release an application through staging before production. Environments organize resources, and workflows define the actions in a release.

> [!note] Requirements
>
> 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](https://northflank.com/docs/v1/application/release/set-up-environments) for staging and production. Identify the services, jobs, databases, and secrets that each environment uses.

Use separate [secret groups](https://northflank.com/docs/v1/application/secure/manage-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](https://northflank.com/docs/v1/application/release/configure-workflows) for the build, database operations, and deployments that the application needs. Use the [environment tutorial](https://northflank.com/docs/v1/application/getting-started/set-up-environments) for an assembled example.

If a release changes a database schema, read [Run migrations](https://northflank.com/docs/v1/application/release/run-migrations). Put required backups and migrations in the correct order for your application.

### 3. Exercise the release in staging

[Run the workflow](https://northflank.com/docs/v1/application/release/run-and-manage-workflows) for staging. Inspect each node result and the [application logs](https://northflank.com/docs/v1/application/observe/view-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](https://northflank.com/docs/v1/application/observe/configure-health-checks).

Define recovery before the release. Restoring an earlier image does not reverse a database migration. Review [release strategies](https://northflank.com/docs/v1/application/production-workloads/release-for-production) and [database restore procedures](https://northflank.com/docs/v1/application/databases-and-persistence/backup-restore-and-import-data) for the application's requirements.

For gradual traffic changes, review [canary rollouts](https://northflank.com/docs/v1/application/release/canary-rollouts). The release is complete when the intended revision is ready and the application checks succeed.
