library: BIND_ADDR for loopback-only mode, real readiness check
- BIND_ADDR (default 0.0.0.0) on every published port; 127.0.0.1 keeps the stack reachable from the host only (Docker bypasses ufw, so this is the actual control the kiosk addon's 'this kiosk only' choice uses) - Koha serves its web-installer page with HTTP 200 before the database exists, so 'port answers' was not 'ready': the entrypoint now writes /run/koha-ready, the healthcheck requires it, and install.sh waits for healthy + the quick-add health endpoint Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013wi3ZSot4XbUViwRFgLpRf
This commit is contained in:
+8
-3
@@ -100,6 +100,7 @@ TZ=${TZ_NOW}
|
||||
OPAC_PORT=$(free_port "${OPAC_PORT:-8080}")
|
||||
STAFF_PORT=$(free_port "${STAFF_PORT:-8081}")
|
||||
QUICKADD_PORT=$(free_port "${QUICKADD_PORT:-8082}")
|
||||
BIND_ADDR=${BIND_ADDR:-0.0.0.0}
|
||||
ADMIN_USER=admin
|
||||
ADMIN_PASSWORD=$(rand 16)
|
||||
DB_ROOT_PASSWORD=$(rand 32)
|
||||
@@ -114,6 +115,9 @@ else
|
||||
if ! grep -q '^QUICKADD_PORT=' .env; then
|
||||
echo "QUICKADD_PORT=$(free_port 8082)" >> .env
|
||||
fi
|
||||
if ! grep -q '^BIND_ADDR=' .env; then
|
||||
echo "BIND_ADDR=${BIND_ADDR:-0.0.0.0}" >> .env
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "${EXTRA_CA:-}" ]; then
|
||||
@@ -131,9 +135,10 @@ with_retry dc up -d
|
||||
# --- Wait until the site answers ---------------------------------------------------
|
||||
# shellcheck disable=SC1091
|
||||
. ./.env
|
||||
c_info "First start installs the database - waiting for the staff interface..."
|
||||
for i in $(seq 1 120); do
|
||||
if curl -fsS -o /dev/null "http://127.0.0.1:$STAFF_PORT/" 2>/dev/null; then READY=1; break; fi
|
||||
c_info "First start installs the database - waiting until Koha reports healthy..."
|
||||
for i in $(seq 1 180); do
|
||||
health="$(docker inspect -f '{{if .State.Health}}{{.State.Health.Status}}{{else}}none{{end}}' library-koha 2>/dev/null || echo missing)"
|
||||
if [ "$health" = healthy ] && curl -fsS -o /dev/null -m 5 "http://127.0.0.1:${QUICKADD_PORT:-8082}/healthz" 2>/dev/null; then READY=1; break; fi
|
||||
# One restart is tolerated (Docker's restart policy); a crash loop is not.
|
||||
if [ "$(docker inspect -f '{{.RestartCount}}' library-koha 2>/dev/null || echo 99)" -ge 3 ]; then
|
||||
c_err "library-koha keeps crashing - see: docker logs library-koha"; exit 1
|
||||
|
||||
Reference in New Issue
Block a user