← All docs

Deploy hooks

Deploy hooks are scripts DotDeployer runs at fixed points in a deploy — before the new release goes live, or after it does.

Steps:

  1. Open the site from Sites, go to its Deploy hooks tab.
  2. Add a “before” hook, an “after” hook, or both. Each is a shell script that runs on the server, in the context of the release being deployed.
  3. Deploy the site. The hook’s output appears in the same live log as the rest of the deploy, on the Deployments tab.

Before hooks run against the new release before DotDeployer switches the current symlink to it and before the health check runs — a good place for anything the app needs in place before it starts serving traffic.

After hooks run once the new release is live — a good place for anything that should happen only after traffic has switched over.

Failure: if a before hook fails, the deploy stops there and the previous release stays live — the same as any other failed deploy. An after hook failing doesn’t roll back a release that’s already serving traffic, but it does show as failed in the log so you know to look at it.

Per site: hooks are set per site, not shared across a server — two sites on the same server can have entirely different hooks, or none.

The DotDeployer site Deploy hooks tab with a before and an after hook