Skip to content

Command Palette

Search for a command to run...

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.

phelix.yamlyaml
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: true

Execution order and failures

HookWhen it runs
pre_buildBefore building the artifact
post_buildAfter the artifact is built
pre_deployBefore changing instances or traffic
post_startAfter the candidate passes its health check
pre_trafficBefore traffic activation on proxy-based deployments
post_deployAfter the deployment is committed
pre_stopBefore stopping existing instances
post_rollbackAfter 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

Terminal
phelix hooks list api
phelix hooks status api
phelix hooks history api --hook pre_deploy --limit 10
phelix hooks inspect --last api

Each 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.