Skip to content

Configuration

Matthew Vlasov edited this page Nov 23, 2026 · 2 revisions

This page lists every command-line flag and environment variable the nodepilot binary reads, the build-time variables, the systemd env file, and the layout of the data directory, including what to back up.

NodePilot has no config file. Startup settings come from flags and environment variables. Everything else (update channel, audit forwarding, panel SSH key and so on) is changed in the UI and stored in the database.

How settings are applied

  • A flag on the command line wins over its environment variable, and the environment variable wins over the default.
  • --data-dir is a global option: it can go before or after the subcommand (nodepilot --data-dir /x serve and nodepilot serve --data-dir /x are the same).
  • The options of serve only apply to serve.
  • Under systemd, set variables in /etc/nodepilot/nodepilot.env (see below). In Docker, use -e NAME=value.
  • nodepilot <command> --help prints the options together with their env variable names and defaults.

Global option

Flag Env variable Default Meaning
--data-dir <DIR> NODEPILOT_DATA data (relative to the current directory) Data directory: database, master key, local backups. Created if missing. The systemd unit and the Docker image set it to /var/lib/nodepilot

The relative default is a common trap: a CLI command run from another directory without --data-dir silently creates a new, empty ./data. Always pass the path explicitly on servers.

serve options

Flag Env variable Default Meaning
--listen <ADDR> NODEPILOT_LISTEN 127.0.0.1:7780 Address and port to listen on. Must be an IP:port socket address (0.0.0.0:7780, [::]:7780), not a host name
--stats-interval <SECS> NODEPILOT_STATS_INTERVAL 30 How often servers are polled for stats, in seconds. Values below 5 are raised to 5
--metrics-retention-days <DAYS> NODEPILOT_METRICS_RETENTION_DAYS 7 How many days of metric history to keep. Older rows are purged once an hour
--secure-cookies NODEPILOT_SECURE_COOKIES off Adds the Secure flag to the session cookie. Enable when the panel is served over HTTPS
--cors-origins <LIST> NODEPILOT_CORS_ORIGINS empty (CORS off) Comma-separated list of exact origins allowed to call the API from a browser, e.g. https://app.example.com,https://admin.example.com
--trusted-proxies <LIST> NODEPILOT_TRUSTED_PROXIES empty (loopback only) Reverse proxies on other hosts whose X-Forwarded-For is trusted for the client address: comma-separated IPs or CIDRs, e.g. 10.0.0.5,172.18.0.0/16. Loopback is always trusted

Value details:

  • NODEPILOT_SECURE_COOKIES accepts only true or false. Any other value (1, yes, on) stops the panel at startup with invalid value '1' for '--secure-cookies'. On the command line, use just --secure-cookies.
  • NODEPILOT_CORS_ORIGINS: each entry is trimmed and a trailing / is removed. When the list is non-empty, those origins may use GET, POST, PUT, PATCH and DELETE with the Authorization and Content-Type headers. Content-Disposition and Content-Length are exposed, and preflight results are cached for an hour. Credentials (cookies) are not allowed cross-origin, so such clients must send Authorization: Bearer np_…. Native mobile apps don't need CORS.
  • The session cookie is np_session: HttpOnly, SameSite=Strict, Path=/, valid for 30 days, plus Secure when enabled.

Options of other subcommands

Subcommand Flag Env variable Meaning
mcp --token <TOKEN> NODEPILOT_TOKEN Limit the MCP session to this API token's permissions. Without it: full access as the first user
user create, user passwd --password <PASSWORD> NODEPILOT_PASSWORD The password (at least 8 characters)

All subcommands are described in CLI Reference.

Master key

Secrets in the database (server passwords and keys, database passwords, S3 keys, backup passphrases, the 2FA secrets, the panel SSH key) are encrypted with a 256-bit master key (XChaCha20-Poly1305). The key is a single line: 32 random bytes, base64-encoded.

The panel looks for the key in this order and uses the first one it finds:

# Source How to use it Shown as
1 systemd credential A credential named master.key, i.e. the file $CREDENTIALS_DIRECTORY/master.key. Set with LoadCredential=master.key:/path or LoadCredentialEncrypted=master.key:/path (what seal-master-key.sh does) systemd-credential
2 Explicit file NODEPILOT_MASTER_KEY_FILE=/path/to/key. If the variable is set but the file is missing, startup fails file
3 Data directory <data-dir>/master.key data-dir
4 Generate Only when none of the above exists and the database has no users, keychain entries or servers. A new key is written to <data-dir>/master.key (mode 0600 on Unix) data-dir

