DocsBuild and deploy
Deploy commands
Commands that run once for every deployment, before the new version takes traffic. The place for database migrations.
Use with AI
Deploy commands run once for every deployment, after the build and before the new version takes traffic. They are the place for work that has to happen once per release, such as a database migration.
Set them
Section titled “Set them”Open Settings, Build & deploy, Deploy commands, write one command per line and save:
npm run migrateThey are used from the next deployment on. Only the owner and the admins of the team can change them; for a member the card says “Only team admins can change the install, build, start and deploy commands.” A line cannot end with a carriage return alone or with a backslash, and control or invisible characters are refused.
When you create an app whose package.json has prisma among its dependencies, npx prisma migrate deploy is filled in for you. The guide on the new app’s page asks you to check it.
How they run
Section titled “How they run”- Once, not on every replica. They run on a separate, short-lived copy of the new version. That copy takes no traffic and is removed afterwards.
- With your variables. All your environment variables are set, so a command can reach your database.
- Without root rights, like the app itself. A command can write in the folder of the app, in the home folder and in
/tmp. - In the folder of the app, or inside
buildfor an AdonisJS app, where the build writesace. - In order, as one script that starts with
set -e. The first command that fails stops the rest, and so does a failing part of a line:false; echo okfails. The shell and the time limit are started by their full path, so aPATHvariable of yours changes which programs the commands find, not how they are started or stopped. - For up to 15 minutes in total.
- With their output in the build log, each line cut at 2,000 characters. Past the log’s limit the log says “The log is full: further output is not shown. The work goes on.” The value of one of the app’s variables shows as
[hidden]. - Counted by the second while that copy runs, at the price of the size of the new version, on the bill’s line Jobs and commands, outside the compute cap shown under Scaling. See Billing.
If one fails
Section titled “If one fails”The deployment fails and the app that is running is not changed. The deployment page shows the message:
| Message | Meaning |
|---|---|
| A deploy command failed (exit code N). The running app was not changed. | A command ended with an error. Its output is in the build log |
| The deploy commands did not finish within 15 minutes. The running app was not changed. | They took too long |
| The deploy commands ran out of memory. The running app was not changed. | They need more memory than the size of the app has |
| The deploy commands were stopped before they finished. Deploy again. | The deployment was ended while they ran. Deploy again |
When they run
Section titled “When they run”| Deployment | Deploy commands |
|---|---|
| Git push, manual deploy | Run |
| Deploy hook | Run |
| Restart, redeploy | Run |
| Rollback | Do not run |
| Domain change | Do not run |
What to keep in mind
Section titled “What to keep in mind”- Old code is still running. While a migration runs, the previous version still answers requests. Write migrations that the old code can live with.
- A rollback does not undo them. Rolling back brings back old code, not old data.
- Files they write are not kept. The copy they run on is thrown away. To create files for the app, use a build command.
© 2026 Orbit