How do I initialise the NATS server config with compass?
compass nats init is part of the Provision pillar. It renders
build/config/nats.conf.template into a per-environment
build/config/nats-<label>.conf and creates the JetStream store directory.
It is called automatically by compass env init and can also be run standalone.
See NATS for background on the messaging system.
Question
How do I generate the per-environment NATS server configuration file?
Answer
./projects/ores.compass/compass.sh nats init
This writes build/config/nats-<label>.conf (with all {{VAR}} placeholders
substituted from the current .env) and ensures the JetStream store directory
exists. The output config is gitignored — it contains absolute paths specific
to this checkout.
To start the NATS server after init:
nats-server --config build/config/nats-<label>.conf
Script
projects/ores.compass/src/nats_init.py — called directly by compass env
init and exposed standalone as compass nats init.
Tested by
compass env init calls nats_init.generate() on every CI run.
See also
- NATS — background on the messaging system and ORE Studio's usage.
- How do I manage the checkout environment with compass? —
env initcalls this automatically. - How do I generate NATS certificates with compass? — the companion command for mTLS certs.