Post-deploy Command

Post-Deploy Command

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

When running the main application in a custom Dockerfile, you must use CMD instead of ENTRYPOINT

Configuring Post-Deploy Command

Post-deploy command can be configured as a service configuration parameter for web, worker, and scheduler 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": "web",
    "target": {"type": "fargate"},
    "postDeployCommand": ["bundle", "exec", "rake", "do:something"],
    ... // remaining service config


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