From 83bbab72a38b6c8a6873c4fb6d5ff5defc02c62d Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Tue, 15 Oct 2024 11:30:12 +0200 Subject: [PATCH] New config logic --- mealie/CHANGELOG.md | 2 ++ mealie/Dockerfile | 2 +- mealie/config.json | 9 +++++---- mealie/rootfs/run.txt | 22 +++++++++++----------- zzz_test/Dockerfile | 2 +- zzz_test/config.json | 7 ++++--- 6 files changed, 24 insertions(+), 20 deletions(-) diff --git a/mealie/CHANGELOG.md b/mealie/CHANGELOG.md index ac668ca28..c4ae5ee86 100644 --- a/mealie/CHANGELOG.md +++ b/mealie/CHANGELOG.md @@ -1,3 +1,5 @@ +- Applied new homeassistant config logic, which will allow in the future all Mealie data to be backuped with the addon. All data (+ config) is moved to /addon_configs/db21ed7f_mealie ; the initial data currently in /homeassistant/addons_config/mealie_data and config in /homeassistant/addons_config/mealie will not be moved but a "migrated" file will be added to those folders to show that migration occured. From now on, only data in /addon_configs/db21ed7f_mealie will be used. + ## v2.0-beta (10-10-2024) - Switched to v2.0 beta, should hopefully solve everyone's issues! diff --git a/mealie/Dockerfile b/mealie/Dockerfile index 52fc10e08..25c88fec1 100644 --- a/mealie/Dockerfile +++ b/mealie/Dockerfile @@ -29,7 +29,7 @@ ENV S6_CMD_WAIT_FOR_SERVICES=1 \ # Correct data path # hadolint ignore=DL4006 -RUN grep -rl "/app/data" /app | xargs sed -i 's|/app/data|/config/addons_config/mealie_data|g' && \ +RUN grep -rl "/app/data" /app | xargs sed -i 's|/app/data|/config|g' && \ sed -i "s|change_user$|# change_user|g" /app/run.sh ################## diff --git a/mealie/config.json b/mealie/config.json index 2de9efa7e..9ea8587a3 100644 --- a/mealie/config.json +++ b/mealie/config.json @@ -65,7 +65,7 @@ "/dev/nvme2" ], "environment": { - "DATA_DIR": "/config/addons_config/mealie_data", + "DATA_DIR": "/config", "DB_ENGINE": "sqlite", "MAX_WORKERS": "1", "WEB_CONCURRENCY": "2", @@ -74,14 +74,15 @@ }, "image": "ghcr.io/alexbelgium/mealie-{arch}", "map": [ - "config:rw", + "addon_config:rw", + "homeassistant_config:rw", "share:rw", "ssl:rw" ], "name": "Mealie", "options": { "ALLOW_SIGNUP": true, - "DATA_DIR": "/config/addons_config/mealie_data", + "DATA_DIR": "/config", "PGID": 1000, "PUID": 1000, "certfile": "fullchain.pem", @@ -109,6 +110,6 @@ "slug": "mealie", "udev": true, "url": "https://github.com/alexbelgium/hassio-addons", - "version": "v2.0-beta", + "version": "v2.0-beta2", "webui": "[PROTO:ssl]://[HOST]:[PORT:9001]" } diff --git a/mealie/rootfs/run.txt b/mealie/rootfs/run.txt index 64714fbd9..65dffae20 100644 --- a/mealie/rootfs/run.txt +++ b/mealie/rootfs/run.txt @@ -35,23 +35,23 @@ done # MIGRATE DATA DIR # #################### -#if [ -d /homeassistant/addons_config/mealie_data ] && [ ! -f /homeassistant/addons_config/mealie_data/migrated ]; then -# bashio::log.warning "Migrating data, current data will not be touched" -# cp -rnf /homeassistant/addons_config/mealie_data/* /config/ || true -# touch /homeassistant/addons_config/mealie_data/migrated -#fi +if [ -d /homeassistant/addons_config/mealie_data ] && [ ! -f /homeassistant/addons_config/mealie_data/migrated ]; then + bashio::log.warning "Migrating data, current data will not be touched" + cp -rnf /homeassistant/addons_config/mealie_data/* /config/ || true + touch /homeassistant/addons_config/mealie_data/migrated +fi -#if [ -f /homeassistant/addons_config/mealie/config.yaml ] && [ ! -f /homeassistant/addons_config/mealie/migrated ]; then -# bashio::log.warning "Migrating config.yaml, current data will not be touched" -# cp -nf /homeassistant/addons_config/mealie/config.yaml /config/ || true -# touch /homeassistant/addons_config/mealie/migrated -#fi +if [ -f /homeassistant/addons_config/mealie/config.yaml ] && [ ! -f /homeassistant/addons_config/mealie/migrated ]; then + bashio::log.warning "Migrating config.yaml, current data will not be touched" + cp -nf /homeassistant/addons_config/mealie/config.yaml /config/ || true + touch /homeassistant/addons_config/mealie/migrated +fi ############### # CONFIG YAML # ############### -CONFIGSOURCE="/config/addons_config/mealie/config.yaml" +CONFIGSOURCE="/config/config.yaml" if [ -f "$CONFIGSOURCE" ]; then bashio::log.info "config.yaml found in $CONFIGSOURCE, exporting variables" diff --git a/zzz_test/Dockerfile b/zzz_test/Dockerfile index a6a7869ba..58bb8f912 100644 --- a/zzz_test/Dockerfile +++ b/zzz_test/Dockerfile @@ -61,7 +61,7 @@ ENV S6_CMD_WAIT_FOR_SERVICES=1 \ # Correct data path # hadolint ignore=DL4006 -RUN grep -rl "/app/data" /app | xargs sed -i 's|/app/data|/config/addons_config/mealie_data|g' && \ +RUN grep -rl "/app/data" /app | xargs sed -i 's|/app/data|/config|g' && \ sed -i "s|change_user$|# change_user|g" /app/run.sh ################## diff --git a/zzz_test/config.json b/zzz_test/config.json index 648de86b6..7d6107fd0 100644 --- a/zzz_test/config.json +++ b/zzz_test/config.json @@ -65,7 +65,7 @@ "/dev/nvme2" ], "environment": { - "DATA_DIR": "/config/addons_config/mealie_data", + "DATA_DIR": "/config", "DB_ENGINE": "sqlite", "MAX_WORKERS": "1", "WEB_CONCURRENCY": "2", @@ -75,7 +75,8 @@ "image": "ghcr.io/alexbelgium/test-{arch}", "ingress": true, "map": [ - "config:rw", + "addon_config:rw", + "homeassistant_config:rw", "share:rw", "ssl:rw" ], @@ -83,7 +84,7 @@ "options": { "ALLOW_SIGNUP": true, "BASE_SUBPATH": "/mealie", - "DATA_DIR": "/config/addons_config/mealie_data", + "DATA_DIR": "/config", "PGID": 1000, "PUID": 1000, "certfile": "fullchain.pem",