wheels deploy hooks
Manage deployment hooks for custom actions during the deployment lifecycle.
Synopsis
Description
The wheels deploy hooks
command allows you to manage custom hooks that execute at specific points during the deployment process. These hooks enable you to run custom scripts, notifications, or integrations at key deployment stages.
Actions
list
- List all configured deployment hooksadd
- Add a new deployment hookremove
- Remove an existing hookenable
- Enable a disabled hookdisable
- Disable a hook without removing ittest
- Test a hook executionshow
- Show details about a specific hook
Options
--stage
- Deployment stage (pre-deploy, post-deploy, rollback, error)--script
- Path to hook script or command--timeout
- Hook execution timeout in seconds (default: 300)--retry
- Number of retry attempts on failure (default: 0)--async
- Run hook asynchronously--environment, -e
- Target environment (default: all)--priority
- Hook execution priority (1-100, lower runs first)
Hook Stages
pre-deploy
Executed before deployment starts:
Backup creation
Service notifications
Resource validation
Custom checks
post-deploy
Executed after successful deployment:
Cache warming
Health checks
Monitoring updates
Success notifications
rollback
Executed during rollback operations:
Cleanup tasks
State restoration
Failure notifications
Recovery actions
error
Executed when deployment fails:
Error logging
Alert notifications
Cleanup operations
Incident creation
Examples
List all hooks
Add a pre-deploy hook
Add notification hook
Test a hook
Disable a hook temporarily
Show hook details
Hook Script Requirements
Hook scripts should:
Return exit code 0 for success
Return non-zero exit code for failure
Output status messages to stdout
Output errors to stderr
Handle timeouts gracefully
Example hook script
Environment Variables
Hooks receive these environment variables:
DEPLOY_STAGE
- Current deployment stageDEPLOY_ENVIRONMENT
- Target environmentDEPLOY_VERSION
- Version being deployedDEPLOY_USER
- User initiating deploymentDEPLOY_TIMESTAMP
- Deployment start time
Use Cases
Database backup hook
Notification hooks
Health check hook
Best Practices
Keep hooks simple: Each hook should do one thing well
Handle failures: Always include error handling in hook scripts
Set timeouts: Prevent hooks from blocking deployments
Test thoroughly: Test hooks in staging before production
Log output: Ensure hooks provide clear logging
Use priorities: Order hooks appropriately with priorities
Document hooks: Maintain documentation for all hooks
See Also
Last updated
Was this helpful?