You're viewing the docs for Flags 0.x. The latest is 1.x (rc). Go to the 1.x (rc) docs
Deployment
Where background work runs — in your web processes, as durable workflows, or in a separate worker.
The background work — relaying events to sinks, running scheduled changes, computing experiment results, pruning the log — is safe to run on many replicas at once. Two options decide where it runs: role and dispatcher, the same vocabulary as the other Agora libraries.
dispatcher
| Value | Background work runs |
|---|---|
auto (default) | As durable workflows when @adonis-agora/durable's provider is registered, otherwise in process |
durable | As durable workflows (fails at boot without durable). Each run, error and retry is in the durable console |
in-process | On a timer in every web/worker process |
role
| Value | This process |
|---|---|
all (default) | Serves requests and runs background work |
api | Serves requests only |
worker | Runs background work only (no control-plane routes) |
A separate worker
role: env.get('FLAGS_ROLE', 'all'),Run web processes with FLAGS_ROLE=api, and one process with:
node ace flags:work # stays up
node ace flags:work --once # one pass, for a cron job
node ace flags:work --sink=archiveSeveral workers are fine: each sink is leased to one of them at a time, and each scheduled change is claimed by one.