Rolling Reload
Rolling reload restarts processes in batches, allowing zero-downtime updates.
How It Works
Usage
CLI
# Rolling reload with default batch size (1)
runix reload api --rolling
# Reload 3 processes at a time
runix reload api --rolling --batch-size 3
# Wait for readiness between batches
runix reload api --rolling --wait-ready
# Rollback on failure
runix reload api --rolling --rollback
Configuration
Rolling reload is triggered via CLI flags, not config file. The options are:
| Option | Flag | Default | Description |
|---|---|---|---|
| Batch size | --batch-size | 1 | Number of processes to reload concurrently |
| Wait ready | --wait-ready | false | Wait for health checks between batches |
| Rollback | --rollback | false | Stop and revert on first failure |
Implementation
Located at internal/supervisor/rolling.go:
type RollingReloadOptions struct {
BatchSize int
WaitReady bool
RollbackOnFailure bool
}
Batch Processing
- Processes are sorted by name (deterministic order)
- Divided into batches of
BatchSize - Each batch is reloaded concurrently using a
sync.WaitGroup - Between batches, optionally wait for readiness
Rollback
When RollbackOnFailure is enabled:
- If any process in a batch fails to reload, the entire rolling reload is aborted
- Already-reloaded processes are stopped
- The error is returned to the caller
Wait Ready
When WaitReady is enabled:
- After each batch completes, Runix waits for all reloaded processes to pass health checks
- If no health check is configured,
runningstate is sufficient - Proceeds to the next batch only after all processes in the current batch are ready
Use Cases
Zero-Downtime API Deployment
# 3 API instances, reload one at a time
runix reload api --rolling --batch-size 1 --wait-ready
Fast Bulk Reload
# Reload everything concurrently in batches of 5
runix reload all --rolling --batch-size 5
Safe Database Migration
# Reload workers, rollback if anything breaks
runix reload worker --rolling --rollback
What's Next
- Reload Command — CLI flags
- Health Checks — Readiness verification
- Multi-Instance — Running multiple copies