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
mkdir -p /data/plugins /data/cache /data/backup
# Officially supported variables to split the database from the metadata
export ND_DATAFOLDER="/litefs"
# 1. Set the DataFolder to the host mount (supports mkdir)
export ND_DATAFOLDER="/data"
# 2. Redirect other folders just in case
export ND_CACHEFOLDER="/data/cache"
export ND_BACKUP_PATH="/data/backup"
export ND_PLUGINS_FOLDER="/data/plugins"
# We can still pass the SQLite optimization flags via ND_DBPATH
# but we'll use a relative path so it respects ND_DATAFOLDER
export ND_DBPATH="navidrome.db?cache=shared&_busy_timeout=15000&_journal_mode=WAL&_foreign_keys=on"
# 3. Start Navidrome with an explicit --dbpath flag.
# This is the most authoritative way to set the DB location.
# 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=$!
echo "Navidrome running (PID: $NAVIDROME_PID)"
echo "Navidrome running (PID: $NAVIDROME_PID) with database at /litefs"
}
# Stop Navidrome