diff --git a/scripts/deploy-remote.sh b/scripts/deploy-remote.sh index f26fb2b..6acae9d 100755 --- a/scripts/deploy-remote.sh +++ b/scripts/deploy-remote.sh @@ -935,15 +935,24 @@ deploy_plex() { fi systemctl --user restart plex.service # Readiness gate: /identity answers MediaContainer XML once PMS is up. + # + # HTTPS, NOT HTTP. PMS drops plain HTTP off-loopback: the probe's + # connection arrives on the container's eth0, so an http:// request is + # accepted and then answered with nothing (curl 52, Empty reply) against a + # perfectly healthy server. Measured 2026-10-02 — the gate burned its full + # 600s and failed a plex whose https://127.0.0.1:32400/identity answered + # 200 in 44 ms the whole time. The same law is why the Caddyfile dials the + # plex upstream over TLS (tests/caddyfile.bats pins it). + # -k: PMS presents its own self-signed cert on 32400. + # # Reality check from the 2026-09 cutover: the FIRST container boot of a - # years-old library ran ~10 min (PMS pre-binds 32400 during boot and - # empty-replies until the HTTP layer is ready), so the gate allows 600s. + # years-old library ran ~10 min, so the gate still allows 600s. # Fail the deploy (pending state preserved) rather than mark it deployed blind. for ((i = 1; i <= 120; i++)); do - curl -fsS --max-time 3 http://127.0.0.1:32400/identity >/dev/null && return 0 + curl -fsSk --max-time 3 https://127.0.0.1:32400/identity >/dev/null && return 0 sleep 5 done - echo "FAIL: plex did not answer /identity within 600s" >&2 + echo "FAIL: plex did not answer /identity over HTTPS within 600s" >&2 return 1 }