Your backend's database has to be ready before its new version takes traffic. A release command does that step for you: ngris runs it once with each new deploy, after the build and before anything changes for your visitors.
What's new
- A Release command setting on the Settings tab of backend and full-stack apps, and
release_commandonPUT /v1/applications/{uuid}and in the MCP server'sapp_settings_set. For examplepython manage.py migrate --noinput,npm run migrateorbin/rails db:migrate. - It runs with the new version. One copy of the new version starts with all your app's environment variables, secrets and databases, and runs the command with a shell.
- A failure keeps your current version live. If the command exits with an error, can't start, or is still running at your plan's time limit, the deploy fails and the previous version keeps serving. The deploy shows what happened, for example
Release command failed (exit 1), with the last 50 lines of the command's output. The values of your secret variables are hidden in it. - Once per deploy. A rollback to a version that was live before, a restart or a change of environment variables doesn't run it again.
Get started
- Open your app's Settings tab and type your command under Release command. Settings shows your plan's time limit.
- Make the command safe to run twice: use a migration tool that records what it has applied, and change your schema so the version that is live keeps working.
- Deploy. The release command runs before the new version goes live.
- Read the docs: Release command.