Merge pull request #2620 from alexbelgium/copilot/fix-configuration-loss-after-restart

Fix maintainerr config lost after container restart
This commit is contained in:
Alexandre
2026-03-31 10:54:00 +02:00
committed by GitHub
3 changed files with 17 additions and 3 deletions

View File

@@ -1,4 +1,7 @@
## 3.2.0-2 (2026-03-31)
- Fix configuration lost after container restart by symlinking /opt/data to persistent /config directory
## 3.2.0 (2026-03-28)
- Update to latest version from maintainerr/maintainerr (changelog : https://github.com/maintainerr/maintainerr/releases)

View File

@@ -87,5 +87,5 @@ schema:
TZ: str?
slug: maintainerr
url: https://github.com/alexbelgium/hassio-addons/tree/master/maintainerr
version: "3.2.0"
version: "3.2.0-2"
webui: "[PROTO:ssl]://[HOST]:[PORT:6246]"

View File

@@ -24,11 +24,22 @@ if [ -d /etc/cont-init.d ]; then
fi
# ─── Setup persistent data directory ─────────────────────────────────────────
# /opt/data is a Docker VOLUME in the upstream image and cannot be removed.
# Maintainerr supports the DATA_DIR env var to redirect data storage.
# The upstream app hardcodes /opt/data for its database and logs
# (typeOrmConfig.ts → /opt/data/maintainerr.sqlite, logs → /opt/data/logs/).
# /opt/data is declared as a Docker VOLUME in the upstream image, which is NOT
# persistent across addon updates/reinstalls in HA.
# Redirect /opt/data → /config (persistent via addon_config:rw) with a symlink.
DATA_DIR="/config"
echo "[Maintainerr] Setting up data directory: $DATA_DIR"
mkdir -p "$DATA_DIR"
# Preserve any seed data from the Docker volume before replacing it
if [ -d /opt/data ] && [ ! -L /opt/data ]; then
cp -rn /opt/data/. "$DATA_DIR/" 2>/dev/null || true
rm -rf /opt/data
fi
ln -sfn "$DATA_DIR" /opt/data
# Only chown on first run to avoid slow startup on large directories
if [ ! -f "$DATA_DIR/.initialized" ]; then
chown -R node:node "$DATA_DIR"