Configuration
Selvara is configured in two places. Deployment wiring — where the database is, what signs the sessions, how long metrics are kept — is environment. Everything an administrator changes while the instance is running — the time zone, the mail server, what agents are told to do — lives in the database and is edited in the dashboard.
This page lists every environment variable the code actually reads. It was
built by reading the source, not the compose file, so it includes a few the
shipped docker-compose.yml does not set.
Application
These are read by the running dashboard.
| Variable | Purpose | Required | Default | If wrong or missing |
|---|---|---|---|---|
DATABASE_URL | PostgreSQL connection string for the app and the migrations. | Yes | none | scripts/migrate.mjs prints DATABASE_URL is not set and exits 1, so the container never starts. A wrong host or password produces connection errors on every request and "database":"error" from /api/health. |
DATABASE_POOL_MAX | Maximum node-pg pool connections. | No | 20 | Too low starves requests under load; too high exhausts max_connections on the server (the compose file sets it to 200). Note that pool options in the connection string are ignored — this variable is the only knob. |
DATABASE_STATEMENT_TIMEOUT_MS | Per-statement timeout for the app's pool. | No | 30000 | Raising it lets one runaway history query pin a connection for minutes. Lowering it makes slow dashboards fail instead of crawl. |
REDIS_URL | Redis for the live updates and rate-limit counters. | In practice yes | redis://localhost:6379 | Unreachable Redis does not take the app down: rate limiting fails open and logs, and /api/health reports "redis":"error" with HTTP 503. Open dashboards stop updating until it is back. |
APPRISE_URL | Base URL of the Apprise API service that delivers the notification channels. | No | none; the compose file sets http://apprise:8000 | Unset, channels can be stored but nothing is sent, and Settings → Notifications says so. Unreachable, every message fails and the reason is shown on the channel. |
AUTH_SECRET | Signs NextAuth session cookies; it is not an encryption key. | Yes | none | Compose refuses to start without it. Changing it invalidates every session and nothing else. |
AUTH_URL | The public base URL. NextAuth derives its callback and CSRF endpoints from it; notification and e-mail links and the sign-in link of the command line are built from it. | Yes | falls back to an empty string in link-building code | A mismatch with the address in the browser breaks sign-in. An empty value produces notification links that go nowhere. No trailing slash. |
NEXTAUTH_URL | The same public base URL. /api/agent/install.sh and /api/agent/version read only this one, with no fallback to AUTH_URL. | Yes | none | With it unset, the generated agent install command and the agent download URL come out with an empty host, so agents cannot update themselves. Always set it to the same value as AUTH_URL. |
WEBHOOK_SECRET | The instance's HMAC secret. Each agent signs a short-lived JWT with its own secret, which the dashboard derives from this one and the host id and writes into the config.yaml the installer fetches; the instance-wide value itself never leaves the server. Agents installed by 2.x still sign with it until they update to agent 3.0.0 and switch; see Upgrading. | Yes | none | Compose refuses to start without it. Changing it makes every agent request 401 and the hosts look offline until their configuration is fetched again. /api/agent/config answers 500 Server misconfigured when it is unset. |
WEBHOOK_ALLOW_PRIVATE_HOSTS | Lets webhooks be sent to loopback, private and link-local addresses. | No | unset (refused) | Without it a webhook whose address is, or resolves to, an internal one is not sent and says so on the delivery. Set it to true only when the receivers are meant to be internal. See Webhooks. |
SETTINGS_ENCRYPTION_KEY | Derives the AES-256-GCM key for secrets stored in the database. | Yes | none | Compose refuses to start without it. See the section below. Treat it as permanent. |
CLIENT_RELEASES_DIR | Directory the installers of the desktop client are stored in. | No | /data/client-releases in the image; data/client-releases under the working directory elsewhere | The compose file mounts the volume client_releases there. Without a volume, published installers disappear with the container, and the download page and update feed list builds whose files are gone. See Client Releases. |
CRON_SECRET | Bearer token the alert-evaluation endpoint checks. | No in code, yes in the shipped compose file | none | See the section below. Unset means the endpoint is open. |
GATEWAY_URL | Where the app reaches selvara-gateway, which signs jobs, SSH certificates and tunnel grants. | For jobs, SSH and tunnels | http://gateway:8080 in the compose file | Unset or unreachable, everything that needs a signature is refused, and a job fails with "no job signer"; monitoring is unaffected. See Jobs. |
GATEWAY_TOKEN | Bearer token the app presents to the gateway. Must equal the gateway's own GATEWAY_TOKEN. | Yes in the shipped compose file | none | A mismatch makes the gateway answer 401 to every call, so nothing gets signed. |
VULN_DATA_DISABLED | 1, true or yes stops every download of vulnerability and lifecycle data: no sync runs, the button in Settings is disabled and the switch there cannot turn downloads back on. | No | unset | Downloads stay on, once a day. See Vulnerability Data. |
NODE_ENV | Standard Node environment. The image sets production. | Set by the image | production in the image | Outside production the trusted-device cookie is not marked Secure. Do not override it in a deployment. |
PORT | Port the server binds. | Set by the image | 3000 | Change it and the compose healthcheck and port mapping, which both name 3000, stop matching. |
HOSTNAME | Bind address. | Set by the image | 0.0.0.0 | Binding to loopback inside the container makes it unreachable from the proxy and from the other containers. |
JOB_SIGNING_SEED | Base64 32-byte Ed25519 seed the dashboard signs jobs with locally. For development only. | No | none | Refused when NODE_ENV is production; the dashboard never holds the signing key there. |
NEXT_TELEMETRY_DISABLED | Turns off Next.js telemetry. | Set by the image | 1 | No operational effect. |
Retention and TimescaleDB
These are read once per container start, by scripts/migrate.mjs, when it
configures the hypertable and its policies. They are not read by the running
app.
| Variable | Purpose | Default |
|---|---|---|
METRICS_CHUNK_INTERVAL | Hypertable chunk width for metrics. Retention drops whole chunks, so this is also the granularity at which space comes back. | 1 day |
METRICS_RAW_RETENTION | How long full-resolution samples are kept. | 7 days |
METRICS_COMPRESS_AFTER | Age at which raw chunks are compressed. Typically 10–20x on this kind of data. | 2 days |
METRICS_5M_RETENTION | How long the metrics_5m rollup is kept. Also bounds the one-time backfill when that rollup is first created. | 30 days |
METRICS_1H_RETENTION | How long the metrics_1h rollup is kept. This is the longest history any chart can show. | 400 days |
METRICS_MAX_MIGRATE_BYTES | Safety rail. If metrics is still a plain table and is larger than this, the conversion to a hypertable is refused rather than attempted, because converting rewrites the whole table and needs that much free disk again. | 21474836480 (20 GiB) |
Settings → Data retention lists the three metric periods read-only, as the container sees them, together with the fixed ones: 90 days of event history and of terminal recordings, 30 days of inbox entries.
All of these accept a PostgreSQL interval string, so 12 hours, 14 days and
6 months are all valid.
Changing one and restarting is not always enough. The policies are registered
with if_not_exists => true, which leaves an existing policy alone rather than
rewriting its interval. Check what is actually installed:
docker exec -i selvara-db psql -U monitoring -d selvara -c \
"SELECT job_id, application_name, config FROM timescaledb_information.jobs
WHERE application_name NOT LIKE 'Telemetry%';"
If a policy still shows the old interval, drop it and let the next start re-register it:
docker exec -i selvara-db psql -U monitoring -d selvara -c \
"SELECT remove_retention_policy('metrics');"
docker compose restart app
Shortening retention deletes data on the policy's next run and that data is gone. Take a dump first — Backup and Restore.
Gateway
selvara-gateway reads its own variables: GATEWAY_TOKEN,
GATEWAY_PUBLIC_URL, GATEWAY_JOB_TYPES, GATEWAY_RATE_PER_SYSTEM,
GATEWAY_RATE_GLOBAL, GATEWAY_REMOTE_ACTIONS (off unless true: lets the
dashboard set the actions of hosts that leave it open, see
Agent Settings),
GATEWAY_DATA_DIR and GATEWAY_LISTEN.
Gateway lists them with their defaults. The keys it
generates live on its own volume, not in the database — see
Gateway.
Compose-level
| Variable | Purpose | Default |
|---|---|---|
POSTGRES_PASSWORD | Interpolated into both the postgres service's POSTGRES_PASSWORD and the app's DATABASE_URL. | monitoring_secret — change it |
PostgreSQL only applies this when it initialises an empty data directory.
Changing it later changes the password the app connects with but not the one
the server expects, and the app then cannot reach the database. To rotate it,
change it inside PostgreSQL with ALTER ROLE and update .env to match.
CRON_SECRET is optional, and that has consequences
The alert-evaluation endpoint checks the bearer token only if the variable is set:
const cronSecret = process.env.CRON_SECRET;
if (cronSecret && authHeader !== `Bearer ${cronSecret}`) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
}
With CRON_SECRET unset, POST /api/cron/evaluate-alerts — and GET, which
is wired to the same handler — is unauthenticated. Anyone who can reach the
dashboard can run an alert evaluation cycle, which writes alerts, marks hosts
offline and sends notifications.
The shipped compose file marks it required for both the app and the cron
container, so a Compose deployment cannot start without one. If you run the app
some other way, set it. The cron container must be given the same value: it
writes the token into a small script rather than into the crontab line, which
keeps the secret out of /etc/crontabs and out of the process list.
SETTINGS_ENCRYPTION_KEY encrypts every stored secret
Secrets in the database are encrypted with AES-256-GCM using a key derived
from SETTINGS_ENCRYPTION_KEY. Compose refuses to start without it.
What that key protects:
- the SMTP password (
app_settings) - every agent setting marked as a secret, such as a CrowdSec bouncer key
(
agent_settings) - every user's TOTP secret (
users.totp_secret) - notification channel URLs and webhook secrets
- SNMP communities and v3 keys, secret parameters of scripts, schedules and self-healing rules
- the passwords stored with access entries. Each is bound to its entry, so a ciphertext copied onto another row does not open.
None of this fails loudly. Decryption failures are caught and logged, and the
caller gets null — so mail silently stops sending, agents silently lose a
credential, and users with two-factor authentication enabled can no longer sign
in because the server cannot recover the secret to check their codes against.
Set it to its own random value (openssl rand -base64 48) before you store
anything, and treat it as permanent. Back it up with the database dump — a
dump without the key is a dump with holes in it — and keep it apart from the
files that contain the ciphertext. If the key is already gone, the recovery is
to re-enter the SMTP password, the agent secrets and the passwords of access entries
and to have affected users re-enrol their second factor.
Instances that never set it. Earlier releases, and the application itself
when it is started without Compose, fall back to AUTH_SECRET when the variable
is unset, and the key derives from that. Do not rely on it. The derivation uses
the secret string, so setting SETTINGS_ENCRYPTION_KEY to the value of
AUTH_SECRET gives exactly the key already in use and nothing has to be
re-encrypted. Upgrading has the command.
From then on AUTH_SECRET can be rotated freely.
Rotating the key
To move to a new key, stop the application and run the tool inside the image with the old and the new secret in two files that only you can read:
docker compose stop app cron
docker compose run --rm -v "$PWD/keys:/keys:ro" app \
node scripts/rotate-encryption-key.mjs \
--old-key-file /keys/old.txt --new-key-file /keys/new.txt --dry-run
A key file holds the secret string, the value of SETTINGS_ENCRYPTION_KEY.
The tool re-encrypts every secret listed above in a single transaction, checks
each value by opening it with the new key before it commits, and prints counts
only, never values. It aborts without changing anything when a value cannot be
opened with the old key; --skip-unreadable leaves such values as they are and
moves the rest. Run it once with --dry-run, then without, put the new secret
in .env and start the application. Delete both key files afterwards.
What is configured in the dashboard
These are not environment variables. They live in the database, are edited in the UI, and survive recreating the container.
| Setting | Where | Notes |
|---|---|---|
| Time zone | Settings → General | The zone every time in the dashboard is shown in — timeline, charts, maintenance windows (entered in it too, and repeating ones keep to it) — and mails state their times in. Each browser's own zone plays no part. Until it is set, the container's TZ, else UTC. Administrators only. |
| Branding of reports and emails | Settings → General | The name and PNG logo that head the monthly report PDF and every email the instance sends, and that stand in as the sender name when SMTP has none. Without them the product name and mark are used. The dashboard itself keeps the product name. Administrators only. See Reports. |
| Language | Settings → General | The language of the mails and notifications the instance sends by itself (channels, monthly reports). Each account chooses the dashboard's language for itself. German until set. Administrators only. |
| Vulnerability data downloads | Settings → Notifications → Integrations | Whether the instance downloads advisories, exploitation data and end-of-life dates, once a day. On by default; VULN_DATA_DISABLED overrides it. The card also shows the state of each source and starts a sync on demand. Administrators only. See Vulnerability Data. |
| SMTP server | Settings → Notifications → Email | Host, port, encryption (SSL/TLS, STARTTLS or none), user, password, sender address and name, enabled. The password is encrypted. Until SMTP is enabled, POST /api/auth/password/forgot answers 503 Mail is not configured and the login screen does not offer a reset link. |
| Agent settings | Agents, and per cluster or per host | Values the dashboard hands down to agents, layered cluster first and host on top. Secrets are encrypted at rest and are sent in the clear only to the agent they belong to. See Agent Settings. |
| Agent rollout mode | Agents | Whether updates go out to everything at once or one canary per customer first. See Agent Rollout. |
| Notification delay for alerts | Alert Rules, card above the list | How long an alert must stay open before mail, channels and webhooks announce it. Default 15 minutes, 0 to 1440. Administrators only. See Alert Rules. |
| Alert retention | Settings → Data retention | Days after which resolved alerts are deleted, checked once an hour. Default 90; 0 keeps them until someone deletes them. Open alerts are never deleted. Administrators only. |
| Audit log retention | Settings → Data retention | Days after which audit log entries are deleted, checked once an hour. Default 365; 0 keeps them for ever. Administrators only. See Audit Log. |
| Access entry trash retention | Settings → Data retention | Days after which a trashed access entry, link host, host without an agent or folder is deleted for good, with its stored password, checked once a day. Default 30, 1 to 3650. Administrators only. See Access Entries. |
| Administrators copy a customer's passwords | connectionAdminReveal on the customer (PATCH /api/customers/{id}) | On for every customer: administrators copy the stored passwords of access entries of all of them. Switching it off for one means an administrator needs connection.reveal on a grant there. See Access Entries. |
| Job output retention | Settings → Data retention | Days after which a finished job's output is deleted, checked once an hour. Default 90; 0 keeps it. The job's record stays. Administrators only. See Jobs. |
| Alert rules, event rules, maintenance windows | Monitoring → Alert rules, Monitoring → Event rules, Infrastructure → Maintenance windows | See Alert Rules, Event Rules, Maintenance Windows. |
The split is not arbitrary. Environment holds what the process needs before it can talk to anything — where the database is, what signs a cookie. Everything else is instance data: an administrator changes it at runtime without shell access, it takes effect without a restart, and because it is in the database it is covered by your backup. That is why an administrator can change an alert rule without a redeploy, and why a restored dump comes back with the same SMTP settings it had.
The name and the mark are not in that table. They ship with the application and are the same on every instance; there is nothing to configure and nothing to restore.