fix: relocate LiteFS mount to /litefs and use /data for persistent artwork
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 4m5s
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 4m5s
This commit is contained in:
@@ -18,6 +18,9 @@ RUN chmod +x /usr/local/bin/entrypoint.sh
|
|||||||
# Copy LiteFS configuration
|
# Copy LiteFS configuration
|
||||||
COPY litefs.yml /etc/litefs.yml
|
COPY litefs.yml /etc/litefs.yml
|
||||||
|
|
||||||
|
# Create mount points and data directories
|
||||||
|
RUN mkdir -p /litefs /data
|
||||||
|
|
||||||
# LiteFS becomes the supervisor.
|
# LiteFS becomes the supervisor.
|
||||||
|
|
||||||
# It will mount the FUSE fs and then execute the command defined in litefs.yml's exec section.
|
# It will mount the FUSE fs and then execute the command defined in litefs.yml's exec section.
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ SERVICE_ID="${SERVICE_NAME}-${NOMAD_ALLOC_ID:-$(hostname)}"
|
|||||||
PORT=4533
|
PORT=4533
|
||||||
CONSUL_HTTP_ADDR="${CONSUL_URL:-http://localhost:8500}"
|
CONSUL_HTTP_ADDR="${CONSUL_URL:-http://localhost:8500}"
|
||||||
NODE_IP="${ADVERTISE_IP}"
|
NODE_IP="${ADVERTISE_IP}"
|
||||||
DB_LOCK_FILE="/data/.primary"
|
DB_LOCK_FILE="/litefs/.primary"
|
||||||
NAVIDROME_PID=0
|
NAVIDROME_PID=0
|
||||||
|
|
||||||
# Tags for the Primary service (Traefik enabled)
|
# Tags for the Primary service (Traefik enabled)
|
||||||
@@ -16,9 +16,21 @@ PRIMARY_TAGS='["navidrome","web","traefik.enable=true","urlprefix-/navidrome","t
|
|||||||
|
|
||||||
# --- Helper Functions ---
|
# --- Helper Functions ---
|
||||||
|
|
||||||
|
# Ensure Navidrome's data directory exists and has the database symlinked to LiteFS
|
||||||
|
setup_data_dir() {
|
||||||
|
echo "Setting up Navidrome data directory..."
|
||||||
|
mkdir -p /data
|
||||||
|
# Symlink the database and its sidecar files to the LiteFS mount.
|
||||||
|
# This ensures SQLite writes go through LiteFS while Navidrome can still
|
||||||
|
# create subdirectories (like /data/artwork) on the persistent host volume.
|
||||||
|
ln -sf /litefs/navidrome.db /data/navidrome.db
|
||||||
|
ln -sf /litefs/navidrome.db-wal /data/navidrome.db-wal
|
||||||
|
ln -sf /litefs/navidrome.db-shm /data/navidrome.db-shm
|
||||||
|
}
|
||||||
|
|
||||||
# Backup Database (Only on Primary)
|
# Backup Database (Only on Primary)
|
||||||
run_backup() {
|
run_backup() {
|
||||||
local backup_dir="/shared_data/backup"
|
local backup_dir="/data/backup"
|
||||||
local timestamp=$(date +%Y%m%d_%H%M%S)
|
local timestamp=$(date +%Y%m%d_%H%M%S)
|
||||||
local backup_file="${backup_dir}/navidrome.db_${timestamp}.bak"
|
local backup_file="${backup_dir}/navidrome.db_${timestamp}.bak"
|
||||||
|
|
||||||
@@ -68,7 +80,7 @@ start_app() {
|
|||||||
echo "Node is Primary. Starting Navidrome..."
|
echo "Node is Primary. Starting Navidrome..."
|
||||||
|
|
||||||
# Ensure shared directories exist
|
# Ensure shared directories exist
|
||||||
mkdir -p /shared_data/plugins /shared_data/cache /shared_data/backup
|
mkdir -p /data/plugins /data/cache /data/backup
|
||||||
|
|
||||||
/app/navidrome &
|
/app/navidrome &
|
||||||
NAVIDROME_PID=$!
|
NAVIDROME_PID=$!
|
||||||
@@ -99,6 +111,7 @@ trap cleanup TERM INT
|
|||||||
# --- Main Loop ---
|
# --- Main Loop ---
|
||||||
|
|
||||||
echo "Starting Supervisor. Waiting for leadership settle..."
|
echo "Starting Supervisor. Waiting for leadership settle..."
|
||||||
|
setup_data_dir
|
||||||
echo "Node IP: $NODE_IP"
|
echo "Node IP: $NODE_IP"
|
||||||
echo "Consul: $CONSUL_HTTP_ADDR"
|
echo "Consul: $CONSUL_HTTP_ADDR"
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# LiteFS configuration for Navidrome
|
# LiteFS configuration for Navidrome
|
||||||
fuse:
|
fuse:
|
||||||
dir: "/data"
|
dir: "/litefs"
|
||||||
|
|
||||||
data:
|
data:
|
||||||
dir: "/var/lib/litefs"
|
dir: "/var/lib/litefs"
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ job "navidrome-litefs" {
|
|||||||
|
|
||||||
volumes = [
|
volumes = [
|
||||||
"/mnt/configs/navidrome_litefs:/var/lib/litefs",
|
"/mnt/configs/navidrome_litefs:/var/lib/litefs",
|
||||||
"/mnt/Public/configs/navidrome:/shared_data",
|
"/mnt/Public/configs/navidrome:/data",
|
||||||
"/mnt/Public/Downloads/Clean_Music:/music/CleanMusic:ro",
|
"/mnt/Public/Downloads/Clean_Music:/music/CleanMusic:ro",
|
||||||
"/mnt/Public/Downloads/news/slskd/downloads:/music/slskd:ro",
|
"/mnt/Public/Downloads/news/slskd/downloads:/music/slskd:ro",
|
||||||
"/mnt/Public/Downloads/incoming_music:/music/incomingmusic:ro"
|
"/mnt/Public/Downloads/incoming_music:/music/incomingmusic:ro"
|
||||||
@@ -63,10 +63,10 @@ job "navidrome-litefs" {
|
|||||||
PORT = "8080" # Internal proxy port (unused but kept)
|
PORT = "8080" # Internal proxy port (unused but kept)
|
||||||
|
|
||||||
# Navidrome Config
|
# Navidrome Config
|
||||||
ND_DATAFOLDER = "/data"
|
ND_DATAFOLDER = "/data"
|
||||||
ND_PLUGINS_FOLDER = "/shared_data/plugins"
|
ND_PLUGINS_FOLDER = "/data/plugins"
|
||||||
ND_CACHEFOLDER = "/shared_data/cache"
|
ND_CACHEFOLDER = "/data/cache"
|
||||||
ND_BACKUP_PATH = "/shared_data/backup"
|
ND_BACKUP_PATH = "/data/backup"
|
||||||
ND_BACKUPSCHEDULE = ""
|
ND_BACKUPSCHEDULE = ""
|
||||||
|
|
||||||
ND_SCANSCHEDULE = "0"
|
ND_SCANSCHEDULE = "0"
|
||||||
|
|||||||
Reference in New Issue
Block a user