Deployment Hooks

Amezmo will run a set of scripts for you before, during, and after your deployment. These scripts are exepcted to be located in the .amezmo directory of your applications root directory. The scripts are executed as a shell script using Bash. A set of environment variables are given to the script, for your reference. For example, the file after.pull is executed for the event After Pull

Note that Amezmo will fail your deployment, if any of your hook scripts return a non-zero exit status. However, there is one exception to this rule. The before.pull hook must have its exit status ignored to avoid a repeated cycle of failure.

Hook list

These are the supported deployment hooks. You are not required to have deployment hooks. Every hook listed is optional. Note that for each hook listed, it is expected to be under the directory named .amezmo. This directory should be at the root of your applications directory tree.

Before Pull

The file before.pull is executed before Amezmo fetches the latest updates from your git provider. The exit status of this script is ignored. Relative to your application root directory, the full path of this hook is .amezmo/before.pull.

After Pull

The file after.pull is executed after Amezmo fetches the latest updates from your git provider. This script is where you would want to fetch dependencies from Composer If your script returns a non-zero exit status, the deployment fails. Relative to your application root directory, the full path of this hook is .amezmo/after.pull.

Before Deploy

The file before.deploy is executed before Amezmo updates your web server directory. If your script returns a non-zero exit status, the deployment fails. Relative to your application root directory, the full path of this hook is .amezmo/before.deploy.

Success

The file deploy.success is executed after Amezmo successfully deploys your application. This is the last hook that runs. If your script returns a non-zero exit status, the deployment fails. Relative to your application root directory, the full path of this hook is .amezmo/deploy.success.

Failure

The file deploy.failure is executed after Amezmo encounters a non-zero exit status from any of your hooks, or with the deployment process. Relative to your application root directory, the full path of this hook is .amezmo/deploy.failure.

Environment variables

Your hook script will have the following pre-defined environment variables set.

APPLICATION_ROOT

This is where your code is located on the server. Most times this will have the value of /webroot

REPO_NAME

The name of the repository currently being deployed

DEPLOY_BRANCH

The name of the branch currently being deployed

Hook Monitoring

On the Deployments tab, you can see a list of your deployments. To view a single deployment click on the link in the status column. Note that, Amezmo will only show the hooks that were executed in the table below.

Limits

  • There is a 5 minute limit on hook execution
Need support?

We're always happy to help with either application or infrastructure questions Always feel free to reach out to us on Twitter, or contact support.

Subscribe