Version 1.2.0
Lifecycle hooks
Run commands at defined build, deployment, rollback, and stop points, with recorded outcomes and remote execution.
Configure hooks
Lifecycle hooks run your commands at defined release points. Use them for backward-compatible migrations, smoke tests, cache warm-up, notifications, and draining. Each command is an argument array executed from the project directory, with a timeout and bounded retries.
hooks:
pre_deploy:
command: ["./bin/migrate", "up"]
timeout: 5m
retries: 2
retry_interval: 5s
post_start:
command: ["./scripts/smoke-test"]
timeout: 30s
pre_traffic:
command: ["./scripts/warm-cache"]
post_deploy:
command: ["./scripts/notify", "success"]
continue_on_error: trueExecution order and failures
| Hook | When it runs |
|---|---|
| pre_build | Before building the artifact |
| post_build | After the artifact is built |
| pre_deploy | Before changing instances or traffic |
| post_start | After the candidate passes its health check |
| pre_traffic | Before traffic activation on proxy-based deployments |
| post_deploy | After the deployment is committed |
| pre_stop | Before stopping existing instances |
| post_rollback | After a successful rollback |
Critical failures stop the operation and use its normal recovery path. Post-deploy and post-rollback failures are recorded without reversing an already committed outcome. Classic deployments skip pre-traffic because they have no separate traffic activation step.
Inspect executions
phelix hooks list api
phelix hooks status api
phelix hooks history api --hook pre_deploy --limit 10
phelix hooks inspect --last apiEach attempt records timing, exit code, failure reason, and captured output. Secrets are redacted and each output stream is bounded. Hooks receive the application name, deployment ID, strategy, current and previous versions, and attempt number.
Remote execution and recovery
The dashboard can inspect hook configuration, status, history, and output, and request remote execution through the connected monitor under the host's authorization rules. A successful attempt is skipped when its deployment is retried. An attempt interrupted while running is marked uncertain and is not automatically repeated.