From 9258532952b5106b76315e5a0c1878e647e03094 Mon Sep 17 00:00:00 2001 From: tajniak81 <13187254+tajniak81@users.noreply.github.com> Date: Fri, 21 Aug 2026 18:38:48 +0200 Subject: [PATCH] Docker: give the panel's settings screens a permanent home in .env ee4ac44 removed the api_data volume, which left the panel's Settings -> PocketBase and Settings -> Web App screens with nowhere to persist to: they apply at runtime and the container environment wins again on restart. That is only acceptable if the environment is actually reachable by an operator, and for two of those keys it was not - WEBAPP_URL was hardcoded in all four compose files, and POCKETBASE_URL in the two multi-container ones, so there was no supported way to change them at all. Both are now ${VAR:-default} with the previous hardcoded value as the default, so nothing moves for an existing .env while the keys become settable. CORS_ALLOW_ORIGINS and the admin credentials already were. The env examples grow a section naming every setting the panel can also change, saying plainly that the panel's version lasts only for the life of the container, and giving the commented-out line to make it stick. It also records the trap in WEBAPP_URL: it is a container-to-container call, so it has to be reachable from the API Server rather than from a browser, which is why the default is a service name and not localhost. POCKETBASE_URL is described as repointable in the multi-container stack and left alone in the AIO image, where it addresses that container's own PocketBase. Also dropped two leftovers from when there were two volumes: the storage sections still said "either". Checked by parsing all five compose files and asserting each interpolation default matches the value it replaced, so this cannot have moved a default by accident. go build and go test ./... still pass (untouched here). Not verified: no Docker CLI, so no `docker compose config` render and no build. Co-Authored-By: Claude Opus 5 --- Docker-AIO/.env.example | 10 ++++++++++ Docker-AIO/.env.prod.example | 12 +++++++++++- Docker-AIO/docker-compose.prod.yml | 6 ++++-- Docker-AIO/docker-compose.yml | 6 ++++-- Docker/.env.example | 14 ++++++++++++++ Docker/.env.prod.example | 18 ++++++++++++++++-- Docker/docker-compose.prod.yml | 15 ++++++++++----- Docker/docker-compose.yml | 15 ++++++++++----- 8 files changed, 79 insertions(+), 17 deletions(-) diff --git a/Docker-AIO/.env.example b/Docker-AIO/.env.example index 1495752..fae38b5 100644 --- a/Docker-AIO/.env.example +++ b/Docker-AIO/.env.example @@ -45,3 +45,13 @@ VITE_API_BASE= # different version. Leaving it commented out keeps the pin (an empty value here # is passed through as-is and would resolve the latest release at build time). #PB_VERSION=0.39.11 + +# --- Settings the API Server panel can also change --------------------------- +# The panel's Settings screens apply these immediately, but only for the life of +# the container — the value below is re-applied on every restart and wins. Set it +# here to make a change permanent. (POCKETBASE_URL is fixed to this container's +# own PocketBase and is not meant to be repointed.) +# WEBAPP_URL the Web App address the panel status page probes; nginx +# serves it on port 80 inside this container. +# CORS_ALLOW_ORIGINS browser origins allowed to call the API Server directly. +# WEBAPP_URL=http://127.0.0.1:80 diff --git a/Docker-AIO/.env.prod.example b/Docker-AIO/.env.prod.example index fc07184..e37d156 100644 --- a/Docker-AIO/.env.prod.example +++ b/Docker-AIO/.env.prod.example @@ -44,8 +44,18 @@ WEB_PORT=8090 PB_PORT=8070 API_PORT=8080 +# --- Settings the API Server panel can also change --------------------------- +# The panel's Settings screens apply these immediately, but only for the life of +# the container — the value below is re-applied on every restart and wins. Set it +# here to make a change permanent. (POCKETBASE_URL is fixed to this container's +# own PocketBase and is not meant to be repointed.) +# WEBAPP_URL the Web App address the panel status page probes; nginx +# serves it on port 80 inside this container. +# CORS_ALLOW_ORIGINS browser origins allowed to call the API Server directly. +# WEBAPP_URL=http://127.0.0.1:80 + # --- Storage ----------------------------------------------------------------- -# Defaults are Docker-managed named volumes. Set either to an absolute host path +# One Docker-managed named volume by default. Set it to an absolute host path # for a bind mount, e.g. PB_DATA=/srv/drivervault/pb_data. # PB_DATA — the PocketBase database and uploads. It is the only volume in the # image: the API Server keeps no state on disk, so everything it owns (plugin diff --git a/Docker-AIO/docker-compose.prod.yml b/Docker-AIO/docker-compose.prod.yml index 6c40d66..76dce9d 100644 --- a/Docker-AIO/docker-compose.prod.yml +++ b/Docker-AIO/docker-compose.prod.yml @@ -24,8 +24,10 @@ services: # Match CORS to the web origin (only used if a browser calls the API directly). CORS_ALLOW_ORIGINS: "${CORS_ALLOW_ORIGINS:-http://localhost:8090}" # Probed by the panel status page. nginx serves the Web App on port 80 - # inside this container, so the default (localhost:8090) would never answer. - WEBAPP_URL: "http://127.0.0.1:80" + # inside this container, so plain localhost:8090 would never answer. + # Override WEBAPP_URL in .env to make a change from the panel's Web App + # screen permanent; the panel alone only holds it for the container's life. + WEBAPP_URL: "${WEBAPP_URL:-http://127.0.0.1:80}" # Schema + super-admin bootstrap (idempotent). Leave this ON: a release can # add collections or fields the server needs, and a stack that skips the # bootstrap never gets them. The API Server self-heals exactly one thing — diff --git a/Docker-AIO/docker-compose.yml b/Docker-AIO/docker-compose.yml index 1fa8b4a..df113b6 100644 --- a/Docker-AIO/docker-compose.yml +++ b/Docker-AIO/docker-compose.yml @@ -27,8 +27,10 @@ services: # Match CORS to the web origin (only used if a browser calls the API directly). CORS_ALLOW_ORIGINS: "${CORS_ALLOW_ORIGINS:-http://localhost:8090}" # Probed by the panel status page. nginx serves the Web App on port 80 - # inside this container, so the default (localhost:8090) would never answer. - WEBAPP_URL: "http://127.0.0.1:80" + # inside this container, so plain localhost:8090 would never answer. + # Override WEBAPP_URL in .env to make a change from the panel's Web App + # screen permanent; the panel alone only holds it for the container's life. + WEBAPP_URL: "${WEBAPP_URL:-http://127.0.0.1:80}" # Schema + super-admin bootstrap (idempotent). Leave this ON: a release can # add collections or fields the server needs, and a stack that skips the # bootstrap never gets them. The API Server self-heals exactly one thing — diff --git a/Docker/.env.example b/Docker/.env.example index 5a3db4b..2c948a7 100644 --- a/Docker/.env.example +++ b/Docker/.env.example @@ -43,3 +43,17 @@ WEB_PORT=8090 # --- Web App build ----------------------------------------------------------- # Leave empty so the browser uses same-origin /api (proxied by the BFF). VITE_API_BASE= + +# --- Settings the API Server panel can also change --------------------------- +# The panel's Settings screens apply these immediately, but only for the life of +# the container — the values below are re-applied on every restart and win. Set +# them here to make a change permanent. +# POCKETBASE_URL where the API Server looks for the database. Defaults to +# the bundled pocketbase service; set it to reach one +# outside this stack. +# WEBAPP_URL the Web App address the panel status page probes. It is +# a container-to-container call, so it must be reachable +# from the API Server, not from your browser. +# CORS_ALLOW_ORIGINS browser origins allowed to call the API Server directly. +# POCKETBASE_URL=http://pocketbase:8070 +# WEBAPP_URL=http://web-app:8090 diff --git a/Docker/.env.prod.example b/Docker/.env.prod.example index edbee5d..52250e2 100644 --- a/Docker/.env.prod.example +++ b/Docker/.env.prod.example @@ -58,9 +58,23 @@ PB_BIND=127.0.0.1 API_PORT=8080 API_BIND=127.0.0.1 +# --- Settings the API Server panel can also change --------------------------- +# The panel's Settings screens apply these immediately, but only for the life of +# the container — the values below are re-applied on every restart and win. Set +# them here to make a change permanent. +# POCKETBASE_URL where the API Server looks for the database. Defaults to +# the bundled pocketbase service; set it to reach one +# outside this stack. +# WEBAPP_URL the Web App address the panel status page probes. It is +# a container-to-container call, so it must be reachable +# from the API Server, not from your browser. +# CORS_ALLOW_ORIGINS browser origins allowed to call the API Server directly. +# POCKETBASE_URL=http://pocketbase:8070 +# WEBAPP_URL=http://web-app:8090 + # --- Storage ----------------------------------------------------------------- -# Defaults are Docker-managed named volumes. To store either on a host path -# instead, set it to an absolute path, e.g. PB_DATA=/srv/drivervault/pb_data. +# One Docker-managed named volume by default. To store it on a host path +# instead, set an absolute path, e.g. PB_DATA=/srv/drivervault/pb_data. # PB_DATA — the PocketBase database and uploads. It is the only volume in the # stack: the API Server keeps no state on disk, so everything it owns (plugin # settings included) is backed up by backing up this one path. diff --git a/Docker/docker-compose.prod.yml b/Docker/docker-compose.prod.yml index 1cde541..c9e89ce 100644 --- a/Docker/docker-compose.prod.yml +++ b/Docker/docker-compose.prod.yml @@ -49,14 +49,19 @@ services: condition: service_healthy environment: API_ADDR: ":8080" - # Reach PocketBase by its service name on the internal network. - POCKETBASE_URL: "http://pocketbase:8070" + # Reach PocketBase by its service name on the internal network. Override + # POCKETBASE_URL in .env to point the API Server at a database outside + # this stack — that is also how you make a retarget done from the panel + # permanent, since the panel's change lasts only for the container's life. + POCKETBASE_URL: "${POCKETBASE_URL:-http://pocketbase:8070}" POCKETBASE_ADMIN_EMAIL: "${PB_ADMIN_EMAIL}" POCKETBASE_ADMIN_PASSWORD: "${PB_ADMIN_PASSWORD}" # Probed by the panel status page. This is a server-to-server call inside - # the compose network, so it must be the service name — the default - # (localhost:8090) would resolve to this container itself. - WEBAPP_URL: "http://web-app:8090" + # the compose network, so the default is the service name — plain + # localhost:8090 would resolve to this container itself. Override + # WEBAPP_URL in .env to make a change from the panel's Web App screen + # permanent; the panel alone only holds it for the container's life. + WEBAPP_URL: "${WEBAPP_URL:-http://web-app:8090}" CORS_ALLOW_ORIGINS: "${CORS_ALLOW_ORIGINS:-http://localhost:8090}" AUTH_USERS_COLLECTION: "${AUTH_USERS_COLLECTION:-users}" # Schema + super-admin bootstrap (idempotent). Leave this ON: a release can diff --git a/Docker/docker-compose.yml b/Docker/docker-compose.yml index 405e880..e041f05 100644 --- a/Docker/docker-compose.yml +++ b/Docker/docker-compose.yml @@ -38,14 +38,19 @@ services: condition: service_healthy environment: API_ADDR: ":8080" - # Reach PocketBase by its service name on the internal network. - POCKETBASE_URL: "http://pocketbase:8070" + # Reach PocketBase by its service name on the internal network. Override + # POCKETBASE_URL in .env to point the API Server at a database outside + # this stack — that is also how you make a retarget done from the panel + # permanent, since the panel's change lasts only for the container's life. + POCKETBASE_URL: "${POCKETBASE_URL:-http://pocketbase:8070}" POCKETBASE_ADMIN_EMAIL: "${PB_ADMIN_EMAIL}" POCKETBASE_ADMIN_PASSWORD: "${PB_ADMIN_PASSWORD}" # Probed by the panel status page. This is a server-to-server call inside - # the compose network, so it must be the service name — the default - # (localhost:8090) would resolve to this container itself. - WEBAPP_URL: "http://web-app:8090" + # the compose network, so the default is the service name — plain + # localhost:8090 would resolve to this container itself. Override + # WEBAPP_URL in .env to make a change from the panel's Web App screen + # permanent; the panel alone only holds it for the container's life. + WEBAPP_URL: "${WEBAPP_URL:-http://web-app:8090}" # Same-origin requests go through the Web App BFF, so CORS is only needed # if the browser ever calls the API Server directly. Default to the web origin. CORS_ALLOW_ORIGINS: "${CORS_ALLOW_ORIGINS:-http://localhost:8090}"