diff --git a/entrypoint.sh b/entrypoint.sh index c933f82..378d935 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -16,13 +16,12 @@ PRIMARY_TAGS='["navidrome","web","traefik.enable=true","urlprefix-/navidrome","t # Check if this node is the LiteFS Primary # LiteFS 0.5 status API returns a flat object: {"isPrimary": true, ...} check_primary() { - local status=$(curl -s http://localhost:20202/info || echo "{\"error\": \"curl failed\"}") + local status=$(curl -s http://localhost:20202/info || echo "{}") local is_primary=$(echo "$status" | jq -r 'if type == "object" then (.isPrimary // false) else false end' 2>/dev/null || echo "false") if [ "$is_primary" = "true" ]; then return 0 # We are the primary fi - echo "check_primary: Not primary. Status: $status" return 1 # We are a replica } @@ -130,15 +129,15 @@ while true; do # === WE ARE PRIMARY === if [ "${NAVIDROME_PID}" -eq 0 ] || ! kill -0 "${NAVIDROME_PID}" 2>/dev/null; then start_app - # register_service + register_service fi - # pass_ttl + pass_ttl else # === WE ARE REPLICA === if [ "${NAVIDROME_PID}" -gt 0 ]; then echo "Lost leadership. Demoting..." stop_app - # deregister_service + deregister_service fi fi sleep 10