fix: use bind mount for DB to support SMB shares
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 47s
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 47s
This commit is contained in:
@@ -99,20 +99,21 @@ start_app() {
|
|||||||
# Ensure shared directories exist
|
# Ensure shared directories exist
|
||||||
mkdir -p /shared_data/plugins /shared_data/cache /shared_data/backup /shared_data/artist_images
|
mkdir -p /shared_data/plugins /shared_data/cache /shared_data/backup /shared_data/artist_images
|
||||||
|
|
||||||
# Create symlink for the DB so Navidrome finds it in its DataFolder
|
# Bind mount the DB so Navidrome finds it in its DataFolder
|
||||||
# We do this every time to ensure it points to the correct LiteFS mount
|
# We use bind mount because /shared_data is likely SMB and doesn't support symlinks
|
||||||
ln -sf /data/navidrome.db /shared_data/navidrome.db
|
touch /shared_data/navidrome.db
|
||||||
|
mount --bind /data/navidrome.db /shared_data/navidrome.db
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
export ND_DATAFOLDER="/shared_data"
|
export ND_DATAFOLDER="/shared_data"
|
||||||
export ND_CACHEFOLDER="/shared_data/cache"
|
export ND_CACHEFOLDER="/shared_data/cache"
|
||||||
export ND_BACKUP_PATH="/shared_data/backup"
|
export ND_BACKUP_PATH="/shared_data/backup"
|
||||||
export ND_PLUGINS_FOLDER="/shared_data/plugins"
|
export ND_PLUGINS_FOLDER="/shared_data/plugins"
|
||||||
export ND_ARTISTIMAGEFOLDER="artist_images" # This is a folder NAME within each artist folder
|
export ND_ARTISTIMAGEFOLDER="artist_images"
|
||||||
|
|
||||||
/app/navidrome &
|
/app/navidrome &
|
||||||
NAVIDROME_PID=$!
|
NAVIDROME_PID=$!
|
||||||
echo "Navidrome running (PID: $NAVIDROME_PID) with data folder at /shared_data (DB symlinked to /data)"
|
echo "Navidrome running (PID: $NAVIDROME_PID) with data folder at /shared_data (DB bind-mounted to /data)"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Stop Navidrome
|
# Stop Navidrome
|
||||||
@@ -122,6 +123,7 @@ stop_app() {
|
|||||||
kill -SIGTERM "${NAVIDROME_PID}"
|
kill -SIGTERM "${NAVIDROME_PID}"
|
||||||
wait "${NAVIDROME_PID}" 2>/dev/null || true
|
wait "${NAVIDROME_PID}" 2>/dev/null || true
|
||||||
NAVIDROME_PID=0
|
NAVIDROME_PID=0
|
||||||
|
umount /shared_data/navidrome.db 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user