In addition to Configuration variables read by Aptible, Aptible also lets you configure your Apps through a
If you are using Dockerfile Deploy, this file must be named
.aptible.yml and located at the root of your repository.
If you are using Direct Docker Image Deploy, it must be located at
/.aptible/.aptible.yml in your Docker image. See Procfiles and
.aptible.yml with Direct Docker Image Deploy for more information.
This file should be a
yaml file containing any of the following configuration keys:
before_release should be set to a list, e.g.:
before_release: - command1 - command2
The commands listed under
before_release will run when you deploy your app, either via a
git push (for Dockerfile Deploy) or using
aptible deploy (for Direct Docker Image Deploy). However, they will not run when you execute
aptible restart, etc.
before_release commands are executed in an isolated ephemeral Container, before new Release Containers are launched. The commands are executed sequentially in the order that they are listed in the file.
If any of the
before_release commands fail, Release Containers will not be launched and the operation will be rolled back.
This has several key implications:
- Any side effects of your
before_releasecommands (such as database migrations) are guaranteed to have been completed before new Containers are launched for your app.
- Any changes made to the container filesystem by a
before_releasecommand (such as installing dependencies or pre-compiling assets) will not be reflected in the Release Containers. You should usually include such commands in your Dockerfile instead.
before_release commands are ideal for use cases such as:
- Automating database migrations
- Notifying an error tracking system that a new release is being deployed.
❗️There is a 30-minute timeout on
before_releasetasks. If you need to run something that takes longer, consider using Ephemeral SSH Sessions.