Pre-Deploy Command
This feature is currently in preview, reach out to our support team to request access.
The pre-deploy command allows you to run a command after the build step and before the deploy step. The command runs as part of the deployment lifecycle, meaning the whole deployment will fail if the command fails. Two Flightcontrol services support pre-deploy command: fargate
and fargate-worker
.
Pre-deploy commands are perfect for commands and scripts crucial for the operation of your application, for example database migration. The command runs by spinning a container similar to the runtime container while overriding the start command. The command runs in the basePath
directory of your application.
Limitation: at the moment pre-deploy is only supported when using the Nixpacks build type or
pre-built images that do not have a long running ENTRYPOINT
.
Configuring Pre-Deploy Command
Pre-deploy command can be configured as a service configuration parameter for fargate
and fargate-worker
services.
If you are using the dashboard to configure your project, set the command as shown in the screenshot.
If you are using the flightcontrol.json file
to configure your app, add a new parameter preDeployCommand
to your service object.
{
"id": "web",
"name": "Webserver",
"type": "fargate",
"preDeployCommand": "pnpm prisma db push"
... // remaining service config
}
Notifications
You can turn on email or Slack notifications for pre-deploy command failures in organization settings.