fix: implement http health-check responder for primary routing
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 57s
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 57s
This commit is contained in:
11
litefs.yml
11
litefs.yml
@@ -8,14 +8,14 @@ data:
|
||||
# Use Consul for leader election
|
||||
lease:
|
||||
type: "consul"
|
||||
advertise-url: "http://${ADVERTISE_IP}:20202"
|
||||
advertise-url: "http://${ADVERTISE_IP}:8081"
|
||||
consul:
|
||||
url: "${CONSUL_URL}"
|
||||
key: "litefs/navidrome"
|
||||
|
||||
# Internal HTTP API for replication
|
||||
http:
|
||||
addr: ":20202"
|
||||
addr: "0.0.0.0:8081"
|
||||
|
||||
# The HTTP Proxy routes traffic to handle write-forwarding
|
||||
# It listens on 8080 inside the container.
|
||||
@@ -31,4 +31,9 @@ proxy:
|
||||
- "*.jpg"
|
||||
- "*.jpeg"
|
||||
- "*.gif"
|
||||
- "*.svg"
|
||||
- "*.svg"
|
||||
|
||||
# Commands to run only on the primary node.
|
||||
# This serves as a primary-only health check responder.
|
||||
exec:
|
||||
- cmd: "while true; do echo -e 'HTTP/1.1 200 OK\r\nContent-Length: 7\r\n\r\nPrimary' | nc -l -p 8082; done"
|
||||
|
||||
@@ -31,6 +31,10 @@ job "navidrome-litefs" {
|
||||
static = 20202
|
||||
to = 20202 # Maps host 20202 to container 20202 (LiteFS Replication)
|
||||
}
|
||||
port "health" {
|
||||
static = 8082
|
||||
to = 8082 # Handled by nc loop in litefs.yml exec
|
||||
}
|
||||
}
|
||||
|
||||
task "navidrome" {
|
||||
@@ -39,10 +43,8 @@ job "navidrome-litefs" {
|
||||
config {
|
||||
image = "gitea.service.dc1.fbleagh.duckdns.org/sstent/navidrome-litefs:latest"
|
||||
privileged = true # Still needed for FUSE
|
||||
ports = ["http", "litefs"]
|
||||
ports = ["http", "litefs", "health"]
|
||||
|
||||
# Removed network_mode = "host"
|
||||
|
||||
volumes = [
|
||||
"/mnt/configs/navidrome_litefs:/var/lib/litefs",
|
||||
"/mnt/Public/configs/navidrome:/shared_data",
|
||||
@@ -56,7 +58,7 @@ job "navidrome-litefs" {
|
||||
# LiteFS Config
|
||||
CONSUL_URL = "http://${attr.unique.network.ip-address}:8500"
|
||||
ADVERTISE_IP = "${attr.unique.network.ip-address}"
|
||||
PORT = "8080" # Internal proxy port
|
||||
PORT = "8080" # Internal proxy port (unused by direct routing but kept for image compat)
|
||||
|
||||
# Navidrome Config
|
||||
ND_DATAFOLDER = "/local/data"
|
||||
@@ -89,9 +91,9 @@ job "navidrome-litefs" {
|
||||
port = "http"
|
||||
|
||||
check {
|
||||
type = "script"
|
||||
command = "/usr/local/bin/litefs"
|
||||
args = ["is-primary"]
|
||||
type = "http"
|
||||
port = "health"
|
||||
path = "/"
|
||||
interval = "10s"
|
||||
timeout = "2s"
|
||||
}
|
||||
@@ -103,4 +105,4 @@ job "navidrome-litefs" {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user