From 51bb0fdceb0953d2cd9967dd4b85a462ddc6a087 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 31 Mar 2026 08:32:12 +0000 Subject: [PATCH 2/3] Fix maintainerr config lost after restart: use persistent /addon_configs/maintainerr path The entrypoint was setting DATA_DIR="/config" which is NOT a persistent path in HA addon containers using addon_config:rw with init: false. Changed to /addon_configs/maintainerr (the persistent path mapped by addon_config:rw in config.yaml), matching the pattern used by the cleanuparr addon. Agent-Logs-Url: https://github.com/alexbelgium/hassio-addons/sessions/40b7927f-cd03-4b83-a80a-ad56bd6dce32 Co-authored-by: alexbelgium <44178713+alexbelgium@users.noreply.github.com> --- maintainerr/CHANGELOG.md | 3 +++ maintainerr/config.yaml | 2 +- maintainerr/rootfs/ha_entrypoint.sh | 29 +++++++++++++++++++---------- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/maintainerr/CHANGELOG.md b/maintainerr/CHANGELOG.md index 81edfeffd..d16c4f1a2 100644 --- a/maintainerr/CHANGELOG.md +++ b/maintainerr/CHANGELOG.md @@ -1,4 +1,7 @@ +## 3.2.0-2 (2026-03-31) +- Fix configuration lost after container restart by using persistent addon_config directory + ## 3.2.0 (2026-03-28) - Update to latest version from maintainerr/maintainerr (changelog : https://github.com/maintainerr/maintainerr/releases) diff --git a/maintainerr/config.yaml b/maintainerr/config.yaml index 30adc5bda..636cb4860 100644 --- a/maintainerr/config.yaml +++ b/maintainerr/config.yaml @@ -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]" diff --git a/maintainerr/rootfs/ha_entrypoint.sh b/maintainerr/rootfs/ha_entrypoint.sh index ba0dbe693..0ca852ab8 100755 --- a/maintainerr/rootfs/ha_entrypoint.sh +++ b/maintainerr/rootfs/ha_entrypoint.sh @@ -24,17 +24,26 @@ 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. -DATA_DIR="/config" -echo "[Maintainerr] Setting up data directory: $DATA_DIR" -mkdir -p "$DATA_DIR" -# Only chown on first run to avoid slow startup on large directories -if [ ! -f "$DATA_DIR/.initialized" ]; then - chown -R node:node "$DATA_DIR" - touch "$DATA_DIR/.initialized" +# /opt/data is a Docker VOLUME in the upstream image; it is NOT persistent +# across addon updates/reinstalls in HA. Use the addon_config directory +# which is mapped by "addon_config:rw" in config.yaml and survives restarts. +HA_DATA_DIR="/addon_configs/maintainerr" +echo "[Maintainerr] Setting up data directory: $HA_DATA_DIR" +mkdir -p "$HA_DATA_DIR" + +# Copy any seed / initial data from the upstream volume on first run +if [ -d /opt/data ] && [ ! -f "$HA_DATA_DIR/.initialized" ]; then + cp -rn /opt/data/. "$HA_DATA_DIR/" 2>/dev/null || true fi -export DATA_DIR + +# Only chown on first run to avoid slow startup on large directories +if [ ! -f "$HA_DATA_DIR/.initialized" ]; then + chown -R node:node "$HA_DATA_DIR" + touch "$HA_DATA_DIR/.initialized" +fi + +# Tell Maintainerr to use the persistent directory +export DATA_DIR="$HA_DATA_DIR" # ─── Start Maintainerr as unprivileged node user ───────────────────────────── echo "[Maintainerr] Starting application on port ${UI_PORT:-6246}..." From e907952d811bb0c6afaa237d5dabbf2cf4255af0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 31 Mar 2026 08:51:24 +0000 Subject: [PATCH 3/3] =?UTF-8?q?Fix=20maintainerr=20persistence:=20symlink?= =?UTF-8?q?=20/opt/data=20=E2=86=92=20/config=20instead=20of=20wrong=20pat?= =?UTF-8?q?h=20change?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The upstream app hardcodes /opt/data for database and logs. The Docker VOLUME at /opt/data is not persistent across HA addon updates. Symlink /opt/data → /config (persistent via addon_config:rw) so hardcoded paths write to persistent storage. Reverts incorrect /addon_configs path. Agent-Logs-Url: https://github.com/alexbelgium/hassio-addons/sessions/35758465-e22e-40d7-81c8-02d05c375a27 Co-authored-by: alexbelgium <44178713+alexbelgium@users.noreply.github.com> --- maintainerr/CHANGELOG.md | 2 +- maintainerr/rootfs/ha_entrypoint.sh | 32 +++++++++++++++-------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/maintainerr/CHANGELOG.md b/maintainerr/CHANGELOG.md index d16c4f1a2..134ca6ae1 100644 --- a/maintainerr/CHANGELOG.md +++ b/maintainerr/CHANGELOG.md @@ -1,6 +1,6 @@ ## 3.2.0-2 (2026-03-31) -- Fix configuration lost after container restart by using persistent addon_config directory +- 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) diff --git a/maintainerr/rootfs/ha_entrypoint.sh b/maintainerr/rootfs/ha_entrypoint.sh index 0ca852ab8..b782fc602 100755 --- a/maintainerr/rootfs/ha_entrypoint.sh +++ b/maintainerr/rootfs/ha_entrypoint.sh @@ -24,26 +24,28 @@ if [ -d /etc/cont-init.d ]; then fi # ─── Setup persistent data directory ───────────────────────────────────────── -# /opt/data is a Docker VOLUME in the upstream image; it is NOT persistent -# across addon updates/reinstalls in HA. Use the addon_config directory -# which is mapped by "addon_config:rw" in config.yaml and survives restarts. -HA_DATA_DIR="/addon_configs/maintainerr" -echo "[Maintainerr] Setting up data directory: $HA_DATA_DIR" -mkdir -p "$HA_DATA_DIR" +# 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" -# Copy any seed / initial data from the upstream volume on first run -if [ -d /opt/data ] && [ ! -f "$HA_DATA_DIR/.initialized" ]; then - cp -rn /opt/data/. "$HA_DATA_DIR/" 2>/dev/null || true +# 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 "$HA_DATA_DIR/.initialized" ]; then - chown -R node:node "$HA_DATA_DIR" - touch "$HA_DATA_DIR/.initialized" +if [ ! -f "$DATA_DIR/.initialized" ]; then + chown -R node:node "$DATA_DIR" + touch "$DATA_DIR/.initialized" fi - -# Tell Maintainerr to use the persistent directory -export DATA_DIR="$HA_DATA_DIR" +export DATA_DIR # ─── Start Maintainerr as unprivileged node user ───────────────────────────── echo "[Maintainerr] Starting application on port ${UI_PORT:-6246}..."