debug(entrypoint): add logging to check_primary
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 40s
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 40s
This commit is contained in:
@@ -16,12 +16,13 @@ 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 "{}")
|
||||
local status=$(curl -s http://localhost:20202/info || echo "{\"error\": \"curl failed\"}")
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user