From de953e57b3af75a487791e4cab0d96a7830c10cb Mon Sep 17 00:00:00 2001 From: Robbie1977 Date: Wed, 26 Aug 2026 11:01:17 +0000 Subject: [PATCH 1/2] Fix CI: probe /status over 127.0.0.1 and sanitise branch image tags BusyBox wget resolves localhost to ::1 first and nginx only listens on IPv4, so the /status probe was refused. Branch names containing a slash (feature/x) are not valid Docker tags; map the slash to a dash. --- .github/workflows/docker.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 716b9f5..51d7a21 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -22,6 +22,8 @@ jobs: else TAG=${GITHUB_REF#refs/heads/} fi + # A branch like feature/x is not a valid image tag; use feature-x. + TAG=${TAG//\//-} echo "tag=$TAG" >> $GITHUB_OUTPUT - name: Test NGINX configuration @@ -83,7 +85,8 @@ jobs: fi docker logs test-container | grep -q 'Scheduled cache backup: crontab' || { echo "backup not scheduled"; docker logs test-container; exit 1; } docker exec test-container test -f /var/cache/nginx/owlery/0/00/00000000000000000000000000000001 || { echo "archive entry not restored"; docker logs test-container; exit 1; } - docker exec test-container wget -q -O - http://localhost/status | grep -q '"restore": {' || { echo "/status lacks archive.restore"; docker exec test-container wget -q -O - http://localhost/status; exit 1; } + # 127.0.0.1, not localhost: BusyBox wget resolves localhost to ::1 first and nginx listens on IPv4 only. + docker exec test-container wget -q -O - http://127.0.0.1/status | grep -q '"restore": {' || { echo "/status lacks archive.restore"; docker exec test-container wget -q -O - http://127.0.0.1/status; exit 1; } docker exec test-container cache-backup.sh --full | grep -q 'backup: done' || { echo "manual backup failed"; exit 1; } docker stop test-container || true docker rm test-container From f901616c7f756dae048b71a14901ba71fe1f0346 Mon Sep 17 00:00:00 2001 From: Robbie1977 Date: Wed, 26 Aug 2026 11:03:36 +0000 Subject: [PATCH 2/2] Fix /status nesting indent and check restore state in CI The embedded restore/backup objects had their opening brace indented along with the body, so the key line read '"restore": {'. Indent every line but the first. The CI probe now also asserts the restore reached state done. --- .github/workflows/docker.yml | 2 +- health-monitor.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 51d7a21..cf59a06 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -86,7 +86,7 @@ jobs: docker logs test-container | grep -q 'Scheduled cache backup: crontab' || { echo "backup not scheduled"; docker logs test-container; exit 1; } docker exec test-container test -f /var/cache/nginx/owlery/0/00/00000000000000000000000000000001 || { echo "archive entry not restored"; docker logs test-container; exit 1; } # 127.0.0.1, not localhost: BusyBox wget resolves localhost to ::1 first and nginx listens on IPv4 only. - docker exec test-container wget -q -O - http://127.0.0.1/status | grep -q '"restore": {' || { echo "/status lacks archive.restore"; docker exec test-container wget -q -O - http://127.0.0.1/status; exit 1; } + docker exec test-container wget -q -O - http://127.0.0.1/status | grep -q '"restore": {' && docker exec test-container wget -q -O - http://127.0.0.1/status | grep -q '"state": "done"' || { echo "/status lacks archive.restore"; docker exec test-container wget -q -O - http://127.0.0.1/status; exit 1; } docker exec test-container cache-backup.sh --full | grep -q 'backup: done' || { echo "manual backup failed"; exit 1; } docker stop test-container || true docker rm test-container diff --git a/health-monitor.sh b/health-monitor.sh index 34c7624..6bb1fc5 100644 --- a/health-monitor.sh +++ b/health-monitor.sh @@ -62,7 +62,8 @@ CACHE_BACKUP_STATE=${CACHE_BACKUP_STATE:-$STATUS_DIR/cache-backup.json} # when that job has not run in this container yet. json_state_or_null() { if [ -s "$1" ]; then - sed 's/^/ /' "$1" + # Indent every line but the first, which follows the key on its own line. + sed '1!s/^/ /' "$1" else printf 'null' fi