Guides
Advanced
Post-deploy Command

Post-Deploy Command

This feature is currently in preview, reach out to our support team to request access.

Post-deploy commands are useful to run a command or script after deploying, for example busting a cache. After a successful deploy, we spin up a dedicated container to run the command and shut down the container after the command finishes.

Two Flightcontrol services support post-deploy command: fargate and fargate-worker. The command runs in the basePath directory of your application.

If the post-deploy command fails, the dashboard will show a deployment error, but the new code will remain deployed. We do not automatically rollback if the post-deploy command fails.

Limitation: at the moment post-deploy is only supported when using the Nixpacks build type or pre-built images that do not have a long running ENTRYPOINT.

Configuring Post-Deploy Command

Post-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.

Configuring postdeploy command in service settings

If you are using the flightcontrol.json file to configure your app, add a new parameter postDeployCommand to your service object.

{
    "id": "web",
    "name": "Webserver",
    "type": "fargate",
    "postDeployCommand": "pnpm run bust-cache"
    ... // remaining service config
}

Notifications

You can turn on email or Slack notifications for post-deploy command failures in organization settings.

Enabling Post-deploy Command Failure notifications in Organizations Settings