Safety checks at startup:

  • If no key is found but the database already contains data, the panel refuses to start rather than create a new key. Your secrets would otherwise become unreadable.
  • The database stores an encrypted check value. If the loaded key cannot decrypt it, startup fails with the master key (...) does not match this database — wrong key file or credential.
  • If the key comes from source 1 or 2 but a plaintext <data-dir>/master.key still exists, the panel logs a warning and Security shows that a plaintext copy is still on disk.

The key source is shown in the panel under Security.

TPM sealing: seal-master-key.sh

packaging/seal-master-key.sh seals the key with systemd-creds (systemd 250+, so Ubuntu 24.04+ or Debian 12+; enable vTPM in a VM). It assumes the install.sh layout.

Option Meaning
--backup-to <FILE> Copy the plaintext key to FILE (mode 0400) before sealing. The file must not exist. Move it off the server afterwards
--i-have-a-backup Skip the copy; you confirm that an offline backup exists. One of these two options is required
--with-key tpm2|host+tpm2 What to seal with. Default tpm2. host+tpm2 also binds to /var/lib/systemd/credential.secret
--unseal Decrypt the credential back to /var/lib/nodepilot/master.key, remove the drop-in and restart. Use it before moving to another machine
-h, --help Show usage

When sealing, the script writes /etc/nodepilot/master.key.cred, checks that it decrypts to the same key, and adds the drop-in /etc/systemd/system/nodepilot.service.d/master-key.conf with LoadCredentialEncrypted=master.key:/etc/nodepilot/master.key.cred. It then restarts the service, and only if the service comes up does it delete the plaintext key (with shred -u when available).

After sealing, CLI commands started from a shell no longer find the key, because only the service gets the credential. See Troubleshooting.

Updates

Variable When read Default Meaning
NODEPILOT_UPDATE_REPO build time and runtime release builds: the GitHub repository they were built from; self-built: unset GitHub repository owner/name to look for releases in. The runtime value overrides the built-in one. Without either, update checks are off
NODEPILOT_UPDATE_PUBKEY build time and runtime release builds: the project's public key, if signing is set up Ed25519 public key (32 bytes, base64). When set, every update must come with a valid <asset>.sig. A non-empty runtime value overrides the built-in one
NODEPILOT_UPDATE_API_URL runtime https://api.github.com Base URL of the GitHub API used to list releases (<url>/repos/<repo>/releases)
NODEPILOT_UPDATE_DOWNLOAD_URL runtime https://github.com Base URL for downloads (<url>/<repo>/releases/download/<tag>/<file>)
NODEPILOT_IN_DOCKER runtime unset (the Docker image sets 1) If set to any value, the panel treats itself as running in a container and disables self-update. A /.dockerenv file has the same effect

The auto-check and pre-release switches are not env variables. They live in the database and are set in Settings → Updates. See Updates.

Logging

Variable Default Meaning
RUST_LOG info,sqlx=warn,russh=warn Log filter in tracing EnvFilter syntax, e.g. debug or info,nodepilot_core=debug

Logs go to stderr (so journalctl -u nodepilot under systemd). In mcp mode, stdout carries the MCP protocol, which is why nothing is logged there.

Other variables the binary reads

Variable Set by Meaning
CREDENTIALS_DIRECTORY systemd Where systemd places service credentials. The master key is looked up as master.key inside it
HOSTNAME the environment Host name written into syslog messages when the audit log is forwarded to syslog. Defaults to nodepilot when unset or empty
NODEPILOT_BIND_RETRY the panel itself Internal. Set on the new process after a self-update on Windows so it keeps retrying the port for up to 10 seconds while the old process exits. Don't set it yourself

Build-time variables

