From 52e98fa2d0858e595b99be4dabda0b385b4c059f Mon Sep 17 00:00:00 2001 From: Vuong Hoang Date: Wed, 20 May 2026 21:55:48 -0700 Subject: [PATCH] skaldsong: fix CD-wipes-state bug (env var names didn't match app) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The compose set SKALDSONG_DB_PATH + SKALDSONG_RUNS_DIR, but skaldsong's app reads SKALDSONG_HOST_SQLITE_PATH + SKALDSONG_HOST_RUNS_ROOT (per its Dockerfile ENV defaults). Our values were orthogonal — the app fell back to Dockerfile defaults pointing at /app/data/... which is NOT bind-mounted, so every --force-recreate wiped the SQLite DB + runs/ tree along with the ephemeral container layer. Surfaced by skaldsong-dev (althing thread 01KS4DPF6SXTBP4Q360JZVWPNT) after the operator noticed stories vanishing on every deploy. Confirmed on ana-docker: container had a 40KB skaldsong-ui.db sitting in /app/data/, while /opt/docker/conf/skaldsong/db/ on the host was empty. Rescued the live DB to the bind-mount target before recreate. Fix: rename env vars to match what the app reads. Bind targets stay at /app/state/{db,runs} (parent-dir mount for SQLite WAL+SHM). --- stacks/skaldsong/compose.yaml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/stacks/skaldsong/compose.yaml b/stacks/skaldsong/compose.yaml index c822388..116c129 100644 --- a/stacks/skaldsong/compose.yaml +++ b/stacks/skaldsong/compose.yaml @@ -80,9 +80,15 @@ services: # Persistent state paths inside the container. The db/ parent # dir is the bind-mount target (not the file itself) so SQLite - # can write its WAL + SHM siblings. - SKALDSONG_DB_PATH: /app/state/db/skaldsong-ui.db - SKALDSONG_RUNS_DIR: /app/state/runs + # can write its WAL + SHM siblings. Names MUST match what the + # app actually reads (per skaldsong's Dockerfile ENV defaults): + # SKALDSONG_HOST_SQLITE_PATH + SKALDSONG_HOST_RUNS_ROOT. Earlier + # this block used SKALDSONG_DB_PATH / SKALDSONG_RUNS_DIR — those + # names are orthogonal to what the app reads, so the app fell + # back to Dockerfile defaults pointing at /app/data/... which + # is NOT bind-mounted → state wiped on every recreate. + SKALDSONG_HOST_SQLITE_PATH: /app/state/db/skaldsong-ui.db + SKALDSONG_HOST_RUNS_ROOT: /app/state/runs volumes: # db/ and runs/ are separate bind-mounts so runs/ can later move to # a bigger volume without touching DB state.