fix(filebrowser_quantum): follow the v2 migration guide and upstream healthcheck

Set migrateFrom only until the SQLite database exists, set
http.trustProxyHeaders for the nginx subpath, and check upstream's
${baseURL}health endpoint instead of an nginx-only stub.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
alexbelgium
2026-10-11 07:17:37 +02:00
parent 7638c594b0
commit 28afa07729
4 changed files with 7 additions and 13 deletions

View File

@@ -1,6 +1,7 @@
## 2.0.0.1 (2026-10-11)
- Fix startup on 2.0.0 (fresh installs and upgrades): write the v2 config format (`http.port`/`listen`/`baseURL`, `server.database.path`) and drop the deprecated `FILEBROWSER_DATABASE` variable (#3109) - Upgrade from 1.x: the old `/config/config.yaml` is saved as `config.yaml.v1.bak` and replaced by the 2.0 default (1.x keys are rejected by 2.0), and the 1.x `/config/database.db` is migrated to `/config/database.sqlite` on first start
- Set `http.trustProxyHeaders: true` (the add-on always runs behind nginx on a subpath), and use upstream's `/health` endpoint for the container healthcheck
## 2.0.0 (2026-10-10)
- Update to latest version from gtsteffaniak/filebrowser (changelog : https://github.com/gtsteffaniak/filebrowser/releases)

View File

@@ -116,4 +116,4 @@ LABEL \
#################
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
CMD curl -f http://localhost:3001/health || exit 1
CMD b="$(yq '.http.baseURL' /config/config.yaml)" && curl -f "http://localhost:8080${b%/}/health" || exit 1

View File

@@ -79,8 +79,7 @@ mkdir -p /var/log/nginx && touch /var/log/nginx/error.log
mkdir -p /config /cache
# A 1.x config (string server.database, written below before 2.0.0) holds keys
# that v2 rejects: keep a copy and start again from the v2 default
# 1.x config (string server.database) has keys v2 rejects: back it up, use the v2 default
if [ -f "$FILEBROWSER_CONFIG" ] && [ "$(yq e '.server.database | tag' "$FILEBROWSER_CONFIG")" = "!!str" ]; then
bashio::log.warning "FileBrowser 1.x config saved to ${FILEBROWSER_CONFIG}.v1.bak, starting from the 2.0 default config"
mv "$FILEBROWSER_CONFIG" "${FILEBROWSER_CONFIG}.v1.bak"
@@ -97,9 +96,11 @@ bashio::log.info "Updating FileBrowser config..."
bashio::log.info "... set server"
yq e -i ".http.port = 8080" "$FILEBROWSER_CONFIG"
yq e -i ".http.listen = \"0.0.0.0\"" "$FILEBROWSER_CONFIG"
yq e -i ".http.trustProxyHeaders = true" "$FILEBROWSER_CONFIG"
# Whole-object assignment also drops migrateFrom once the migration is done
yq e -i ".server.database = {\"path\": \"/config/database.sqlite\"}" "$FILEBROWSER_CONFIG"
# Migrate the 1.x BoltDB on first start (done once; v2 keeps checking the file exists)
if [ -s /config/database.db ]; then
# Import the 1.x BoltDB until the SQLite database exists
if [ -s /config/database.db ] && [ ! -s /config/database.sqlite ]; then
yq e -i ".server.database.migrateFrom = \"/config/database.db\"" "$FILEBROWSER_CONFIG"
fi
yq e -i ".server.cacheDir = \"/cache\"" "$FILEBROWSER_CONFIG"

View File

@@ -1,8 +0,0 @@
server {
listen 127.0.0.1:3001;
access_log off;
location /health {
return 200 'OK';
}
}