Variable Used by Default Meaning
NODEPILOT_BASE_PATH npm run build in web/ (vite.config.ts) / URL prefix the UI is built for, e.g. /nodepilot/. The proxy must strip the prefix, because the backend always serves from /. See Installation
NODEPILOT_BACKEND npm run dev (Vite dev server) http://127.0.0.1:7780 Backend that the dev server proxies /api (including WebSockets) to. Development only
NODEPILOT_UPDATE_REPO cargo build unset Baked into the binary as the default update repository
NODEPILOT_UPDATE_PUBKEY cargo build unset Baked into the binary as the update signing public key
CARGO_TARGET_DIR scripts/build-linux.sh $HOME/.cache/nodepilot-target Cargo target directory for the static Linux build

/etc/nodepilot/nodepilot.env

With the systemd setup, this is where you configure the panel. install.sh creates it (only if missing) with commented-out defaults:

# NODEPILOT_LISTEN=127.0.0.1:7780
# NODEPILOT_SECURE_COOKIES=true
# NODEPILOT_STATS_INTERVAL=30
# NODEPILOT_METRICS_RETENTION_DAYS=7

The unit loads it with EnvironmentFile=-/etc/nodepilot/nodepilot.env, so it may be absent, and its values override the unit's own NODEPILOT_DATA and NODEPILOT_LISTEN. Any variable from this page can go here. Apply changes with:

sudo systemctl restart nodepilot

A typical production file behind a TLS proxy:

NODEPILOT_SECURE_COOKIES=true
NODEPILOT_STATS_INTERVAL=30
NODEPILOT_METRICS_RETENTION_DAYS=30

The file is read only by systemd. A nodepilot command you run in a shell doesn't see it, so pass --data-dir /var/lib/nodepilot there.

Fixed limits

These values are built in and cannot be changed through configuration:

What Value
Parallel stats polls 32
Concurrent new SSH connections 32
SSH connect timeout 10 s
SSH keepalive interval 30 s
Idle SSH connection closed after 10 min
Stats command timeout 20 s
Retry backoff for unreachable servers stats interval × 2, 4, 8, 16, at most 5 min
Session lifetime 30 days
File manager upload limit 512 MiB
Background update check 60 s after start, then every 6 h
Login lockout 5 failures in 15 min per username and per IP; lock for 5, 10, 20, 40, then 60 min

Data directory

Default locations: /var/lib/nodepilot with systemd and in Docker, ./data otherwise.

Path What it is
nodepilot.db SQLite database (WAL mode): users, servers, keychain, projects, notes, graphs, backup jobs, settings, audit log, metric history. Secrets inside are encrypted with the master key
nodepilot.db-wal, nodepilot.db-shm SQLite write-ahead log and shared memory. They belong to the database; never delete them while the panel runs
master.key The master key in plaintext (base64), mode 0600. Absent if the key is sealed in the TPM or supplied with NODEPILOT_MASTER_KEY_FILE
backups/ Not created automatically. It is the path the UI suggests for a local backup storage (/var/lib/nodepilot/backups). Archives go to <storage path>/<job id>/. A relative storage path is resolved against the data directory
tmp/ Staging area for archives on their way to S3 (<run id>.partial)
bin/nodepilot The binary, with the install.sh layout
bin/nodepilot.old The previous binary, kept after a self-update for rollback
bin/.nodepilot-<platform>.download Temporary file while an update downloads

What to back up

Item Why
nodepilot.db All panel data
The master key Without it, the secrets in the database cannot be decrypted. Keep an offline copy, separate from the database backups. If the key is sealed in the TPM, the sealed credential is useless on other hardware, so the offline copy from --backup-to is what you need
/etc/nodepilot/nodepilot.env Your settings
Local backup storage directories If you keep backup archives on the panel host

Take a consistent copy of the database. Either stop the service first, or use SQLite's online backup while it runs:

sudo systemctl stop nodepilot
sudo cp -a /var/lib/nodepilot/nodepilot.db /root/nodepilot.db.bak
sudo systemctl start nodepilot

# or, without stopping (needs the sqlite3 package):
sudo -u nodepilot sqlite3 /var/lib/nodepilot/nodepilot.db ".backup '/var/lib/nodepilot/nodepilot.db.bak'"

Copying only nodepilot.db while the panel runs can miss changes that are still in nodepilot.db-wal.

To restore: stop the service, put nodepilot.db back (remove any stale -wal and -shm files that do not belong to it), make the matching master key available through one of the sources above, fix ownership (chown -R nodepilot:nodepilot /var/lib/nodepilot) and start the service. A binary older than the database cannot open it; see Updates.

Clone this wiki locally