fix: use --dbpath CLI flag to isolate database on LiteFS mount
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 48s

This commit is contained in:
2026-04-27 08:57:19 -07:00
parent 6e7c729c5e
commit 5f9e4d23fb

View File

@@ -84,19 +84,22 @@ start_app() {
# Ensure shared directories exist on persistent host volume # Ensure shared directories exist on persistent host volume
mkdir -p /data/plugins /data/cache /data/backup mkdir -p /data/plugins /data/cache /data/backup
# Officially supported variables to split the database from the metadata # 1. Set the DataFolder to the host mount (supports mkdir)
export ND_DATAFOLDER="/litefs" export ND_DATAFOLDER="/data"
# 2. Redirect other folders just in case
export ND_CACHEFOLDER="/data/cache" export ND_CACHEFOLDER="/data/cache"
export ND_BACKUP_PATH="/data/backup" export ND_BACKUP_PATH="/data/backup"
export ND_PLUGINS_FOLDER="/data/plugins" export ND_PLUGINS_FOLDER="/data/plugins"
# We can still pass the SQLite optimization flags via ND_DBPATH # 3. Start Navidrome with an explicit --dbpath flag.
# but we'll use a relative path so it respects ND_DATAFOLDER # This is the most authoritative way to set the DB location.
export ND_DBPATH="navidrome.db?cache=shared&_busy_timeout=15000&_journal_mode=WAL&_foreign_keys=on" # We include the SQLite connection string for WAL mode and performance.
local DB_STR="/litefs/navidrome.db?cache=shared&_busy_timeout=15000&_journal_mode=WAL&_foreign_keys=on"
/app/navidrome & /app/navidrome --dbpath "$DB_STR" &
NAVIDROME_PID=$! NAVIDROME_PID=$!
echo "Navidrome running (PID: $NAVIDROME_PID)" echo "Navidrome running (PID: $NAVIDROME_PID) with database at /litefs"
} }
# Stop Navidrome # Stop Navidrome