Redis snapshots, not append-only, on five apps (R-1096); gate redis-persistence
gates / gates (push) Successful in 5s

romm, docmost, paperless-ngx, immich, nextcloud: redis-server --appendonly no (was yes); volumes kept. Proved on
scratch 9202 first: 100/100 keys through the switch and through the nightly volume dump + restore; a damaged AOF
refuses to start, a snapshot on a full disk keeps the old file. steps/ files unchanged (tested definitions,
09 6.4 part 5). New --fast gate check-redis-persistence.py with 9 decoy cases, red-proved.

Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
admin committed 2026-10-17 09:22:37 +02:00
1 parent 33a4b3b518
commit 5d9450b066
12 files changed
+215 -15

No files matched your search

+17
View File
@@ -1,3 +1,20 @@
## 2026-10-17 — Redis snapshots, not append-only, on five apps (R-1096); gate `redis-persistence`
- **romm, docmost, paperless-ngx, immich, nextcloud:** the Redis sidecar's `command:` is `redis-server --appendonly no`
(was `--appendonly yes`); the image's default snapshot rules stay. Volumes unchanged. A box running one of them takes
the line on the 15-minute sync and runs it from the app's next start (the nightly backup stops and starts each app).
An append-only file damaged in the middle (the 2026-09-24 thin-pool fill) kept Redis — and RomM — down until a person
ran `redis-check-aof --fix`; a snapshot is written to a temp file and renamed, so a full disk leaves the old one.
- **Proved first on scratch guest 9202** (felhom.eu `audits/burndown-3-2026-10-17/P6/`): docmost with 100 probe keys,
the change delivered through the catalog and the dashboard's restart — 100/100 back, `aof_enabled:0`,
`rdb_last_bgsave_status:ok`; then the nightly volume dump, FLUSHALL, the backups page's restore — 100/100 back. The old
form with 64 zero bytes in its AOF refuses to start; the new form on a full disk keeps its old dump.rdb byte-identical
and starts on it.
- **`steps/` files unchanged** (romm 2, docmost 1, nextcloud 2, immich 2): each is a tested step definition; a box
climbing the ladder runs it as tested and reaches RDB at the head (`09` §6.4 part 5; frozen apps are frozen whole).
- New gate `scripts/check-redis-persistence.py` (`--fast`, stdlib): no Redis/Valkey service of a template's compose runs
append-only. 9 decoy cases, red-proved (a blind check fails the four facts). Gate count 21. REUSE.md row added.
## 2026-10-17 — the copy gate's credential case convicts again; the decoy suite is a gate (R-1115)
- **What moved: the decoy, not the gate.** „FACT: a credential token rewritten in translation" appended a second
+9 -9
View File
@@ -1,11 +1,11 @@
# REPORT — the copy gate's credential case convicts again; the decoy suite is a gate (R-1115) (2026-10-17)
# REPORT — Redis snapshots, not append-only, on five apps (R-1096) (2026-10-17)
Part 1 of burndown 3; full report: felhom.eu `REPORT-burndown-3-2026-10-17.md`.
Part 6 of burndown 3; full report: felhom.eu `REPORT-burndown-3-2026-10-17.md`. Earlier today, same session: `33a4b3b`
(R-1115, the copy gate's credential case).
- **Cause:** the DECOY moved. `326f846` (R-1102) removed gokapi's login line; the case appended an English login to a
template that had no Hungarian one left, so the gate had nothing to compare. The gate was right.
- **Fix:** the case rewrites wger's existing English login in place (`edit` stops the suite if the line is gone), and a
new case rewords calibre-web's `admin123`. Both refused (rc 1, the token named). Old case on today's tree: rc 0.
- **Seen from now on:** `gate-decoys` runs in `catalog_gates.py`'s full run (~196 s, PyYAML: not `--fast`).
- **Also fixed:** `test_catalog_gates.py` was red since last night (gate count 18 → it is 20 now).
- Copy gate over the whole catalog: OK. `catalog_gates.py --fast`: all OK. Decoy suite: 243 cases OK.
- **Change:** romm, docmost, paperless-ngx, immich, nextcloud — Redis `--appendonly yes` → `--appendonly no`. Volumes kept.
- **Proof on 9202 first:** 100/100 keys kept through the switch (catalog + the dashboard's restart) and through the nightly
volume dump + restore; `aof_enabled:0`, `rdb_last_bgsave_status:ok`. Damaged AOF refuses to start (reproduced); a
snapshot on a full disk fails safe (old file intact).
- **Step files:** unchanged — tested definitions (`09` §6.4 part 5, `stacks/ladder.go` `nextLadderStep`).
- **Gate:** `redis-persistence` (fast), 9 decoy cases, red-proved. `catalog_gates.py --fast` green.
+1
View File
@@ -51,6 +51,7 @@ Templates are config; the few script helpers other scripts must REUSE, never re-
| Memory convention | `templates/paperless-ngx/docker-compose.yml` (~L71) + `.felhom.yml resources:` | EVERY service has `deploy.resources.limits.memory` (compose is the enforcement). NO `reservations` anywhere. `.felhom.yml mem_limit` = SUM of all containers' limits (see paperless header comment: 768+256+128=1152M); `mem_request` = expected steady-state usage, display-only. **Gated since 2026-10-05 (R-758):** `scripts/check-mem-limit-sum.py` (`--fast`, stdlib only) refuses a `mem_limit` that is not the sum and a service with no limit; `steps/` files are not judged. |
| Compose file skeleton | `templates/paperless-ngx/docker-compose.yml` (header) | Header comment (app, domain, DB type, RAM math, Pi), `restart: unless-stopped`, `TZ=Europe/Budapest`, explicit `container_name`, `traefik-public` external network + `<app>-internal` for DBs, Traefik labels with ``Host(`${SUBDOMAIN}.${DOMAIN}`)``, named volumes for DB/config (NVMe), `${HDD_PATH}/appdata/<app>/...` for bulk data, `${USERDATA_PATH}/...` for customer-browsable content. |
| App-email (SMTP shim) opt-in | `templates/vaultwarden/.felhom.yml` (`smtp_mapping:`) + README.md §smtp_mapping | `smtp_mapping` maps shim host/port/security/from to the app's own env names; compose MUST reference the mapped `${VAR:-}` keys with empty defaults. STARTTLS if the app can accept self-signed certs, else `security_value: "NONE"` plaintext (or the :2526 plaintext listener for STARTTLS-insistent clients — see calcom/nextcloud). TRAP: an image that treats defined-but-EMPTY mail vars as "set" (vaultwarden — campaign F1 2026-07-06) needs its own enable-flag gated `false` in compose and flipped `"true"` via `smtp_mapping.extra`; boot-prove a fresh email-off deploy for every new smtp-mapped app. |
| Redis sidecar persistence (R-1096) | `templates/paperless-ngx/docker-compose.yml` (`paperless-redis`) | `command: redis-server --appendonly no` — snapshots (RDB), never append-only: a damaged AOF keeps Redis down until a person runs `redis-check-aof --fix`, while a snapshot is written to a temp file and renamed, so a full disk leaves the old one intact. No command = the image default = RDB (outline). Gate `redis-persistence` refuses AOF in a template's compose; `steps/` files are tested definitions and keep what they were tested with. |
| Probe-container naming | `templates/vaultwarden/docker-compose.yml` (`container_name: vaultwarden`) + `templates/sparkyfitness/` | The controller-side `healthcheck.checks[]` probe dials the container whose **name equals the stack (directory) name exactly**; fallback = the FIRST running prefix-match, which in a multi-container stack can be the DB (verified: `felhom-controller/controller/internal/stacks/healthprobe.go` `findProbeContainer`). So the Traefik-exposed service's `container_name` must be exactly the stack name; sidecars `<app>-db`, `<app>-redis`, …. |
## 3. Dangerous lookalikes — do NOT copy
+4
View File
@@ -33,6 +33,7 @@ Gates, in order (all must pass; **non-zero exit on any failure**):
runs (R-1007): an Immich bump without a re-proven repair is refused, not silently skipped
14. guide-version static, instant, ADVISORY — a user guide's checked_version is not the image tag the app
runs: a WARN naming both versions, and exit 0 always (it never fails a push)
16. redis-persistence static, instant, whole repo — no template's Redis/Valkey service runs append-only (R-1096)
15. gate-decoys the decoy suite (test_gate_decoys.py) — each gate above still convicts its decoys
(R-1115). ~3 minutes, needs PyYAML: the full run only, never --fast
4. engine-major static, needs GIT HISTORY — no database engine pin crosses a MAJOR version
@@ -151,6 +152,9 @@ GATES = [
# R-1097 (2026-10-16): a household-data path an image keeps in its own anonymous VOLUME (RomM's /romm/assets) is
# mounted by the template, or no app backup takes it. Measured registry; static, stdlib only: the hook and CI.
("image-volumes", "check-image-volumes.py", False, True, False),
# R-1096 (2026-10-17): no catalog Redis runs append-only — a damaged AOF keeps Redis (and its app) down until a
# person repairs it; snapshots are written by temp-file-and-rename. Static, stdlib only: the hook and CI.
("redis-persistence", "check-redis-persistence.py", False, True, False),
# R-1115 (2026-10-17): the gates' OWN decoy suite — every gate above is red-proved against its decoys here. It
# was not in this table, so a case that stopped convicting (a template edit removed its premise) failed for a
# night with nobody looking. Static (a local clone, a stub docker), but ~3 minutes and it needs PyYAML, so NOT
+133
View File
@@ -0,0 +1,133 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""check-redis-persistence.py — no catalog Redis runs append-only (AOF); snapshots (RDB) only.
python3 scripts/check-redis-persistence.py # every template's docker-compose.yml
python3 scripts/check-redis-persistence.py --root DIR # another checkout (the decoy harness)
WHY (R-1096, 2026-10-17). An append-only file damaged in the MIDDLE — what the 2026-09-24 thin-pool fill left in
docmost's and romm's Redis (zero bytes near the end) — makes Redis refuse to start until a person runs
`redis-check-aof --fix`, and the app stays down. A snapshot (RDB) is written to a temp file and renamed only when
complete, so a full disk leaves the old snapshot intact (measured on 9202: the save fails, the old dump.rdb is
byte-identical, Redis starts again on it — felhom.eu audits/burndown-3-2026-10-17/P6/). The five apps were switched to
`--appendonly no` in one commit; this gate keeps a sixth from arriving with AOF.
WHAT IS JUDGED: every service of templates/<app>/docker-compose.yml whose image is redis or valkey; its `command:`
(string, flow list or block list) must not turn AOF on (`--appendonly yes` / `appendonly yes`). A service with no
command runs the image's default, which is RDB. NOT judged, on purpose: `steps/<key>.yml` — a ladder step is its own
TESTED definition and a box climbing the ladder runs it unchanged (`09` §6.4 part 5); a box reaches RDB at the head.
LIMIT, stated: a mounted redis.conf is not read (no catalog template mounts one today).
STANDARD LIBRARY ONLY (the CI runner has no PyYAML); comments never count.
Exit 0 clean · 1 a template runs AOF · 3 nothing to judge.
"""
import io
import os
import re
import sys
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
REDIS_IMAGES = ("redis", "valkey")
def strip_comment(line):
out, q = [], None
for c in line:
if q:
if c == q:
q = None
elif c in "'\"":
q = c
elif c == "#":
break
out.append(c)
return "".join(out).rstrip()
def is_redis(image):
image = image.strip().strip("'\"").split("@", 1)[0]
last = image.rsplit("/", 1)[-1].split(":", 1)[0]
return last in REDIS_IMAGES
def services(path):
"""{service: (image, command text)} — the command's string, flow list or block list joined by spaces."""
out, cur, in_svcs, in_cmd = {}, None, False, False
with io.open(path, encoding="utf-8") as f:
for raw in f:
line = strip_comment(raw.rstrip("\n"))
if not line.strip():
continue
ind = len(line) - len(line.lstrip(" "))
if ind == 0:
in_svcs, cur = line.startswith("services:"), None
continue
if not in_svcs:
continue
if ind == 2 and line.strip().endswith(":"):
cur = line.strip()[:-1]
out[cur] = ["", ""]
in_cmd = False
continue
if cur is None:
continue
if ind == 4:
in_cmd = False
m = re.match(r"^\s{4}image:\s*(\S+)", line)
if m:
out[cur][0] = m.group(1)
m = re.match(r"^\s{4}command:\s*(.*)$", line)
if m:
out[cur][1] = m.group(1)
in_cmd = m.group(1).strip() == ""
continue
if in_cmd and ind >= 6:
m = re.match(r"^\s*-\s*(.+)$", line)
if m:
out[cur][1] += " " + m.group(1)
return out
def runs_aof(command):
toks = re.findall(r"[^\s\[\],\"']+", command)
for i, t in enumerate(toks[:-1]):
if t.lstrip("-") == "appendonly" and toks[i + 1].lower() == "yes":
return True
return False
def main(argv):
root = ROOT
if "--root" in argv:
root = argv[argv.index("--root") + 1]
for a in argv:
if a.startswith("--root="):
root = a.split("=", 1)[1]
tdir = os.path.join(root, "templates")
if not os.path.isdir(tdir):
print("check-redis-persistence: no templates/ under %s — nothing to judge (a failure, never a pass)" % root)
return 3
bad, judged = [], 0
for app in sorted(os.listdir(tdir)):
p = os.path.join(tdir, app, "docker-compose.yml")
if not os.path.isfile(p):
continue
for svc, (image, cmd) in services(p).items():
if not is_redis(image):
continue
judged += 1
if runs_aof(cmd):
bad.append("%s/docker-compose.yml: service %s (%s) runs append-only — `command: %s`. Use "
"`--appendonly no` (snapshots): a damaged AOF keeps Redis down until a person repairs it "
"(R-1096)" % (app, svc, image, cmd.strip()))
if bad:
print("check-redis-persistence: FAIL — %d Redis service(s) run append-only:" % len(bad))
for b in bad:
print(" - " + b)
return 1
print("check-redis-persistence gate OK — %d Redis service(s), none append-only" % judged)
return 0
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))
+3 -1
View File
@@ -73,7 +73,9 @@ class CatalogGatesFastTest(unittest.TestCase):
# 19 since 2026-10-16 night: db-credentials (R-1106) — STALE AGAIN until 2026-10-17 (that night did not
# update this count; found by burndown 3, because this file is in no gate run either).
# 20 since 2026-10-17: gate-decoys (R-1115) — the decoy suite itself; ~3 min, so the full run only.
self.assertEqual(len(mod.GATES), 20)
# 21 since the same day: redis-persistence (R-1096) — fast, no history: the hook AND CI.
self.assertEqual(len(mod.GATES), 21)
self.assertIn("redis-persistence", [g[0] for g in mod.GATES if g[3] and not g[4]])
self.assertIn("db-credentials", [g[0] for g in mod.GATES if g[3] and not g[4]])
self.assertIn("login-kind", [g[0] for g in mod.GATES if g[3] and not g[4]])
self.assertIn("image-volumes", [g[0] for g in mod.GATES if g[3] and not g[4]])
+43
View File
@@ -68,6 +68,7 @@ COVERS = {
"image-volumes": "the data path mounted only in a COMMENT, on ANOTHER service (romm-db), at the PARENT (/romm) or a CHILD (/romm/assets/x), or only as a top-level volume never mounted - each refused; a steps/ file without it refused; vs the facts: a named volume or a bind AT the path passes, an image not in the registry is not judged, no templates/ is rc 3 (R-1097)",
"login-kind": "login_kind written only in a COMMENT, only inside the English i18n: block, or under ANOTHER mapping (resources:) - none is the field, each passes; vs the facts: an unknown value (`magic`), a wrong case (`EMAIL`), the key twice, and no templates/ at all (rc 3, never a pass); the three known values pass (controller 0.320.0)",
"copy-i18n": "Hungarian edited in a COMMENT/README/display_name (label, not copy) vs a real frozen string changed; an English block that is not English, is not matched to a Hungarian twin, or rewrites a credential (R-560). A retrieval promise REGISTERED in ALLOWLIST_EN passes only for its own app+path+sentence with a real reason; an entry for another app, a rewritten sentence, a stale entry or a two-word reason convicts (R-594). Also the DEGRADED mode CI actually runs — PyYAML shadowed out, freeze only (R-595). THE USER GUIDE (2026-10-15): a download-source name only in a COMMENT or in docs_url passes; vs the facts - guide strings not frozen, checked_version in the English block, an empty steps list, an FAQ entry with no answer, an unquoted version, an English guide with no Hungarian one, more English sections than Hungarian, a different step count, and a source name in either language",
"redis-persistence": "`--appendonly yes` only in a COMMENT, or only in a steps/ file (a tested step definition, not judged on purpose) - each passes; vs the facts: AOF in string form, in a flow list, in a block list, on a valkey image - each refused naming the app; image default (no command) and `--appendonly no` pass; no templates/ is rc 3 (R-1096)",
"gate-decoys": "this suite, run as a gate of the full run (R-1115): every case above is a decoy of its own gate, and ONE case that stops convicting turns the whole run red - measured 2026-10-17, when the credential-token case had lost its premise (gokapi's login line removed by 326f846) the suite printed FAIL and exited 1; the copy-i18n credential cases now edit an EXISTING line, so a removed premise stops the suite (`edit` raises) instead of passing",
}
@@ -781,6 +782,47 @@ def image_volumes_cases():
shutil.rmtree(ws, ignore_errors=True)
def redis_persistence_cases():
"""check-redis-persistence.py reads templates/*/docker-compose.yml under --root; steps/ deliberately not (R-1096)."""
global ran
ws = tempfile.mkdtemp(prefix="catalog-redis-")
try:
def compose(cmd_lines, image="redis:7-alpine", comment=""):
return ("services:\n app:\n image: example/app:1.0\n app-redis:\n image: %s\n%s%s"
" volumes:\n - app_redis:/data\nvolumes:\n app_redis:\n" % (image, comment, cmd_lines))
def run(name, files, expect_rc, must=(), no_templates=False):
global ran
cat = os.path.join(ws, "cat")
shutil.rmtree(cat, ignore_errors=True)
os.makedirs(cat)
if not no_templates:
for rel, body in files.items():
p = os.path.join(cat, "templates", rel)
os.makedirs(os.path.dirname(p), exist_ok=True)
io.open(p, "w", encoding="utf-8").write(body)
r = sh([sys.executable, os.path.join(ROOT, "scripts", "check-redis-persistence.py"), "--root=" + cat], ROOT)
out = r.stdout + r.stderr; ran += 1
ok = r.returncode == expect_rc and all(m in out for m in must)
print(" %s %-70s rc=%d (expected %d)" % ("ok" if ok else "XX", name, r.returncode, expect_rc))
if not ok:
fails.append("%s: rc=%d expected %d; missing %s\n%s" % (name, r.returncode, expect_rc, [m for m in must if m not in out], out[-400:]))
rdb = " command: redis-server --appendonly no\n"
aof = " command: redis-server --appendonly yes\n"
print("\n-- redis-persistence: genuine and decoys (each passes)")
run("GENUINE: --appendonly no", {"a/docker-compose.yml": compose(rdb)}, 0, ("1 Redis service",))
run("GENUINE: no command (the image default is RDB)", {"a/docker-compose.yml": compose("")}, 0, ("1 Redis service",))
run("DECOY: --appendonly yes only in a COMMENT", {"a/docker-compose.yml": compose(rdb, comment=" # command: redis-server --appendonly yes\n")}, 0, ("none append-only",))
run("DECOY: AOF only in a steps/ file (a tested step, not judged)", {"a/docker-compose.yml": compose(rdb), "a/steps/0123456789abcdef.yml": compose(aof)}, 0, ("none append-only",))
print("-- redis-persistence: the facts (each MUST be refused)")
run("FACT: AOF in string form", {"a/docker-compose.yml": compose(aof)}, 1, ("a/docker-compose.yml", "app-redis"))
run("FACT: AOF in a flow list", {"a/docker-compose.yml": compose(' command: ["redis-server", "--save", "60", "1", "--appendonly", "yes"]\n')}, 1, ("app-redis",))
run("FACT: AOF in a block list", {"a/docker-compose.yml": compose(" command:\n - redis-server\n - --appendonly\n - \"yes\"\n")}, 1, ("app-redis",))
run("FACT: AOF on a valkey image", {"a/docker-compose.yml": compose(" command: valkey-server --appendonly yes\n", image="valkey/valkey:8-alpine")}, 1, ("valkey",))
run("FACT: no templates/ at all (nothing to judge)", {}, 3, ("nothing to judge",), no_templates=True)
finally:
shutil.rmtree(ws, ignore_errors=True)
def unclean_boot_cases():
"""check-unclean-boot-images.py reads FILES: templates/*/.felhom.yml + docker-compose.yml (+ steps/), via --root (R-1007)."""
global ran
@@ -1925,6 +1967,7 @@ i18n:
unclean_boot_cases()
login_kind_cases()
image_volumes_cases()
redis_persistence_cases()
if fails:
print()
+1 -1
View File
@@ -86,7 +86,7 @@ services:
image: redis:7-alpine
container_name: docmost-redis
restart: unless-stopped
command: redis-server --appendonly yes
command: redis-server --appendonly no
environment:
- TZ=Europe/Budapest
volumes:
+1 -1
View File
@@ -123,7 +123,7 @@ services:
image: redis:7-alpine
container_name: immich-redis
restart: unless-stopped
command: redis-server --appendonly yes
command: redis-server --appendonly no
environment:
- TZ=Europe/Budapest
volumes:
+1 -1
View File
@@ -107,7 +107,7 @@ services:
image: redis:7-alpine
container_name: nextcloud-redis
restart: unless-stopped
command: redis-server --appendonly yes
command: redis-server --appendonly no
environment:
- TZ=Europe/Budapest
volumes:
+1 -1
View File
@@ -125,7 +125,7 @@ services:
image: redis:7-alpine
container_name: paperless-redis
restart: unless-stopped
command: redis-server --appendonly yes
command: redis-server --appendonly no
environment:
- TZ=Europe/Budapest
volumes:
+1 -1
View File
@@ -152,7 +152,7 @@ services:
image: redis:7-alpine
container_name: romm-redis
restart: unless-stopped
command: redis-server --appendonly yes
command: redis-server --appendonly no
environment:
- TZ=Europe/Budapest
volumes: