Controller v0.314.0 released under decision 250: floor 0.314.0 raised by CC's token at 13:11 UTC after the three test boxes
gates / gates (push) Successful in 6m45s
gates / gates (push) Successful in 6m45s
- 09 §3 decision 253: a restore puts the setup gate back as it was (R-1057 P2); 07 (what a per-app backup carries); 15 §6 (Prowlarr links itself; Plex by address). - Evidence audits/gate-restore-2026-10-15/: 9202 live proofs (R-1057, R-1058), the release (per-customer floors, Tester 1 rc.1 -> 0.314.0 by itself, box walk, global floor, read-back), Plex fake-code check on 9201, red-proofs. - Register: R-1023, R-1053, R-1057, R-1058 closed; R-1061 filed (P4); R-1060 narrowed; R-1052 blocked (customer creation is session only). STATUS, CONTEXT, the build skill's release steps, Prowlarr's website card. Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
1 parent
bd478afe14
commit
15cb62097c
40 files changed
+945
-22
No files matched your search
@@ -0,0 +1,86 @@
|
||||
#!/usr/bin/env python3
|
||||
"""repoint.py mirror|drill|restore|status — point the Tester 1 box at the drill catalog WITHOUT a credential (R-992).
|
||||
|
||||
WHY A LOCAL MIRROR. `09` §6.5's route needs a catalog credential on the box: the drill repo is private (R-992). This
|
||||
session could not mint a READ-ONLY one — the Gitea credential on DooPlex is itself a token, and Gitea answers 403 to a
|
||||
token asking to list or create tokens (measured 2026-10-14) — and the night of 2026-10-06 put the admin WRITE token
|
||||
into the box's controller.yaml, which this task forbids. The cache-staging workaround of 2026-10-12 does not hold for a
|
||||
test that lasts days: every sync (and every controller start) re-applies the live catalog over the staged templates
|
||||
and over the installed apps' compose files (Syncer.copyTemplates, no deployed check).
|
||||
|
||||
So the drill catalog is MIRRORED onto the box: a bare git repository inside the controller's own data volume, and
|
||||
`git.repo_url: file:///opt/docker/felhom-controller/drill-catalog.git`. The controller's sync runs exactly as for a
|
||||
remote (clone/fetch/reset, the R-615 re-clone on a changed URL); no secret is on the box. DooPlex updates the mirror
|
||||
from the drill repo with a git bundle (`mirror`). The drill repo on Gitea stays the record.
|
||||
|
||||
SC=~/.felhom-tester1 TARGET=tester-1 python3 repoint.py mirror # (re)load the mirror from the drill repo main
|
||||
... repoint.py drill # save controller.yaml (once), set repo_url to the mirror, restart, sync, rescan
|
||||
... repoint.py restore # put the saved controller.yaml back (byte-identical), restart, sync, rescan
|
||||
... repoint.py status
|
||||
"""
|
||||
import os, subprocess, sys, time
|
||||
sys.path.insert(0, "/mnt/5_hdd/felhom.eu/git/app-catalog-felhom.eu/scripts")
|
||||
import box_walk as w
|
||||
|
||||
DRILL = "/mnt/5_hdd/felhom.eu/drill/app-catalog-drill"
|
||||
VOL = "/var/lib/docker/volumes/felhom-controller-data/_data" # guest path of the controller's data volume
|
||||
CVOL = "/opt/docker/felhom-controller" # the same, inside the controller container
|
||||
SAVE = f"{VOL}/controller.yaml.pre-prowlarr1015"
|
||||
MIRROR_URL = f"file://{CVOL}/drill-catalog.git"
|
||||
|
||||
|
||||
def status():
|
||||
print(w.guest(f"""grep -nE 'repo_url|sync_interval' {VOL}/controller.yaml; ls -l {SAVE} 2>&1 | tail -1
|
||||
docker exec felhom-controller sh -c 'git -C {CVOL}/drill-catalog.git log -1 --format="mirror main %h %s" main 2>&1;
|
||||
git -C {CVOL}/data/catalog-cache log -1 --format="cache HEAD %h %s" 2>&1; git -C {CVOL}/data/catalog-cache remote get-url origin'"""))
|
||||
|
||||
|
||||
def mirror():
|
||||
b = "/tmp/drill-prowlarr.bundle"
|
||||
subprocess.run(["git", "-C", DRILL, "bundle", "create", b, "main"], check=True, capture_output=True)
|
||||
head = subprocess.run(["git", "-C", DRILL, "rev-parse", "--short", "main"], capture_output=True, text=True).stdout.strip()
|
||||
ssh = w.ssh_args()
|
||||
# bundle -> PVE host -> guest -> controller volume; the bare repo is made and fetched BY the controller's own user
|
||||
subprocess.run(["scp", "-q", "-o", "StrictHostKeyChecking=accept-new"] + (["-J", w._T["jump"]] if w._T["jump"] else [])
|
||||
+ [b, f"{w._T['ssh']}:{b}"], check=True)
|
||||
subprocess.run(ssh + [f"pct push {w.GUEST} {b} {VOL}/drill-prowlarr.bundle && rm -f {b}"], check=True)
|
||||
print(w.guest(f"""set -e
|
||||
docker exec felhom-controller sh -c 'test -d {CVOL}/drill-catalog.git || git init -q --bare -b main {CVOL}/drill-catalog.git
|
||||
git -C {CVOL}/drill-catalog.git fetch -q {CVOL}/drill-prowlarr.bundle +main:main && rm -f {CVOL}/drill-prowlarr.bundle
|
||||
git -C {CVOL}/drill-catalog.git log -1 --format="mirror main %h %s" main'"""))
|
||||
print("drill repo main:", head)
|
||||
os.remove(b)
|
||||
|
||||
|
||||
def restart_sync():
|
||||
w.guest("docker restart felhom-controller >/dev/null")
|
||||
for _ in range(60):
|
||||
time.sleep(3)
|
||||
try:
|
||||
w.login()
|
||||
break
|
||||
except SystemExit:
|
||||
continue
|
||||
w.sync_rescan()
|
||||
time.sleep(3)
|
||||
print(w.guest("docker logs --since 3m felhom-controller 2>&1 | grep -E '\\[sync\\]' | grep -v DEBUG | tail -8"))
|
||||
|
||||
|
||||
def drill():
|
||||
print(w.guest(f"""set -e
|
||||
test -f {SAVE} || cp -p {VOL}/controller.yaml {SAVE}
|
||||
sed -i -E 's#^(\\s+repo_url: ).*$#\\1{MIRROR_URL}#' {VOL}/controller.yaml
|
||||
grep -n 'repo_url' {VOL}/controller.yaml; diff {SAVE} {VOL}/controller.yaml || true"""))
|
||||
restart_sync()
|
||||
status()
|
||||
|
||||
|
||||
def restore():
|
||||
print(w.guest(f"""set -e
|
||||
cp -p {SAVE} {VOL}/controller.yaml
|
||||
cmp {SAVE} {VOL}/controller.yaml && echo RESTORED-IDENTICAL; grep -n repo_url {VOL}/controller.yaml"""))
|
||||
restart_sync()
|
||||
status()
|
||||
|
||||
|
||||
{"mirror": mirror, "drill": drill, "restore": restore, "status": status}[sys.argv[1]]()
|
||||
@@ -0,0 +1,156 @@
|
||||
#!/usr/bin/env python3
|
||||
"""walk_gate_restore.py (from prowlarr-2026-10-15/tools/walk_restore.py) — R-1057 live proof on controller 0.314.0-rc.1, and
|
||||
NEW-APP-CHECKLIST 2.5 for Prowlarr on scratch guest 9202: seed -> backup -> remove -> restore ->
|
||||
read back, THROUGH THE PRODUCT (R-1048, 2026-10-15, second 9202 run).
|
||||
|
||||
The box has no per-app „Mentés most" (R-648: the only backup press is whole-box and is never pressed from a drill), so
|
||||
the per-app backup is the one the guarded Update takes in its `backing-up` phase — the same route as grocy's and
|
||||
lubelogger's restore records. Runs ON DOOPLEX with TARGET=9202, SC=<0600 dir holding .ctlpw>, EV=<evidence dir>; 9202
|
||||
must already read the drill mirror, whose prowlarr template is at FROM. Presses: deploy, the drill bump + Update,
|
||||
remove KEEPING the backups, the household's restore button (POST /backup/restore), remove with the backups.
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
||||
sys.path.insert(0, "/mnt/5_hdd/felhom.eu/git/app-catalog-felhom.eu/scripts")
|
||||
import box_walk as w # noqa: E402
|
||||
import upgrade_fixtures_box as fx # noqa: E402
|
||||
|
||||
EV = os.environ["EV"]
|
||||
APP, SUB = "prowlarr", "prowlarr"
|
||||
FROM = "lscr.io/linuxserver/prowlarr:version-2.5.2.5491"
|
||||
TO = "lscr.io/linuxserver/prowlarr:version-2.6.5.5623"
|
||||
TOOLS = os.path.dirname(os.path.abspath(__file__))
|
||||
LOG = open(os.path.join(EV, "restore.txt"), "a", buffering=1)
|
||||
_lib_say = w.say
|
||||
|
||||
|
||||
def say(*a):
|
||||
_lib_say(*a)
|
||||
LOG.write(" ".join(str(x) for x in a) + "\n")
|
||||
|
||||
|
||||
w.say = say
|
||||
|
||||
|
||||
def drill_set(ref, why):
|
||||
"""Point the drill template at `ref`, staged by explicit path, then reload the 9202 mirror."""
|
||||
D = w.DRILL
|
||||
comp, fy = f"{D}/templates/{APP}/docker-compose.yml", f"{D}/templates/{APP}/.felhom.yml"
|
||||
w.sh(["git", "-C", D, "pull", "-q", "--rebase", "origin", "main"], timeout=120)
|
||||
c_ = open(comp).read()
|
||||
other = TO if ref == FROM else FROM
|
||||
if f"image: {ref}" not in c_:
|
||||
open(comp, "w").write(c_.replace(f"image: {other}", f"image: {ref}"))
|
||||
w.sh(["git", "-C", D, "add", f"templates/{APP}/docker-compose.yml", f"templates/{APP}/.felhom.yml"])
|
||||
w.sh(["git", "-C", D, "commit", "-q", "-m", f"DRILL {APP}: {why} -> {ref} (R-1048, checklist 2.5)"])
|
||||
r_ = w.sh(["git", "-C", D, "push", "-q", "origin", "main"], timeout=120)
|
||||
say(f"drill commit {w.sh(['git', '-C', D, 'rev-parse', '--short=12', 'HEAD']).stdout.strip()}: -> {ref} (push rc={r_.returncode})")
|
||||
subprocess.run([sys.executable, os.path.join(TOOLS, "repoint9202.py"), "mirror"], check=True, env=dict(os.environ))
|
||||
|
||||
|
||||
def main():
|
||||
w.login()
|
||||
if w.stack(APP).get("deployed"):
|
||||
sys.exit(say("prowlarr is installed on 9202 — STOP, not a fresh install") or 1)
|
||||
drill_set(FROM, "back to the previous image for a step")
|
||||
w.sync_rescan(expect_app=APP, expect_ref=FROM)
|
||||
code, d = w.ctl("POST", f"/api/stacks/{APP}/deploy", {"values": {"DOMAIN": w.DOMAIN, "SUBDOMAIN": SUB}})
|
||||
say(f"[1] deploy -> {code} {json.dumps(d, ensure_ascii=False)[:120]}")
|
||||
w.DEPLOYED_THIS_RUN.add(APP)
|
||||
for _ in range(60):
|
||||
s = w.stack(APP)
|
||||
if s.get("deployed") and s.get("state") == "running":
|
||||
break
|
||||
time.sleep(3)
|
||||
w.wait_app(SUB, "/ping", want=("200",), tries=40)
|
||||
say("[1] through traefik: " + w.guest(f"curl -sk -o /dev/null -w '%{{http_code}}' -H 'Host: {SUB}.{w.DOMAIN}' https://127.0.0.1/ping").strip()
|
||||
+ " (gated: 302 to the gate is the healthy answer for a stranger)")
|
||||
say("[1] stack .felhom.yml bytes: " + w.guest(f"wc -c < /opt/docker/stacks/{APP}/.felhom.yml").strip())
|
||||
say("[1] running: " + w.guest("docker inspect prowlarr -f '{{.Config.Image}} health={{.State.Health.Status}}'").strip())
|
||||
|
||||
fxp = fx.FIXTURES[APP]
|
||||
tok = fxp.seed(w, SUB, say)
|
||||
ok1 = bool(tok) and fxp.verify(w, SUB, tok, say)
|
||||
say(f"[2] seed {tok} read back: {ok1}")
|
||||
say("[2] 2.7 config volume size after the seed: " + w.guest("du -sh /var/lib/docker/volumes/prowlarr_prowlarr_config/_data | cut -f1").strip())
|
||||
say("[2] 4.4 negative control, the same probe on a port nothing serves: rc=" + w.guest("docker exec prowlarr curl -sf -o /dev/null http://127.0.0.1:9697/ping; echo $?").strip()
|
||||
+ " ; the real probe: rc=" + w.guest("docker exec prowlarr curl -sf -o /dev/null http://127.0.0.1:9696/ping; echo $?").strip())
|
||||
say("[2] 1.8 the app's own start lines: " + w.guest("docker logs prowlarr 2>&1 | grep -m2 -E 'Hosting environment|Application started'").strip().replace("\n", " | "))
|
||||
|
||||
drill_set(TO, "the step")
|
||||
w.sync_rescan(expect_app=APP, expect_ref=TO)
|
||||
up = w.press_update(APP)
|
||||
say(f"[3] guarded Update (its backing-up phase is the per-app backup): final={up.get('final_phase')} "
|
||||
f"phases={[p.get('phase') for p in up.get('phases', [])]}")
|
||||
ok2 = bool(tok) and fxp.verify(w, SUB, tok, say)
|
||||
say(f"[3] seed read back after the Update: {ok2}")
|
||||
obs = w.observables(APP)
|
||||
say(f"[3] after: {json.dumps(obs, ensure_ascii=False)[:400]}")
|
||||
s = w.stack(APP)
|
||||
if os.environ.get("VERDICT") == "1":
|
||||
verdict = {"app": APP, "venue": "box 9202 (drill catalog), the product's guarded Update — run 3, the full .felhom.yml",
|
||||
"from": {APP: FROM}, "to": {APP: TO},
|
||||
"verdict": "proven" if (ok1 and ok2 and up.get("final_phase") == "done" and s.get("state") == "running") else "failed",
|
||||
"seed_read_before": ok1, "seed_read_after": ok2, "healthy_after": s.get("state") == "running",
|
||||
"duration_s": up.get("duration_s"), "final_phase": up.get("final_phase"),
|
||||
"measured_at": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
|
||||
"evidence": "felhom.eu/documentation/audits/gate-restore-2026-10-15/9202/restore.txt"}
|
||||
os.makedirs(os.path.join(EV, "..", APP), exist_ok=True)
|
||||
json.dump(verdict, open(os.path.join(EV, "..", APP, "box-verdict-prowlarr.json"), "w"), indent=2)
|
||||
say(f"[3] box verdict {verdict['verdict']}")
|
||||
|
||||
say("[3] R-1057 the per-app backup's unit app.yaml, its gate lines: " + w.guest(
|
||||
f"f=$(find / -xdev -path '*{APP}*' -name app.yaml -path '*compose*' -newer /etc/felhom-controller-image 2>/dev/null | head -3); "
|
||||
"for x in $f; do echo \"$x: $(grep -A2 '^setup_gate:' $x | tr '\\n' ' ')\"; done").strip())
|
||||
snaps = w.snapshots(APP)
|
||||
say(f"[4] restore points offered BEFORE the remove: {json.dumps(snaps, ensure_ascii=False)[:400]}")
|
||||
c1, d1 = w.ctl("POST", f"/api/stacks/{APP}/stop")
|
||||
say(f"[4] stop -> {c1}")
|
||||
for _ in range(24):
|
||||
time.sleep(5)
|
||||
if w.stack(APP).get("state") != "running":
|
||||
break
|
||||
code, d = w.ctl("POST", f"/api/stacks/{APP}/remove", {"remove_hdd_data": False, "remove_backups": False})
|
||||
say(f"[4] remove KEEPING the backups -> {code} {json.dumps(d, ensure_ascii=False)[:300]}")
|
||||
time.sleep(5)
|
||||
say("[4] left after remove: " + w.guest("echo containers=$(docker ps -aq -f name=^prowlarr$ | wc -l) volumes=$(docker volume ls -q | grep -c prowlarr)").strip())
|
||||
|
||||
rr = w.restore(APP)
|
||||
say(f"[5] restore: {json.dumps({k: rr.get(k) for k in ('ok', 'snapshot_id', 'http', 'seconds', 'state_after', 'hold_after', 'why')}, ensure_ascii=False)}")
|
||||
w.wait_app(SUB, "/ping", want=("200",), tries=40)
|
||||
ok3 = bool(tok) and fxp.verify(w, SUB, tok, say)
|
||||
say(f"[5] 2.5 the seed reads back after remove + restore: {ok3}")
|
||||
for p, acc in (("/ping", "application/json"), ("/", "text/html"), ("/initialize.json", "application/json")):
|
||||
r = w.sh(["curl", "-sSk", "--max-time", "20", "-o", "/dev/null", "-D", "-", "-H", f"Host: {SUB}.{w.DOMAIN}",
|
||||
"-H", f"Accept: {acc}", f"{w.BASE}{p}"])
|
||||
st = re.match(r"HTTP/\S+ (\d+)", r.stdout or ""); loc = re.search(r"(?im)^location:\s*(\S+)", r.stdout or "")
|
||||
say(f"[6] R-1057 a STRANGER after the restore: GET {p} -> {st.group(1) if st else '000'} {('loc=' + loc.group(1)[:70]) if loc else ''}")
|
||||
rc, code, _ = w.app_curl(SUB, "/ping", timeout=20)
|
||||
say(f"[6] the HOUSEHOLD (gate cookie) after the restore: GET /ping -> {code}")
|
||||
st = w.stack(APP)
|
||||
say(f"[6] gate record after the restore: {json.dumps((st.get('app_config') or {}).get('setup_gate'))}")
|
||||
say("[6] gate file on the box: " + w.guest(f"ls /opt/docker/stacks/traefik/dynamic/setup-gate-{APP}.yml 2>&1").strip())
|
||||
code, d = w.ctl("POST", f"/apps/{APP}/setup-gate/open")
|
||||
say(f"[7] the household's „Kész, beállítottam” -> {code} {json.dumps(d, ensure_ascii=False)[:120]}")
|
||||
time.sleep(8)
|
||||
r = w.sh(["curl", "-sSk", "--max-time", "20", "-o", "/dev/null", "-w", "%{http_code}", "-H", f"Host: {SUB}.{w.DOMAIN}", f"{w.BASE}/ping"])
|
||||
say(f"[7] a stranger after „Kész”: GET /ping -> {r.stdout} (the app itself answers now)")
|
||||
say("[5] through traefik after restore: " + w.guest(f"curl -sk -o /dev/null -w '%{{http_code}}' -H 'Host: {SUB}.{w.DOMAIN}' https://127.0.0.1/ping").strip())
|
||||
say("[5] app.yaml env keys after restore: " + w.guest(f"sed -n '/^env:/,/^[a-z]/p' /opt/docker/stacks/{APP}/app.yaml | grep -oE '^ +[A-Z_]+' | paste -sd' '").strip())
|
||||
say("[5] image after restore: " + w.guest("docker inspect prowlarr -f '{{.Config.Image}} health={{.State.Health.Status}}'").strip())
|
||||
|
||||
# teardown through the product, backups too (this is a scratch install)
|
||||
w.remove(APP)
|
||||
say("[9] after remove: " + w.guest("echo containers=$(docker ps -aq -f name=^prowlarr$ | wc -l) volumes=$(docker volume ls -q | grep -c prowlarr)").strip())
|
||||
json.dump({"seed": tok, "seed_before": ok1, "after_update": ok2, "after_restore": ok3,
|
||||
"update_final": up.get("final_phase"), "restore": {k: rr.get(k) for k in ("ok", "snapshot_id", "http", "seconds", "state_after")},
|
||||
"measured_at": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())},
|
||||
open(os.path.join(EV, "restore-results.json"), "w"), indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
main()
|
||||
@@ -0,0 +1,141 @@
|
||||
#!/usr/bin/env python3
|
||||
"""walk_link.py (from prowlarr-2026-10-15/tools/walk_9201_link.py) — R-1058 live proof on controller 0.314.0-rc.1:
|
||||
Sonarr first, then Prowlarr: the link must appear with NO button; a second run changes nothing.
|
||||
|
||||
(original docstring:) walk_9201_link.py — the read-back on demo-hp 9201 from the LIVE catalog after the publish (R-1048, brief Part D3).
|
||||
|
||||
Runs ON DOOPLEX with TARGET=9201, SC=<0600 dir holding .ctlpw>, EV=<evidence dir>. Presses only what a person presses:
|
||||
POST /api/sync, the deploy wizard's POST /api/stacks/<n>/deploy, the dashboard's „Bekötés most" (POST
|
||||
/api/storage/media/wire), stop + remove KEEPING data. Reads Prowlarr's own API inside its container with the key from
|
||||
its own config.xml (never printed), exactly as the box's wiring does.
|
||||
|
||||
The two orders the controller's code implies (mediawire runs when a media_library app comes up; Prowlarr has no marker):
|
||||
B Sonarr first, Prowlarr after -> expected NO link by itself; „Bekötés most" makes it
|
||||
A Radarr after Prowlarr -> expected the link by itself, ~60 s after Radarr comes up
|
||||
Then: Prowlarr's own connection test for each link, and its sync command to completion.
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import shlex
|
||||
import sys
|
||||
import 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"]
|
||||
os.makedirs(EV, exist_ok=True)
|
||||
LOG = open(os.path.join(EV, "link.txt"), "a", buffering=1)
|
||||
TO = "lscr.io/linuxserver/prowlarr:version-2.6.5.5623"
|
||||
HDD = os.environ.get("HDD", "/mnt/felhom-drives/hdd_1")
|
||||
RES = {}
|
||||
_lib_say = w.say
|
||||
|
||||
|
||||
def say(*a):
|
||||
_lib_say(*a)
|
||||
LOG.write(" ".join(str(x) for x in a) + "\n")
|
||||
|
||||
|
||||
w.say = say
|
||||
|
||||
|
||||
def papi(path, body=None, method=None):
|
||||
# FIXED 2026-10-15 after the first run: json.dumps() quoted this with DOUBLE quotes, so the guest shell expanded
|
||||
# $(sed …) and $K before docker exec — empty key, every call 401 (link.txt [B3]/[C2]). shlex.quote keeps it literal.
|
||||
"""Prowlarr's own API from inside its container (the key read from its config.xml at use, never printed)."""
|
||||
m = method or ("POST" if body is not None else "GET")
|
||||
data = json.dumps(body) if body is not None else ""
|
||||
script = ("K=$(sed -n 's:.*<ApiKey>\\(.*\\)</ApiKey>.*:\\1:p' /config/config.xml); "
|
||||
f"curl -s -o /tmp/pb.json -w '%{{http_code}}' -X {m} -H \"X-Api-Key: $K\" -H 'Content-Type: application/json' "
|
||||
f"--data-binary @- http://127.0.0.1:9696/api/v1{path}; echo; cat /tmp/pb.json")
|
||||
out = w.guest(f"docker exec -i prowlarr sh -c {shlex.quote(script)} <<'EOF'\n{data}\nEOF")
|
||||
code, _, body_ = out.partition("\n")
|
||||
try:
|
||||
return code.strip(), json.loads(body_) if body_.strip() else None
|
||||
except Exception:
|
||||
return code.strip(), body_[:300]
|
||||
|
||||
|
||||
def apps():
|
||||
c, d = papi("/applications")
|
||||
return [(a.get("name"), a.get("syncLevel"), next((f.get("value") for f in a.get("fields", []) if f.get("name") == "baseUrl"), None))
|
||||
for a in (d or [])] if c == "200" else c
|
||||
|
||||
|
||||
def wiring_lines(since):
|
||||
return w.guest(f"docker logs --since {since} felhom-controller 2>&1 | grep -E '\\[media\\] wiring|\\[mediawire\\]' | cut -c1-400").strip()
|
||||
|
||||
|
||||
def install(name, values):
|
||||
if w.stack(name).get("deployed"):
|
||||
sys.exit(say(f"{name} is already installed on 9201 — STOP, a household's app is never reused") or 1)
|
||||
code, d = w.ctl("POST", f"/api/stacks/{name}/deploy", {"values": values})
|
||||
say(f" deploy {name} {json.dumps(values)} -> {code} {json.dumps(d, ensure_ascii=False)[:120]}")
|
||||
w.DEPLOYED_THIS_RUN.add(name)
|
||||
for _ in range(90):
|
||||
time.sleep(5)
|
||||
st = w.stack(name)
|
||||
if st.get("deployed") and (st.get("app_config") or {}).get("pinned_images") and st.get("state") == "running":
|
||||
say(f" {name}: deployed, running, pinned={(st.get('app_config') or {}).get('pinned_images')}")
|
||||
return True
|
||||
sys.exit(say(f" {name} never became running — STOP") or 1)
|
||||
|
||||
|
||||
def wait_healthy(c, tries=60):
|
||||
for _ in range(tries):
|
||||
if w.guest(f"docker inspect {c} -f '{{{{.State.Health.Status}}}}'").strip() == "healthy":
|
||||
return True
|
||||
time.sleep(5)
|
||||
return False
|
||||
|
||||
|
||||
def main():
|
||||
w.login()
|
||||
for a in ("prowlarr", "sonarr"):
|
||||
if w.stack(a).get("deployed"):
|
||||
sys.exit(say(f"{a} is installed — STOP") or 1)
|
||||
say("[0] controller: " + w.guest("cat /etc/felhom-controller-image").strip())
|
||||
t0 = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
|
||||
install("sonarr", {"DOMAIN": w.DOMAIN, "SUBDOMAIN": "sonarr", "HDD_PATH": HDD})
|
||||
wait_healthy("sonarr")
|
||||
time.sleep(75)
|
||||
say("[1] wiring after Sonarr came up:\n" + wiring_lines(t0))
|
||||
tP = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
|
||||
install("prowlarr", {"DOMAIN": w.DOMAIN, "SUBDOMAIN": "prowlarr"})
|
||||
wait_healthy("prowlarr")
|
||||
linked = None
|
||||
for i in range(18):
|
||||
time.sleep(10)
|
||||
a = apps()
|
||||
if isinstance(a, list) and any(n == "Sonarr" for n, _, _ in a):
|
||||
linked = (i + 1) * 10
|
||||
say(f"[2] R-1058 Sonarr appeared in Prowlarr's Apps with NO button, ~{linked} s after Prowlarr ran: {a}")
|
||||
break
|
||||
if linked is None:
|
||||
say(f"[2] R-1058 FAILED: no link 180 s after Prowlarr ran; Apps = {apps()}")
|
||||
say("[2] wiring runs since Prowlarr's install:\n" + wiring_lines(tP))
|
||||
RES["linked_after_s"] = linked
|
||||
code, d = w.ctl("POST", "/api/storage/media/wire", {})
|
||||
pr = [r for r in ((d or {}).get("data") or []) if isinstance(r, dict) and r.get("app") == "prowlarr"]
|
||||
say(f"[3] a second run („Bekötés most”) -> {code}; prowlarr result: {json.dumps(pr, ensure_ascii=False)} (expected: unchanged, nothing written)")
|
||||
RES["second_run"] = pr
|
||||
c, full = papi("/applications")
|
||||
for a in (full or []):
|
||||
tc, td = papi("/applications/test", a)
|
||||
say(f"[4] Prowlarr's connection test for {a.get('name')} -> {tc}")
|
||||
for a in ("prowlarr", "sonarr"):
|
||||
c1, _ = w.ctl("POST", f"/api/stacks/{a}/stop")
|
||||
for _ in range(24):
|
||||
time.sleep(5)
|
||||
if w.stack(a).get("state") != "running":
|
||||
break
|
||||
code, d = w.ctl("POST", f"/api/stacks/{a}/remove", {"remove_hdd_data": False, "remove_backups": True})
|
||||
say(f"[X] {a}: remove (keep drive data, drop backups) -> {code} {json.dumps(d, ensure_ascii=False)[:200]}")
|
||||
time.sleep(5)
|
||||
say("[X] left: " + w.guest("echo containers=$(docker ps -aq -f name='^(prowlarr|sonarr)$' | wc -l) volumes=$(docker volume ls -q | grep -cE '^(prowlarr|sonarr)_')").strip())
|
||||
json.dump(RES, open(os.path.join(EV, "link-results.json"), "w"), indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
main()
|
||||
Reference in new issue
Block a user