How do I initialise the NATS server config with compass?

Table of Contents

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 configure 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.

Do not start nats-server by hand against this config. NATS is a systemd unit like every other service (nats-server-<label>.service); start it via How do I start the ORE Studio services?:

./projects/ores.compass/compass.sh services start

Starting any individual service unit also pulls NATS up automatically — each generated unit carries Requires=nats-server-<label>.service, so systemctl --user start ores.iam.service-<label> (for example) starts NATS first if it isn't already running.

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 configure calls nats_init.generate() on every CI run.

See also

Emacs 29.3 (Org mode 9.6.15)