From ce9f9b6c12db7bdc75fa29148df562daf733ac00 Mon Sep 17 00:00:00 2001 From: mrhotio <26902309+mrhotio@users.noreply.github.com> Date: Sun, 27 Aug 2023 21:01:01 +0200 Subject: [PATCH] s6 v3 --- linux-amd64.Dockerfile | 1 - linux-arm64.Dockerfile | 1 - .../s6-rc.d/perms/dependencies.d/base | 0 root/etc/s6-overlay/s6-rc.d/perms/type | 1 + root/etc/s6-overlay/s6-rc.d/perms/up | 1 + .../s6-rc.d/secrets/dependencies.d/perms | 0 root/etc/s6-overlay/s6-rc.d/secrets/run | 19 +++++++++++++++++++ root/etc/s6-overlay/s6-rc.d/secrets/type | 1 + root/etc/s6-overlay/s6-rc.d/secrets/up | 1 + .../s6-rc.d/service1/dependencies.d/setup | 0 .../s6-rc.d/service1}/run | 0 root/etc/s6-overlay/s6-rc.d/service1/type | 1 + .../s6-rc.d/setup/dependencies.d/secrets | 0 .../s6-rc.d/setup/run} | 0 root/etc/s6-overlay/s6-rc.d/setup/type | 1 + root/etc/s6-overlay/s6-rc.d/setup/up | 1 + .../s6-rc.d/user/contents.d/service1 | 0 17 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 root/etc/s6-overlay/s6-rc.d/perms/dependencies.d/base create mode 100644 root/etc/s6-overlay/s6-rc.d/perms/type create mode 100644 root/etc/s6-overlay/s6-rc.d/perms/up create mode 100644 root/etc/s6-overlay/s6-rc.d/secrets/dependencies.d/perms create mode 100644 root/etc/s6-overlay/s6-rc.d/secrets/run create mode 100644 root/etc/s6-overlay/s6-rc.d/secrets/type create mode 100644 root/etc/s6-overlay/s6-rc.d/secrets/up create mode 100644 root/etc/s6-overlay/s6-rc.d/service1/dependencies.d/setup rename root/etc/{services.d/overseerr => s6-overlay/s6-rc.d/service1}/run (100%) create mode 100644 root/etc/s6-overlay/s6-rc.d/service1/type create mode 100644 root/etc/s6-overlay/s6-rc.d/setup/dependencies.d/secrets rename root/etc/{cont-init.d/00-start-container => s6-overlay/s6-rc.d/setup/run} (100%) create mode 100644 root/etc/s6-overlay/s6-rc.d/setup/type create mode 100644 root/etc/s6-overlay/s6-rc.d/setup/up create mode 100644 root/etc/s6-overlay/s6-rc.d/user/contents.d/service1 diff --git a/linux-amd64.Dockerfile b/linux-amd64.Dockerfile index d94765436..ce062838f 100644 --- a/linux-amd64.Dockerfile +++ b/linux-amd64.Dockerfile @@ -31,4 +31,3 @@ RUN curl -fsSL "https://github.com/sct/overseerr/archive/${VERSION}.tar.gz" | ta chmod -R u=rwX,go=rX "${APP_DIR}" COPY root/ / -RUN chmod -R +x /etc/cont-init.d/ /etc/services.d/ diff --git a/linux-arm64.Dockerfile b/linux-arm64.Dockerfile index 9fc92d623..b832f2d6d 100644 --- a/linux-arm64.Dockerfile +++ b/linux-arm64.Dockerfile @@ -31,4 +31,3 @@ RUN curl -fsSL "https://github.com/sct/overseerr/archive/${VERSION}.tar.gz" | ta chmod -R u=rwX,go=rX "${APP_DIR}" COPY root/ / -RUN chmod -R +x /etc/cont-init.d/ /etc/services.d/ diff --git a/root/etc/s6-overlay/s6-rc.d/perms/dependencies.d/base b/root/etc/s6-overlay/s6-rc.d/perms/dependencies.d/base new file mode 100644 index 000000000..e69de29bb diff --git a/root/etc/s6-overlay/s6-rc.d/perms/type b/root/etc/s6-overlay/s6-rc.d/perms/type new file mode 100644 index 000000000..bdd22a185 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/perms/type @@ -0,0 +1 @@ +oneshot diff --git a/root/etc/s6-overlay/s6-rc.d/perms/up b/root/etc/s6-overlay/s6-rc.d/perms/up new file mode 100644 index 000000000..942b5537c --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/perms/up @@ -0,0 +1 @@ +find /etc/s6-overlay/s6-rc.d -name "run" -execdir chmod +x {} + diff --git a/root/etc/s6-overlay/s6-rc.d/secrets/dependencies.d/perms b/root/etc/s6-overlay/s6-rc.d/secrets/dependencies.d/perms new file mode 100644 index 000000000..e69de29bb diff --git a/root/etc/s6-overlay/s6-rc.d/secrets/run b/root/etc/s6-overlay/s6-rc.d/secrets/run new file mode 100644 index 000000000..e410d3390 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/secrets/run @@ -0,0 +1,19 @@ +#!/command/with-contenv bash +# shellcheck shell=bash + +find /var/run/s6/container_environment/ -type f -name 'FILE__*' -print0 | while IFS= read -r -d '' FILENAME; do + NEW_VAR=${FILENAME//FILE__/} + SECRET_FILE=$(cat "${FILENAME}") + if [[ ! -f ${SECRET_FILE} ]]; then + echo "[${NEW_VAR##*/}] The file \"${SECRET_FILE}\" wasn't found!" + exit 1 + fi + SECRET=$(cat "${SECRET_FILE}") + if [[ -n ${SECRET} ]]; then + echo -n "${SECRET}" > "${NEW_VAR}" + echo "[${NEW_VAR##*/}] Set with secret from \"${SECRET_FILE}\"." + else + echo "[${NEW_VAR##*/}] No secret found in \"${SECRET_FILE}\"!" + exit 1 + fi +done diff --git a/root/etc/s6-overlay/s6-rc.d/secrets/type b/root/etc/s6-overlay/s6-rc.d/secrets/type new file mode 100644 index 000000000..bdd22a185 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/secrets/type @@ -0,0 +1 @@ +oneshot diff --git a/root/etc/s6-overlay/s6-rc.d/secrets/up b/root/etc/s6-overlay/s6-rc.d/secrets/up new file mode 100644 index 000000000..abb949702 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/secrets/up @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/secrets/run diff --git a/root/etc/s6-overlay/s6-rc.d/service1/dependencies.d/setup b/root/etc/s6-overlay/s6-rc.d/service1/dependencies.d/setup new file mode 100644 index 000000000..e69de29bb diff --git a/root/etc/services.d/overseerr/run b/root/etc/s6-overlay/s6-rc.d/service1/run similarity index 100% rename from root/etc/services.d/overseerr/run rename to root/etc/s6-overlay/s6-rc.d/service1/run diff --git a/root/etc/s6-overlay/s6-rc.d/service1/type b/root/etc/s6-overlay/s6-rc.d/service1/type new file mode 100644 index 000000000..5883cff0c --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/service1/type @@ -0,0 +1 @@ +longrun diff --git a/root/etc/s6-overlay/s6-rc.d/setup/dependencies.d/secrets b/root/etc/s6-overlay/s6-rc.d/setup/dependencies.d/secrets new file mode 100644 index 000000000..e69de29bb diff --git a/root/etc/cont-init.d/00-start-container b/root/etc/s6-overlay/s6-rc.d/setup/run similarity index 100% rename from root/etc/cont-init.d/00-start-container rename to root/etc/s6-overlay/s6-rc.d/setup/run diff --git a/root/etc/s6-overlay/s6-rc.d/setup/type b/root/etc/s6-overlay/s6-rc.d/setup/type new file mode 100644 index 000000000..bdd22a185 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/setup/type @@ -0,0 +1 @@ +oneshot diff --git a/root/etc/s6-overlay/s6-rc.d/setup/up b/root/etc/s6-overlay/s6-rc.d/setup/up new file mode 100644 index 000000000..9c1ecf3f1 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/setup/up @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/setup/run diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/service1 b/root/etc/s6-overlay/s6-rc.d/user/contents.d/service1 new file mode 100644 index 000000000..e69de29bb