From 538ee01b726b2622551d22e3528170aead1d3fba Mon Sep 17 00:00:00 2001 From: sstent Date: Mon, 27 Apr 2026 08:15:22 -0700 Subject: [PATCH] fix: add SQLite connection parameters to ND_DBPATH and wait for DB file --- entrypoint.sh | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 46a7b15..f4f4330 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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=$!