Files
felhom.eu/documentation/audits/burndown-3-2026-10-17/tools/redis6c.py
T
admin e1dd1cadd3
gates / gates (push) Successful in 7m2s
burndown 3: report, evidence, register (174 -> 168), 07 Redis RDB [DESIGN], 04 §6.3 the box's password doors
Closed R-1115, R-1111, R-1112, R-1113, R-1109, R-1110, R-1114, R-1096; opened R-1116 (decoy suites in the other
runners), R-1117 (Immich/Nextcloud Redis volume, deferred). Controller 0.325.0 is the floor since 08:21 UTC.

Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
2026-10-17 10:28:03 +02:00

45 lines
2.0 KiB
Python

#!/usr/bin/env python3
"""redis6c.py — R-1096 6c on a test box after the catalog push: sync, then per app the dashboard's restart, and the
Redis facts before/after (DBSIZE, INFO persistence, the container's Created + Cmd). Env SC, EV, TARGET; args: apps.
`--no-restart` only reads (a box where CC presses nothing)."""
import os, sys, time
sys.path.insert(0, "/mnt/5_hdd/felhom.eu/git/app-catalog-felhom.eu/scripts")
import box_walk as w # noqa: E402
EV = os.environ["EV"]
LOG = open(os.path.join(EV, f"6c-{w.TARGET}.txt"), "a", buffering=1)
_say = w.say
def say(*a):
_say(*a); LOG.write(time.strftime("%H:%M:%S ") + " ".join(str(x) for x in a) + "\n")
w.say = say
def facts(app):
rc = f"{'paperless' if app == 'paperless-ngx' else app}-redis"
out = w.guest(f"""echo "compose: $(grep -h 'redis-server' /opt/docker/stacks/{app}/docker-compose.yml /opt/docker/stacks/{app}/applied-compose.yml | tr -s ' ' | tr '\\n' '|')"
echo "container: $(docker inspect -f '{{{{.Created}}}} {{{{json .Config.Cmd}}}}' {rc}) $(docker ps --filter name=^{rc}$ --format '{{{{.Status}}}}')"
echo "dbsize: $(docker exec {rc} redis-cli DBSIZE) $(docker exec {rc} redis-cli INFO persistence | grep -E 'aof_enabled|rdb_last_bgsave_status' | tr -d '\\r' | tr '\\n' ' ')"
echo "/data: $(docker exec {rc} ls /data | tr '\\n' ' ')" """)
return out.strip()
def main():
apps = [a for a in sys.argv[1:] if not a.startswith("--")]
w.login()
code, d = w.ctl("POST", "/api/sync")
say(f"POST /api/sync -> {code} {str(d)[:200]}")
time.sleep(5)
for app in apps:
say(f"== {app} before:\n{facts(app)}")
if "--no-restart" in sys.argv:
continue
c, d = w.ctl("POST", f"/api/stacks/{app}/restart")
say(f" POST /api/stacks/{app}/restart -> {c} {str(d)[:120]}")
for _ in range(60):
time.sleep(5)
if w.stack(app).get("state") == "running":
break
time.sleep(15)
st = w.stack(app)
say(f"== {app} after (state={st.get('state')} hold={st.get('hold_reason')!r}):\n{facts(app)}")
main()