Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move config file out of /, move cache location #84

Merged
merged 4 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions readme-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -28,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."}
Expand Down
20 changes: 9 additions & 11 deletions root/etc/s6-overlay/s6-rc.d/init-ddclient-config/run
Original file line number Diff line number Diff line change
Expand Up @@ -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/*
2 changes: 1 addition & 1 deletion root/etc/s6-overlay/s6-rc.d/svc-ddclient/run
Original file line number Diff line number Diff line change
Expand Up @@ -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
Roxedus marked this conversation as resolved.
Show resolved Hide resolved
5 changes: 2 additions & 3 deletions root/etc/s6-overlay/s6-rc.d/svc-inotify/run
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@

# 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
lsiown abc:abc /config/ddclient.conf
chmod 600 /config/ddclient.conf
s6-svc -h /run/service/svc-ddclient
echo "ddclient has been restarted"
done