Skip to content

Configuration Reference

Runtime configuration is supplied via CLI flags and environment variables. The one persistent config file is backend/collector_keys.toml, which defines the allow-list of NATS keys the collector mirrors into Redis.

CLI flag Env var Default Description
--ship SHIP_NAME (required) Ship identifier. Used as the NATS bucket name and Redis key prefix.
--domain SHIP_DOMAIN rc Domain segment of the NATS server URL.
--redis-host REDIS_HOST localhost Redis server hostname.
--redis-port REDIS_PORT 6379 Redis server port.
--poll-interval POLL_INTERVAL 5 Seconds between data pulls from NATS.
--keys-config backend/collector_keys.toml Path to the TOML allow-list of NATS keys to mirror.
--debug DEBUG 0 Set to 1 to enable verbose logging.

NATS URL is derived as: nats://coredata-{SHIP_NAME}.{SHIP_DOMAIN}.mbari.org:4222

collector_keys.toml

The TOML file has a single top-level array, keys, listing NATS KV keys in their original dotted UPPERCASE form. Only the keys listed here are fetched per poll.

keys = [
    "ROV.CTD.INWATER",
    "ROV.MBARI.DEPTH",
    "SHIP.GPS.LAT",
    "SHIP.GPS.LON",
    "ROV.POSITION.LAT",
    "ROV.POSITION.LON",
]

To add a new metric to the dashboard or detector, append its NATS key here, rebuild the collector containers, and reference the resulting Redis key (lowercased, dots → colons) from your consumer.

dive_detector

CLI flag Env var Default Description
--ship SHIP_NAME (required) Ship identifier. Used as the Redis key prefix.
--redis-host REDIS_HOST localhost Redis server hostname.
--redis-port REDIS_PORT 6379 Redis server port.
--depth-threshold 5.0 ROV depth in metres. The ROV must exceed this value for a dive to be detected.
--obs-host OBS_HOST (required) Hostname of the machine running OBS.
OBS_PORT 4455 OBS WebSocket port (read by the script when constructing the controller).
OBS_PASSWORD "" OBS WebSocket password (empty if auth is disabled on the server).
--poll-interval POLL_INTERVAL 10 Seconds between Redis polls.
--debug DEBUG 0 Set to 1 to enable verbose logging.

frontend

Env var Default Description
REDIS_HOST redis Redis hostname.
REDIS_PORT 6379 Redis port.
NODE_ENV production Node environment.
PORT 3000 Port the SvelteKit Node server listens on.
HOST 0.0.0.0 Bind address.
DASHBOARD_PASSWORD (unset) When set, requires login before controls are rendered/accepted. Unset = auth disabled.
SESSION_SECRET (unset) HMAC key used to sign session cookies. Set to a long random string in production.

See Frontend Dashboard → Authentication for the full auth design.

Ship identifiers

Ship SHIP_NAME SHIP_DOMAIN OBS host
R/V Rachel Carson rcsn rc rc-teleops.rc.mbari.org
R/V David Packard dpkd dp dp-teleops.rc.mbari.org

Redis schema

Keys follow the pattern {SHIP_NAME}:{path}. Sensor keys come from NATS via the collector; state keys are written by the detector; config keys are written by the dashboard.

Redis key Type Source / writer Description
{ship}:rov:ctd:inwater int (0/1) navproc_collector ← ROV.CTD.INWATER 1 when CTD sensor is submerged
{ship}:rov:mbari:depth float (m) navproc_collector ← ROV.MBARI.DEPTH ROV depth
{ship}:ship:gps:lat float (°) navproc_collector ← SHIP.GPS.LAT Ship latitude
{ship}:ship:gps:lon float (°) navproc_collector ← SHIP.GPS.LON Ship longitude
{ship}:rov:position:lat float (°) navproc_collector ← ROV.POSITION.LAT ROV latitude
{ship}:rov:position:lon float (°) navproc_collector ← ROV.POSITION.LON ROV longitude
{ship}:state:streaming int (0/1) dive_detector Last commanded streaming state
{ship}:state:obs_ok int (0/1) dive_detector Whether the OBS comms probe succeeded last poll
{ship}:state:obs_last_error string dive_detector Most recent OBS error (empty when healthy)
{ship}:config:auto_stream int (0/1) frontend Operator-controlled auto toggle
{ship}:config:force_stream int (0/1) frontend Operator-controlled manual override

Sensor keys carry a 600 s TTL (set by the collector). State and config keys have no TTL — they encode operator intent and the detector's observation, which should persist between polls.

The detector treats missing sensor keys as False (not in water). The dashboard treats missing toggle keys as false (off).

OBS scenes

These scene names are referenced directly by the dive detector and must exist in each OBS instance before the detector is started:

Scene name Used when
MainOnly OBS should be streaming (dive in progress, or force_stream ON)
FeedOffline OBS should be stopped (no dive, or both toggles OFF)

Depth threshold guidance

The default depth threshold of 5.0 m guards against false positives when the ROV is being deployed near the surface. If the ROV regularly pauses at shallow depth before beginning its descent, raise the threshold accordingly via the --depth-threshold CLI flag (currently no env var equivalent — set it in the command of the Compose service if you need to override per-ship).