Compare commits

...

1 Commits

Author SHA1 Message Date
Trenton Holmes 13cf1e78a1 Experiementation with s6 features 2026-05-12 06:37:04 -07:00
11 changed files with 65 additions and 8 deletions
+3 -1
View File
@@ -37,7 +37,9 @@ WORKDIR /usr/src/s6
# https://github.com/just-containers/s6-overlay#customizing-s6-overlay-behaviour
ENV \
S6_BEHAVIOUR_IF_STAGE2_FAILS=2 \
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=60000 \
S6_KILL_GRACETIME=30000 \
S6_SERVICES_GRACETIME=30000 \
S6_VERBOSITY=1 \
PATH=/command:$PATH
+16
View File
@@ -0,0 +1,16 @@
#!/command/with-contenv /usr/bin/bash
# shellcheck shell=bash
if [[ -n "${PAPERLESS_CONSUMER_DISABLE}" ]]; then
if [[ $1 -eq 0 ]]; then
echo "[svc-consumer] Consumer is disabled, service did not run"
else
echo "[svc-consumer] Consumer is disabled, but service exited with error (exit code: $1, signal: $2)" >&2
fi
else
if [[ $1 -eq 0 ]]; then
echo "[svc-consumer] Service stopped cleanly (exit code: $1, signal: $2)"
else
echo "[svc-consumer] Service exited with error (exit code: $1, signal: $2)" >&2
fi
fi
+16
View File
@@ -0,0 +1,16 @@
#!/command/with-contenv /usr/bin/bash
# shellcheck shell=bash
if [[ -z "${PAPERLESS_ENABLE_FLOWER}" ]]; then
if [[ $1 -eq 0 ]]; then
echo "[svc-flower] Flower is disabled, service did not run"
else
echo "[svc-flower] Flower is disabled, but service exited with error (exit code: $1, signal: $2)" >&2
fi
else
if [[ $1 -eq 0 ]]; then
echo "[svc-flower] Service stopped cleanly (exit code: $1, signal: $2)"
else
echo "[svc-flower] Service exited with error (exit code: $1, signal: $2)" >&2
fi
fi
@@ -6,9 +6,6 @@ declare -r log_prefix="[svc-flower]"
echo "${log_prefix} Checking if we should start flower..."
if [[ -n "${PAPERLESS_ENABLE_FLOWER}" ]]; then
# Small delay to allow celery to be up first
echo "${log_prefix} Starting flower in 5s"
sleep 5
cd ${PAPERLESS_SRC_DIR}
if [[ -n "${USER_IS_NON_ROOT}" ]]; then
@@ -0,0 +1,8 @@
#!/command/with-contenv /usr/bin/bash
# shellcheck shell=bash
if [[ $1 -eq 0 ]]; then
echo "[svc-scheduler] Service stopped cleanly (exit code: $1, signal: $2)"
else
echo "[svc-scheduler] Service exited with error (exit code: $1, signal: $2)" >&2
fi
@@ -0,0 +1,8 @@
#!/command/with-contenv /usr/bin/bash
# shellcheck shell=bash
if [[ $1 -eq 0 ]]; then
echo "[svc-webserver] Service stopped cleanly (exit code: $1, signal: $2)"
else
echo "[svc-webserver] Service exited with error (exit code: $1, signal: $2)" >&2
fi
@@ -14,7 +14,7 @@ if [[ -n "${PAPERLESS_FORCE_SCRIPT_NAME}" ]]; then
fi
if [[ -n "${USER_IS_NON_ROOT}" ]]; then
exec granian --interface asginl --ws --loop uvloop "paperless.asgi:application"
exec s6-notifyoncheck -d -w 1000 -- curl -sf "http://localhost:${GRANIAN_PORT}/" -- granian --interface asginl --ws --loop uvloop "paperless.asgi:application"
else
exec s6-setuidgid paperless granian --interface asginl --ws --loop uvloop "paperless.asgi:application"
exec s6-notifyoncheck -d -w 1000 -- curl -sf "http://localhost:${GRANIAN_PORT}/" -- s6-setuidgid paperless granian --interface asginl --ws --loop uvloop "paperless.asgi:application"
fi
+8
View File
@@ -0,0 +1,8 @@
#!/command/with-contenv /usr/bin/bash
# shellcheck shell=bash
if [[ $1 -eq 0 ]]; then
echo "[svc-worker] Service stopped cleanly (exit code: $1, signal: $2)"
else
echo "[svc-worker] Service exited with error (exit code: $1, signal: $2)" >&2
fi
@@ -0,0 +1 @@
3
@@ -4,7 +4,7 @@
cd ${PAPERLESS_SRC_DIR}
if [[ -n "${USER_IS_NON_ROOT}" ]]; then
exec /usr/local/bin/celery --app paperless worker --loglevel INFO --without-mingle --without-gossip
exec s6-notifyoncheck -d -w 1000 -- sh -c 'celery --app paperless inspect ping --timeout 1' -- /usr/local/bin/celery --app paperless worker --loglevel INFO --without-mingle --without-gossip
else
exec s6-setuidgid paperless /usr/local/bin/celery --app paperless worker --loglevel INFO --without-mingle --without-gossip
exec s6-notifyoncheck -d -w 1000 -- sh -c 'celery --app paperless inspect ping --timeout 1' -- s6-setuidgid paperless /usr/local/bin/celery --app paperless worker --loglevel INFO --without-mingle --without-gossip
fi