From f23ecc9cc96ad1bd735d47838db08157443e1f42 Mon Sep 17 00:00:00 2001 From: jnfrati Date: Fri, 30 Oct 2026 18:23:24 +0100 Subject: [PATCH 1/3] Clarify config precedence for the combined netbird-server config.yaml values are not overridable via NB_ environment variables on the combined server, and config.yaml store fields overwrite the matching store environment variables at startup. Fix the Variable Precedence section and note the DSN precedence where the env-var alternative is shown. --- src/pages/selfhosted/environment-variables.mdx | 18 ++++++++++++++++-- .../maintenance/configuration-files.mdx | 2 ++ .../selfhosted/maintenance/postgres-store.mdx | 2 ++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/pages/selfhosted/environment-variables.mdx b/src/pages/selfhosted/environment-variables.mdx index 8d98f40c4..6f4e3fa36 100644 --- a/src/pages/selfhosted/environment-variables.mdx +++ b/src/pages/selfhosted/environment-variables.mdx @@ -276,13 +276,27 @@ environment: ## Variable Precedence -Configuration values are applied in the following order (later values override earlier): +For the older multi-container setup, configuration values are applied in the following order (later values override earlier): 1. Default values -2. Configuration file (`config.yaml` for combined setup, `management.json` for older multi-container setup) +2. Configuration file (`management.json`) 3. Environment variables 4. Command-line flags +The combined `netbird-server` reads `config.yaml` values only from the file and its built-in defaults. `NB_` environment variables named after `config.yaml` keys, such as `NB_SERVER_LOGLEVEL`, are ignored. + +The store variables are the exception, and there `config.yaml` wins. At startup, `netbird-server` copies these `config.yaml` fields into the matching environment variables, replacing any value set on the container: + +| `config.yaml` field | Environment variable | +|---------------------|----------------------| +| `server.store.dsn` (when `server.store.engine` is `postgres` or `mysql`) | `NB_STORE_ENGINE_POSTGRES_DSN` or `NB_STORE_ENGINE_MYSQL_DSN` | +| `server.store.file` | `NB_STORE_ENGINE_SQLITE_FILE` | +| `server.activityStore.engine` | `NB_ACTIVITY_EVENT_STORE_ENGINE` | +| `server.activityStore.dsn` (when `server.activityStore.engine` is set) | `NB_ACTIVITY_EVENT_POSTGRES_DSN` | +| `server.activityStore.file` | `NB_ACTIVITY_EVENT_SQLITE_FILE` | + +A variable set on the container takes effect only when its `config.yaml` field is empty. + ## See Also - [Self-hosting Quickstart Guide](/selfhosted/selfhosted-quickstart) diff --git a/src/pages/selfhosted/maintenance/configuration-files.mdx b/src/pages/selfhosted/maintenance/configuration-files.mdx index f413c7ffb..e91256b39 100644 --- a/src/pages/selfhosted/maintenance/configuration-files.mdx +++ b/src/pages/selfhosted/maintenance/configuration-files.mdx @@ -517,6 +517,8 @@ netbird-server: - NETBIRD_STORE_ENGINE_POSTGRES_DSN=host=db-server user=netbird password=secret dbname=netbird port=5432 ``` +If `server.store.dsn` is also set in `config.yaml`, the `config.yaml` value wins. See [Variable Precedence](/selfhosted/environment-variables#variable-precedence). + See [Management Postgres Store](/selfhosted/maintenance/postgres-store) for detailed setup. ### Changing Log Level diff --git a/src/pages/selfhosted/maintenance/postgres-store.mdx b/src/pages/selfhosted/maintenance/postgres-store.mdx index 656078b44..9366f0dd3 100644 --- a/src/pages/selfhosted/maintenance/postgres-store.mdx +++ b/src/pages/selfhosted/maintenance/postgres-store.mdx @@ -22,6 +22,8 @@ environment: - NB_STORE_ENGINE_POSTGRES_DSN=host= user= password= dbname= port= ``` +If `server.store.dsn` is also set in `config.yaml`, the `config.yaml` value wins. See [Variable Precedence](/selfhosted/environment-variables#variable-precedence). + Restart the server and confirm: ```bash docker compose restart netbird-server From 01dfbb8f72e8728e423c382c43131ab961769dd4 Mon Sep 17 00:00:00 2001 From: jnfrati Date: Fri, 20 Nov 2026 18:12:04 +0100 Subject: [PATCH 2/3] Scope combined server precedence to v0.83.0 and fix store variable table Drop MySQL (removed in v0.82.0), add server.accessLogStore.*, note the NB_AUTH_SECRET/NB_STORE_ENCRYPTION_KEY exceptions, and explain the activity DSN case. netbirdio/netbird#8515 reverses this behaviour. --- src/pages/selfhosted/environment-variables.mdx | 11 +++++++---- .../selfhosted/maintenance/configuration-files.mdx | 2 +- src/pages/selfhosted/maintenance/postgres-store.mdx | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/pages/selfhosted/environment-variables.mdx b/src/pages/selfhosted/environment-variables.mdx index ca4dcab6e..d4f53563a 100644 --- a/src/pages/selfhosted/environment-variables.mdx +++ b/src/pages/selfhosted/environment-variables.mdx @@ -314,19 +314,22 @@ For the older multi-container setup, configuration values are applied in the fol 3. Environment variables 4. Command-line flags -The combined `netbird-server` reads `config.yaml` values only from the file and its built-in defaults. `NB_` environment variables named after `config.yaml` keys, such as `NB_SERVER_LOGLEVEL`, are ignored. +In v0.83.0 and earlier, the combined `netbird-server` reads `config.yaml` values only from the file and its built-in defaults. `NB_` environment variables named after `config.yaml` keys, such as `NB_SERVER_LOGLEVEL`, are ignored. The exceptions, from v0.83.0, are `NB_AUTH_SECRET` and `NB_STORE_ENCRYPTION_KEY`, which override `config.yaml`. See [Combined Server Variables](#combined-server-variables). -The store variables are the exception, and there `config.yaml` wins. At startup, `netbird-server` copies these `config.yaml` fields into the matching environment variables, replacing any value set on the container: +For the store fields below, `config.yaml` wins. At startup, `netbird-server` copies them into the matching environment variables, replacing any value set on the container: | `config.yaml` field | Environment variable | |---------------------|----------------------| -| `server.store.dsn` (when `server.store.engine` is `postgres` or `mysql`) | `NB_STORE_ENGINE_POSTGRES_DSN` or `NB_STORE_ENGINE_MYSQL_DSN` | +| `server.store.dsn` (when `server.store.engine` is `postgres`) | `NB_STORE_ENGINE_POSTGRES_DSN` | | `server.store.file` | `NB_STORE_ENGINE_SQLITE_FILE` | | `server.activityStore.engine` | `NB_ACTIVITY_EVENT_STORE_ENGINE` | | `server.activityStore.dsn` (when `server.activityStore.engine` is set) | `NB_ACTIVITY_EVENT_POSTGRES_DSN` | | `server.activityStore.file` | `NB_ACTIVITY_EVENT_SQLITE_FILE` | +| `server.accessLogStore.engine` | `NB_ACCESS_LOG_STORE_ENGINE` | +| `server.accessLogStore.dsn` | `NB_ACCESS_LOG_POSTGRES_DSN` | +| `server.accessLogStore.file` | `NB_ACCESS_LOG_SQLITE_FILE` | -A variable set on the container takes effect only when its `config.yaml` field is empty. +A variable set on the container takes effect only when its `config.yaml` field is empty. The activity DSN is the exception: with `server.activityStore.engine: postgres`, the server does not start without `server.activityStore.dsn`. To take it from the environment, leave both fields empty and set `NB_ACTIVITY_EVENT_STORE_ENGINE=postgres` and `NB_ACTIVITY_EVENT_POSTGRES_DSN`. ## See Also diff --git a/src/pages/selfhosted/maintenance/configuration-files.mdx b/src/pages/selfhosted/maintenance/configuration-files.mdx index 83a12a98a..cdbf8f5c2 100644 --- a/src/pages/selfhosted/maintenance/configuration-files.mdx +++ b/src/pages/selfhosted/maintenance/configuration-files.mdx @@ -519,7 +519,7 @@ netbird-server: - NETBIRD_STORE_ENGINE_POSTGRES_DSN=host=db-server user=netbird password=secret dbname=netbird port=5432 ``` -If `server.store.dsn` is also set in `config.yaml`, the `config.yaml` value wins. See [Variable Precedence](/selfhosted/environment-variables#variable-precedence). +In v0.83.0 and earlier, if `server.store.dsn` is also set in `config.yaml`, the `config.yaml` value wins. See [Variable Precedence](/selfhosted/environment-variables#variable-precedence). See [Management Postgres Store](/selfhosted/maintenance/postgres-store) for detailed setup. diff --git a/src/pages/selfhosted/maintenance/postgres-store.mdx b/src/pages/selfhosted/maintenance/postgres-store.mdx index 9366f0dd3..3b41c6352 100644 --- a/src/pages/selfhosted/maintenance/postgres-store.mdx +++ b/src/pages/selfhosted/maintenance/postgres-store.mdx @@ -22,7 +22,7 @@ environment: - NB_STORE_ENGINE_POSTGRES_DSN=host= user= password= dbname= port= ``` -If `server.store.dsn` is also set in `config.yaml`, the `config.yaml` value wins. See [Variable Precedence](/selfhosted/environment-variables#variable-precedence). +In v0.83.0 and earlier, if `server.store.dsn` is also set in `config.yaml`, the `config.yaml` value wins. See [Variable Precedence](/selfhosted/environment-variables#variable-precedence). Restart the server and confirm: ```bash From de879399d01a5984b94680b2044998e2cd204cac Mon Sep 17 00:00:00 2001 From: Jack Carter <128555021+SunsetDrifter@users.noreply.github.com> Date: Mon, 23 Nov 2026 14:54:26 +0100 Subject: [PATCH 3/3] Scope combined server precedence to v0.83.2 and note the engine-less activity DSN v0.83.1 and v0.83.2 do not change the combined server's config loading, so the precedence described here holds through v0.83.2. A server.activityStore.dsn set without server.activityStore.engine is not copied, so the container's NB_ACTIVITY_EVENT_POSTGRES_DSN is used. --- src/pages/selfhosted/environment-variables.mdx | 4 ++-- src/pages/selfhosted/maintenance/configuration-files.mdx | 2 +- src/pages/selfhosted/maintenance/postgres-store.mdx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/selfhosted/environment-variables.mdx b/src/pages/selfhosted/environment-variables.mdx index d4f53563a..c7fe53c4c 100644 --- a/src/pages/selfhosted/environment-variables.mdx +++ b/src/pages/selfhosted/environment-variables.mdx @@ -314,7 +314,7 @@ For the older multi-container setup, configuration values are applied in the fol 3. Environment variables 4. Command-line flags -In v0.83.0 and earlier, the combined `netbird-server` reads `config.yaml` values only from the file and its built-in defaults. `NB_` environment variables named after `config.yaml` keys, such as `NB_SERVER_LOGLEVEL`, are ignored. The exceptions, from v0.83.0, are `NB_AUTH_SECRET` and `NB_STORE_ENCRYPTION_KEY`, which override `config.yaml`. See [Combined Server Variables](#combined-server-variables). +In v0.83.2 and earlier, the combined `netbird-server` reads `config.yaml` values only from the file and its built-in defaults. `NB_` environment variables named after `config.yaml` keys, such as `NB_SERVER_LOGLEVEL`, are ignored. The exceptions, from v0.83.0, are `NB_AUTH_SECRET` and `NB_STORE_ENCRYPTION_KEY`, which override `config.yaml`. See [Combined Server Variables](#combined-server-variables). For the store fields below, `config.yaml` wins. At startup, `netbird-server` copies them into the matching environment variables, replacing any value set on the container: @@ -329,7 +329,7 @@ For the store fields below, `config.yaml` wins. At startup, `netbird-server` cop | `server.accessLogStore.dsn` | `NB_ACCESS_LOG_POSTGRES_DSN` | | `server.accessLogStore.file` | `NB_ACCESS_LOG_SQLITE_FILE` | -A variable set on the container takes effect only when its `config.yaml` field is empty. The activity DSN is the exception: with `server.activityStore.engine: postgres`, the server does not start without `server.activityStore.dsn`. To take it from the environment, leave both fields empty and set `NB_ACTIVITY_EVENT_STORE_ENGINE=postgres` and `NB_ACTIVITY_EVENT_POSTGRES_DSN`. +A variable set on the container takes effect only when its `config.yaml` field is empty, under the conditions in the table: a `server.activityStore.dsn` set without `server.activityStore.engine` is not copied, so the container's DSN is used. With `server.activityStore.engine: postgres`, the server does not start without `server.activityStore.dsn`. To take the activity DSN from the environment, leave both fields empty and set `NB_ACTIVITY_EVENT_STORE_ENGINE=postgres` and `NB_ACTIVITY_EVENT_POSTGRES_DSN`. ## See Also diff --git a/src/pages/selfhosted/maintenance/configuration-files.mdx b/src/pages/selfhosted/maintenance/configuration-files.mdx index cdbf8f5c2..40c3eeaf7 100644 --- a/src/pages/selfhosted/maintenance/configuration-files.mdx +++ b/src/pages/selfhosted/maintenance/configuration-files.mdx @@ -519,7 +519,7 @@ netbird-server: - NETBIRD_STORE_ENGINE_POSTGRES_DSN=host=db-server user=netbird password=secret dbname=netbird port=5432 ``` -In v0.83.0 and earlier, if `server.store.dsn` is also set in `config.yaml`, the `config.yaml` value wins. See [Variable Precedence](/selfhosted/environment-variables#variable-precedence). +In v0.83.2 and earlier, if `server.store.dsn` is also set in `config.yaml`, the `config.yaml` value wins. See [Variable Precedence](/selfhosted/environment-variables#variable-precedence). See [Management Postgres Store](/selfhosted/maintenance/postgres-store) for detailed setup. diff --git a/src/pages/selfhosted/maintenance/postgres-store.mdx b/src/pages/selfhosted/maintenance/postgres-store.mdx index 3b41c6352..96ceaeac3 100644 --- a/src/pages/selfhosted/maintenance/postgres-store.mdx +++ b/src/pages/selfhosted/maintenance/postgres-store.mdx @@ -22,7 +22,7 @@ environment: - NB_STORE_ENGINE_POSTGRES_DSN=host= user= password= dbname= port= ``` -In v0.83.0 and earlier, if `server.store.dsn` is also set in `config.yaml`, the `config.yaml` value wins. See [Variable Precedence](/selfhosted/environment-variables#variable-precedence). +In v0.83.2 and earlier, if `server.store.dsn` is also set in `config.yaml`, the `config.yaml` value wins. See [Variable Precedence](/selfhosted/environment-variables#variable-precedence). Restart the server and confirm: ```bash