Deployments

Deploy hooks and commands

Running your own commands on every release, and triggering deploys from CI with a URL.

Deploy commands

Settings → Deploy commands takes a list of shell commands, one per line, that run on every deploy after di:compile and static-content:deploy and before the release goes live.

bin/magento config:set web/seo/use_rewrites 1
bin/magento indexer:reindex catalogsearch_fulltext
bin/magento setup:static-content:deploy -f en_US de_DE

They run in the new release directory, as the deploy user, with the same 2 GB PHP memory limit as the rest of the release phase.

A failure aborts the deploy. The commands run under set -e, so a non-zero exit stops everything before the symlink switch — your live store keeps serving the previous release. This is the behaviour you want: a release whose reindex failed is a release you do not want customers on.

Good candidates: extra locales, index rebuilds, cache warming, configuration you want in version control rather than in the admin UI.

Bad candidates: anything that takes many minutes (it lengthens every deploy), and anything that must run exactly once — these run on every deploy.

The deploy hook

Settings → Deploy hook mints a URL:

curl -X POST https://nautvia.com/webhooks/deploy/YOUR_TOKEN

A POST deploys the current head of the environment's branch. Use it from CI that runs tests first, from a scheduled job, or from anything that is not a git push.

Two things to know:

  • The token is the only authentication. Anyone holding the URL can trigger a deploy. Keep it in your CI secret store, and regenerate it by turning the hook off and on again.
  • The hook works even when push-to-deploy is off. That combination is the point: tests pass in CI, CI calls the hook, and a bare git push deploys nothing.

Requests are rate-limited to 60 a minute.

Which trigger deploys what

Trigger Deploys
Deploy button The current head of the branch
Push to the branch The exact commit that was pushed
Deploy hook The current head of the branch

Only a push carries a specific commit, which is why the deployment list shows a commit message for pushes and a bare reference for the other two.

One-off commands

For something you need to run once — a reindex, a cache flush, a data patch — use the Commands tab rather than a deploy command. See Metrics, logs and commands.