Dependencies
Runix supports process dependencies — a process can wait for other processes to be running before starting.
Configuration
processes:
postgres:
entrypoint: postgres
priority: 100
health_check:
type: tcp
tcp_endpoint: localhost:5432
redis:
entrypoint: redis-server
priority: 90
health_check:
type: tcp
tcp_endpoint: localhost:6379
api:
entrypoint: ./cmd/api
depends_on: [postgres, redis]
priority: 50
worker:
entrypoint: worker.py
depends_on: [postgres, redis, api]
priority: 10
Startup Ordering
When starting from a config file, Runix resolves dependencies using topological sort:
Start order: postgres → redis → api → worker
Resolution Algorithm
- Build a dependency graph from
depends_onfields - Detect circular dependencies (rejected with error)
- Perform topological sort (Kahn's algorithm)
- Within each level, sort by priority (higher priority starts first)
- Start processes in order, waiting for each dependency to reach
runningstate
Priority
Priority is used as a tiebreaker when processes have no dependency relationship:
| Priority | Behavior |
|---|---|
| Higher value | Starts first |
| Default (0) | Starts last among peers |
processes:
critical-service:
priority: 100 # Starts first
standard-service:
priority: 50 # Starts second
low-priority:
priority: 0 # Starts last
Circular Dependency Detection
Circular dependencies are detected at config validation time:
processes:
a:
depends_on: [b]
b:
depends_on: [a]
Error: circular dependency detected: a → b → a
Runtime Behavior
When a process has dependencies:
- Runix checks if all dependencies are in
runningstate - If not, the process waits (with context cancellation support)
- Once all dependencies are running, the process starts
- If a dependency crashes and doesn't recover, the dependent process stays in
createdstate
What's Next
- Process Lifecycle — Full start sequence
- Configuration Reference —
depends_onandpriorityfields