From 3de864a18158136891985377a6a0f3a59d4dc738 Mon Sep 17 00:00:00 2001 From: thespad Date: Tue, 2 Jul 2024 20:53:17 +0100 Subject: [PATCH 1/4] Move config file out of /, move cache location --- .../s6-rc.d/init-ddclient-config/run | 20 +++++++++---------- root/etc/s6-overlay/s6-rc.d/svc-ddclient/run | 2 +- root/etc/s6-overlay/s6-rc.d/svc-inotify/run | 4 +--- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/root/etc/s6-overlay/s6-rc.d/init-ddclient-config/run b/root/etc/s6-overlay/s6-rc.d/init-ddclient-config/run index 3a386d9..20df9f0 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-ddclient-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-ddclient-config/run @@ -3,25 +3,23 @@ # make our folders mkdir -p \ - /var/cache/ddclient \ - /var/run/ddclient + /run/ddclient-cache \ + /run/ddclient # copy default config if not present in /config if [[ ! -e /config/ddclient.conf ]]; then cp /defaults/ddclient.conf /config fi -# copy config from /config to root -cp /config/ddclient.conf /ddclient.conf - # permissions lsiown -R abc:abc \ /config \ - /var/cache/ddclient \ - /var/run/ddclient \ - /ddclient.conf + /run/ddclient \ + /run/ddclient-cache + +chmod 700 \ + /config \ + /run/ddclient-cache -chmod 700 /config chmod 600 \ - /config/* \ - /ddclient.conf + /config/* diff --git a/root/etc/s6-overlay/s6-rc.d/svc-ddclient/run b/root/etc/s6-overlay/s6-rc.d/svc-ddclient/run index d3f9e86..451ed06 100755 --- a/root/etc/s6-overlay/s6-rc.d/svc-ddclient/run +++ b/root/etc/s6-overlay/s6-rc.d/svc-ddclient/run @@ -2,4 +2,4 @@ # shellcheck shell=bash exec \ - s6-setuidgid abc /usr/bin/ddclient -foreground -file /ddclient.conf + s6-setuidgid abc /usr/bin/ddclient --foreground --file /config/ddclient.conf --cache /run/ddclient-cache diff --git a/root/etc/s6-overlay/s6-rc.d/svc-inotify/run b/root/etc/s6-overlay/s6-rc.d/svc-inotify/run index 8d36cf4..cb3c455 100755 --- a/root/etc/s6-overlay/s6-rc.d/svc-inotify/run +++ b/root/etc/s6-overlay/s6-rc.d/svc-inotify/run @@ -3,9 +3,7 @@ # starting inotify to watch /config/ddclient.conf and restart ddclient if changed. while inotifywait -e modify /config/ddclient.conf; do - cp /config/ddclient.conf /ddclient.conf - lsiown abc:abc /ddclient.conf - chmod 600 /ddclient.conf + chmod 600 /config/ddclient.conf s6-svc -h /run/service/svc-ddclient echo "ddclient has been restarted" done From 7d1e676616295bed235385801b6e37a37f7ea12c Mon Sep 17 00:00:00 2001 From: thespad Date: Tue, 2 Jul 2024 20:54:41 +0100 Subject: [PATCH 2/4] Update readme --- readme-vars.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/readme-vars.yml b/readme-vars.yml index d7fb3ec..c6ed7e7 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -16,6 +16,11 @@ param_container_name: "{{ project_name }}" param_usage_include_vols: true param_volumes: - { vol_path: "/config", vol_host_path: "/path/to/{{ project_name }}/config", desc: "Persistent config files" } + +readonly_supported: true +readonly_message: | + `/tmp` must also be mounted to tmpfs for this image. + # application setup block app_setup_block_enabled: true app_setup_block: | From ba309a2673daaa9f1affe428e85d50c66cf911c0 Mon Sep 17 00:00:00 2001 From: thespad Date: Tue, 2 Jul 2024 20:55:47 +0100 Subject: [PATCH 3/4] chown config for safety --- root/etc/s6-overlay/s6-rc.d/svc-inotify/run | 1 + 1 file changed, 1 insertion(+) diff --git a/root/etc/s6-overlay/s6-rc.d/svc-inotify/run b/root/etc/s6-overlay/s6-rc.d/svc-inotify/run index cb3c455..a41f448 100755 --- a/root/etc/s6-overlay/s6-rc.d/svc-inotify/run +++ b/root/etc/s6-overlay/s6-rc.d/svc-inotify/run @@ -3,6 +3,7 @@ # starting inotify to watch /config/ddclient.conf and restart ddclient if changed. while inotifywait -e modify /config/ddclient.conf; do + lsiown abc:abc /config/ddclient.conf chmod 600 /config/ddclient.conf s6-svc -h /run/service/svc-ddclient echo "ddclient has been restarted" From 0177e45f3381b0bb58a24d771a22c67ee4736296 Mon Sep 17 00:00:00 2001 From: thespad Date: Mon, 8 Jul 2024 16:11:01 +0100 Subject: [PATCH 4/4] Add changelog entry --- readme-vars.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/readme-vars.yml b/readme-vars.yml index c6ed7e7..afa1736 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -33,6 +33,7 @@ app_setup_block: | ```` # changelog changelogs: + - {date: "08.07.24:", desc: "Don't copy config from `/config/ddclient.conf` to `/ddclient.conf` at runtime."} - {date: "27.06.24:", desc: "Rebase to Alpine 3.20."} - {date: "23.12.23:", desc: "Rebase to Alpine 3.19."} - {date: "25.08.23:", desc: "Rebase to Alpine 3.18."}