Dependencies
In a microservices architecture, services often have strict startup orders. For example, a backend API cannot accept requests until the database is ready.
Super allows you to define these relationships using the depends_on configuration.
Configuration
# 1. The Provider (Database)
[[programs]]
name = "postgres-db"
command = "/usr/bin/postgres"
# ... args ...
[programs.health_check]
type = "tcp"
port = 5432
# 2. The Consumer (API)
[[programs]]
name = "backend-api"
command = "./api-server"
depends_on = ["postgres-db"]How it works
When you start backend-api (or when Super autostarts it):
- Super checks if
postgres-dbis running. - If
postgres-dbis not running, it starts it. - Crucially, Super waits for
postgres-dbto become Healthy (pass its health check). - Only then does
backend-apistart.
State: “Waiting”
If a dependency is missing or unhealthy, the dependent process enters the Waiting state.
$ super list
ID Name Status Notes
-------- ------------ -------- ------------------------
a1b2... backend-api Waiting Waiting for: postgres-db
c3d4... postgres-db Starting ...Once postgres-db turns Healthy, backend-api automatically transitions to Starting.