fix: add SQLite connection parameters to ND_DBPATH and wait for DB file
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 43s

This commit is contained in:
2026-04-27 08:15:22 -07:00
parent 25885ea4f0
commit 538ee01b72

View File

@@ -70,9 +70,25 @@ start_app() {
# Ensure shared directories exist on persistent host volume
mkdir -p /data/plugins /data/cache /data/backup
# Explicitly wait for the DB file to appear in the LiteFS mount
local db_file="/litefs/navidrome.db"
local timeout=30
local count=0
echo "Waiting for LiteFS database at ${db_file}..."
while [ ! -f "$db_file" ] && [ $count -lt $timeout ]; do
sleep 1
count=$((count + 1))
done
if [ ! -f "$db_file" ]; then
echo "WARNING: Database file ${db_file} not found after ${timeout}s. LiteFS may still be initializing."
# We continue anyway as Navidrome might create it, but logging this is vital for debugging.
fi
# Tell Navidrome to use the database directly from the LiteFS mount.
# This avoids symlink issues on filesystems that don't support them.
export ND_DBPATH="/litefs/navidrome.db"
# We include standard Navidrome SQLite params for stability.
export ND_DBPATH="${db_file}?cache=shared&_busy_timeout=15000&_journal_mode=WAL&_foreign_keys=on"
/app/navidrome &
NAVIDROME_PID=$!