A pre-deploy job is an optional task that runs after each build, but before all your services are deployed. It is commonly used for preliminary tasks which are required for your services to run, such as a database migration or seeding. Note: any commands that are used to build your application should not be included in a pre-deploy job, as the build will already be completed by the time the pre-deploy job is run.

You can specify the pre-deploy job for your application both in the Porter dashboard and in your porter.yaml file.

Configuring pre-deploy in the Porter dashboard

You should see the pre-deploy section at the top of your application’s Overview tab: Add predeploy from UI

Alternatively, when creating a new application, you will see the same section in the creation flow. From here, you can specify the start command (e.g., bash ./migrate-db.sh) as well as resources allocated for the job. After updating your application, the pre-deploy command will be run after the next build.

Configuring pre-deploy in the porter.yaml file

If you are new to porter.yaml, start here. Otherwise, see here for info about configuring a pre-deploy job in your porter.yaml file.

Tracking pre-deploy progress

Your pre-deploy job will run after your build completes successfully. You can track its progress in the Activity tab of your application: Predeploy activity feed

You can view logs of the pre-deploy job while it runs or after it completes:

Predeploy logs