From 2f3b324518e51219622afdfff3faab4bfd22e7af Mon Sep 17 00:00:00 2001 From: Matthew Jackson Date: Tue, 19 May 2026 08:22:16 -0700 Subject: [PATCH] basement: declare 4 required env vars + auto-generate JWT secret MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit basement-ui as of latest now requires BASEMENT_DRIVER / BASEMENT_ADMIN_USER / BASEMENT_ADMIN_PASSWORD_HASH / BASEMENT_JWT_SECRET and refuses to start without them — container was crash-looping. Template now declares all four: - DRIVER: defaults to "garage" (this deployment's storage backend). - JWT_SECRET: install.sh generates a hex string into secrets.env next to the garage secrets, sed-substitutes into the template. Backfills existing secrets.env that predates this key. - ADMIN_USER / ADMIN_PASSWORD_HASH: left blank; user fills via Unraid UI. bcrypt hash recipe is in both the file header and the PASSWORD_HASH config description. --- unraid-1/basement.template.xml | 17 ++++++++++++++--- unraid-1/install.sh | 14 +++++++++++++- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/unraid-1/basement.template.xml b/unraid-1/basement.template.xml index 935509e..83d7bd9 100644 --- a/unraid-1/basement.template.xml +++ b/unraid-1/basement.template.xml @@ -4,9 +4,15 @@ Source of truth: pq/scripts on Gitea (https://git.docker.pq.io/pq/scripts). Served via gitea raw URL: https://git.docker.pq.io/pq/scripts/raw/branch/main/unraid-1/basement.template.xml - This file is NOT installed directly. install.sh fetches it, substitutes the - __GARAGE_ADMIN_TOKEN__ placeholder with the same secret used by the garage - container, and writes the result to /boot/config/plugins/dockerMan/templates-user/my-basement.xml. + This file is NOT installed directly. install.sh fetches it, substitutes + __GARAGE_ADMIN_TOKEN__ (shared with the garage container) and + __BASEMENT_JWT_SECRET__ (generated alongside the garage secrets), and + writes the result to /boot/config/plugins/dockerMan/templates-user/my-basement.xml. + + BASEMENT_ADMIN_USER and BASEMENT_ADMIN_PASSWORD_HASH must be set by hand + in the Unraid UI before Apply — install.sh leaves them blank. + Generate a bcrypt hash with: `htpasswd -bnBC 12 "" yourpassword | tr -d ':\n'` + (or use any bcrypt tool; basement-ui expects the standard $2a$/$2b$ format). Caddy on classe reverse-proxies https://basement.pq.io to this container's port 8080. DNS for basement.pq.io and the Caddy vhost are managed on classe, @@ -45,4 +51,9 @@ Publicly served at https://basement.pq.io via Caddy on classe (reverse proxy → http://host.docker.internal:3903 __GARAGE_ADMIN_TOKEN__ + + garage + + + __BASEMENT_JWT_SECRET__ diff --git a/unraid-1/install.sh b/unraid-1/install.sh index b60c886..d00d671 100755 --- a/unraid-1/install.sh +++ b/unraid-1/install.sh @@ -57,15 +57,26 @@ else GARAGE_RPC_SECRET=$(openssl rand -hex 32) GARAGE_ADMIN_TOKEN=$(openssl rand -hex 32) GARAGE_METRICS_TOKEN=$(openssl rand -hex 32) + BASEMENT_JWT_SECRET=$(openssl rand -hex 32) umask 077 cat > "$SECRETS" <> "$SECRETS" + say "backfilled BASEMENT_JWT_SECRET into $SECRETS" +fi + # ── Templates ── # Fetch each, optionally sed-substitute __PLACEHOLDER__ secrets, write to # templates-user/. Secrets are hex chars only — safe in sed delimiters. @@ -94,7 +105,8 @@ fetch_template \ fetch_template \ "$BASE/basement.template.xml" \ "$TEMPLATE_DIR/my-basement.xml" \ - -e "s|__GARAGE_ADMIN_TOKEN__|$GARAGE_ADMIN_TOKEN|" + -e "s|__GARAGE_ADMIN_TOKEN__|$GARAGE_ADMIN_TOKEN|" \ + -e "s|__BASEMENT_JWT_SECRET__|$BASEMENT_JWT_SECRET|" fetch_template \ "$BASE/watchtower.template.xml" \