replace supervisor with dinit

Signed-off-by: Zoey <zoey@z0ey.de>
This commit is contained in:
Zoey
2026-08-26 21:24:47 +02:00
parent 571f18bed2
commit 328746e1e4
38 changed files with 155 additions and 277 deletions
+5 -10
View File
@@ -8,7 +8,7 @@ COPY --from=caddy /usr/bin/caddy /usr/bin/caddy
COPY --chown=33:33 Caddyfile /Caddyfile
COPY --chmod=664 nextcloud.conf /usr/local/apache2/conf/nextcloud.conf
COPY --chmod=664 supervisord.conf /supervisord.conf
COPY dinit.d/ /etc/dinit.d/
COPY --chmod=775 start.sh /start.sh
COPY --chmod=775 healthcheck.sh /healthcheck.sh
@@ -28,7 +28,7 @@ RUN set -ex; \
\
apk add --no-cache \
bash \
supervisor \
dinit \
tzdata \
ca-certificates \
bind-tools \
@@ -78,13 +78,6 @@ RUN set -ex; \
mkdir -p /var/www; \
chown -R www-data:www-data /var/www; \
\
mkdir /var/log/supervisord; \
mkdir /var/run/supervisord; \
chown www-data:www-data /var/run/supervisord; \
chown www-data:www-data /var/log/supervisord; \
chmod 777 /var/run/supervisord; \
chmod 777 /var/log/supervisord; \
\
chown -R www-data:www-data /usr/local/apache2; \
chmod +r -R /usr/local/apache2; \
mkdir -p /usr/local/apache2/logs; \
@@ -94,8 +87,10 @@ RUN set -ex; \
USER www-data:www-data
STOPSIGNAL SIGTERM
ENTRYPOINT ["/start.sh"]
CMD ["/usr/bin/supervisord", "-c", "/supervisord.conf"]
CMD ["dinit", "--system", "--container", "apache", "caddy"]
ENV AIO_LOG_LEVEL=warn
+5
View File
@@ -0,0 +1,5 @@
type = process
command = httpd -DFOREGROUND
stop-command = httpd -k graceful-stop
restart = yes
options = shares-console
+5
View File
@@ -0,0 +1,5 @@
type = process
command = /usr/bin/caddy run --config /tmp/Caddyfile
term-signal = TERM
restart = yes
options = shares-console
+1 -1
View File
@@ -3,7 +3,7 @@ Listen 8000
ServerName localhost
# Add error log
CustomLog /proc/self/fd/1 proxy
CustomLog ${AIO_ACCESS_LOG} proxy
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy
ErrorLog /proc/self/fd/2
ErrorLogFormat "[%t] [%l] [%E] [client: %{X-Forwarded-For}i] [%M] [%{User-Agent}i]"
+2 -2
View File
@@ -10,9 +10,9 @@ if [ -z "$NC_DOMAIN" ]; then
fi
if [ "$AIO_LOG_LEVEL" = 'debug' ]; then
export SUPERVISORD_STDOUT=/dev/stdout
export AIO_ACCESS_LOG=/proc/self/fd/1
else
export SUPERVISORD_STDOUT=NONE
export AIO_ACCESS_LOG=/dev/null
fi
# Need write access to /mnt/data
-22
View File
@@ -1,22 +0,0 @@
[supervisord]
nodaemon=true
logfile=/var/log/supervisord/supervisord.log
pidfile=/var/run/supervisord/supervisord.pid
childlogdir=/var/log/supervisord/
logfile_maxbytes=50MB
logfile_backups=10
loglevel=%(ENV_AIO_LOG_LEVEL)s
[program:apache]
# Stdout logging is disabled as otherwise the logs are spammed
stdout_logfile=%(ENV_SUPERVISORD_STDOUT)s
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=httpd -DFOREGROUND
[program:caddy]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=/usr/bin/caddy run --config /tmp/Caddyfile
+5 -5
View File
@@ -3,9 +3,9 @@ FROM alpine:3.24.1
RUN set -ex; \
apk upgrade --no-cache -a; \
apk add --no-cache tzdata clamav clamav-milter supervisor bash; \
mkdir -p /tmp /var/lib/clamav /run/clamav /var/log/supervisord /var/run/supervisord; \
chmod 777 -R /tmp /run/clamav /var/log/clamav /var/log/supervisord /var/run/supervisord; \
apk add --no-cache tzdata clamav clamav-milter dinit bash; \
mkdir -p /tmp /var/lib/clamav; \
chmod 777 -R /tmp /var/log/clamav; \
chown -R clamav:clamav /var/lib/clamav; \
sed -i "s|#\?MaxDirectoryRecursion.*|MaxDirectoryRecursion 30|g" /etc/clamav/clamd.conf; \
sed -i "s|#\?MaxScanSize.*|MaxScanSize 2000M|g" /etc/clamav/clamd.conf; \
@@ -33,14 +33,14 @@ RUN set -ex; \
COPY --chmod=775 start.sh /start.sh
COPY --chmod=775 healthcheck.sh /healthcheck.sh
COPY --chmod=664 supervisord.conf /supervisord.conf
COPY dinit.d/ /etc/dinit.d/
USER clamav:clamav
RUN set -ex; \
freshclam --foreground --stdout
VOLUME /var/lib/clamav
ENTRYPOINT ["/start.sh"]
CMD ["/usr/bin/supervisord", "-c", "/supervisord.conf"]
CMD ["dinit", "--system", "--container", "freshclam", "clamd", "milter"]
LABEL com.centurylinklabs.watchtower.enable="false" \
wud.watch="false" \
dockhand.update="false" \
+5
View File
@@ -0,0 +1,5 @@
type = process
command = clamd --foreground --config-file=/etc/clamav/clamd.conf
term-signal = TERM
restart = yes
options = shares-console
+5
View File
@@ -0,0 +1,5 @@
type = process
command = freshclam --foreground --stdout --daemon --daemon-notify=/etc/clamav/clamd.conf
term-signal = TERM
restart = yes
options = shares-console
+5
View File
@@ -0,0 +1,5 @@
type = process
command = clamav-milter --config-file=/etc/clamav/clamav-milter.conf
term-signal = TERM
restart = yes
options = shares-console
+2
View File
@@ -4,6 +4,8 @@ if [ "$AIO_LOG_LEVEL" = 'debug' ]; then
set -x
fi
mkdir -p /run/clamav
# Print out clamav version for compliance reasons
clamscan --version
-29
View File
@@ -1,29 +0,0 @@
[supervisord]
nodaemon=true
logfile=/var/log/supervisord/supervisord.log
pidfile=/var/run/supervisord/supervisord.pid
childlogdir=/var/log/supervisord/
logfile_maxbytes=50MB
logfile_backups=10
loglevel=%(ENV_AIO_LOG_LEVEL)s
[program:freshclam]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=freshclam --foreground --stdout --daemon --daemon-notify=/etc/clamav/clamd.conf
[program:clamd]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=clamd --foreground --config-file=/etc/clamav/clamd.conf
[program:milter]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=clamav-milter --config-file=/etc/clamav/clamav-milter.conf
+3 -6
View File
@@ -27,7 +27,7 @@ COPY community-containers /var/www/docker-aio/community-containers
COPY php /var/www/docker-aio/php
COPY --chmod=775 Containers/mastercontainer/*.sh /
COPY --chmod=664 Containers/mastercontainer/*.Caddyfile /
COPY --chmod=664 Containers/mastercontainer/supervisord.conf /supervisord.conf
COPY Containers/mastercontainer/dinit.d/ /etc/dinit.d/
WORKDIR /var/www/docker-aio
@@ -43,7 +43,7 @@ RUN set -ex; \
util-linux-misc \
ca-certificates \
bash \
supervisor \
dinit \
su-exec \
netcat-openbsd \
curl \
@@ -95,10 +95,7 @@ RUN set -ex; \
chmod -R 770 /var/www/docker-aio; \
chown -R www-data:www-data /var/www; \
rm -r php/data; \
rm -r php/session; \
\
mkdir /var/log/supervisord; \
mkdir /var/run/supervisord;
rm -r php/session;
# hadolint ignore=DL3048
LABEL org.opencontainers.image.title="Nextcloud All-in-One Mastercontainer" \
+2 -2
View File
@@ -34,10 +34,10 @@ All-in-One stack.
- **Dockerfile**: Instructions for building the mastercontainer image.
- **Entrypoint script**: The `start.sh` script is used for container initialization and runtime
configuration before starting supervisord.
configuration before starting dinit.
- [**Nextcloud All-in-One Controller App**](https://github.com/nextcloud/all-in-one/tree/main/php): The
core AIO orchestrator that handles configuration and settings for the containers.
- **Supervisor**: The `supervisord.conf` file defines the long-running services hosted within
- **dinit**: The service description files in `dinit.d/` define the long-running services hosted within
the container (php-fpm, cron, etc.)
## Usage
@@ -0,0 +1,5 @@
type = process
command = /backup-time-file-watcher.sh
term-signal = TERM
restart = yes
options = shares-console
@@ -0,0 +1,6 @@
type = process
command = /usr/bin/caddy run --config /acme.Caddyfile
run-as = www-data
term-signal = TERM
restart = yes
options = shares-console
@@ -0,0 +1,6 @@
type = process
command = /usr/bin/caddy run --config /internal.Caddyfile
run-as = www-data
term-signal = TERM
restart = yes
options = shares-console
+5
View File
@@ -0,0 +1,5 @@
type = process
command = /cron.sh
term-signal = TERM
restart = yes
options = shares-console
@@ -0,0 +1,6 @@
type = process
command = php -S 127.0.0.1:9876 /var/www/docker-aio/php/domain-validator.php
run-as = www-data
term-signal = TERM
restart = yes
options = shares-console
@@ -0,0 +1,5 @@
type = process
command = php-fpm
term-signal = QUIT
restart = yes
options = shares-console
@@ -0,0 +1,6 @@
type = process
command = /session-deduplicator.sh
run-as = www-data
term-signal = TERM
restart = yes
options = shares-console
+5 -6
View File
@@ -347,10 +347,9 @@ if [ -z "$AIO_LOG_LEVEL" ]; then
export AIO_LOG_LEVEL="warn"
fi
if [ "$AIO_LOG_LEVEL" = 'debug' ]; then
export SUPERVISORD_STDOUT=/dev/stdout
else
export SUPERVISORD_STDOUT=NONE
if [ "$AIO_LOG_LEVEL" != 'debug' ]; then
sed -i 's|access.log = /proc/self/fd/1|access.log = /dev/null|' /usr/local/etc/php-fpm.d/docker.conf
sed -i 's|^options = shares-console|#options = shares-console|' /etc/dinit.d/domain-validator
fi
# Check if ghcr.io is reachable
@@ -449,5 +448,5 @@ rm -rf /tmp/twig-cache/*
chown www-data:www-data /tmp/twig-cache
chmod 770 /tmp/twig-cache
# Start supervisord
exec /usr/bin/supervisord -c /supervisord.conf
# Start dinit
exec dinit --system --container php-fpm caddy-internal caddy-acme cron backup-time-file-watcher session-deduplicator domain-validator
@@ -1,64 +0,0 @@
[supervisord]
nodaemon=true
logfile=/var/log/supervisord/supervisord.log
pidfile=/var/run/supervisord/supervisord.pid
childlogdir=/var/log/supervisord/
logfile_maxbytes=50MB
logfile_backups=10
loglevel=%(ENV_AIO_LOG_LEVEL)s
user=root
[program:php-fpm]
# Stdout logging is disabled as otherwise the logs are spammed
stdout_logfile=%(ENV_SUPERVISORD_STDOUT)s
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=php-fpm
user=root
[program:caddy-internal]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=/usr/bin/caddy run --config /internal.Caddyfile
user=www-data
[program:caddy-acme]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=/usr/bin/caddy run --config /acme.Caddyfile
user=www-data
[program:cron]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=/cron.sh
user=root
[program:backup-time-file-watcher]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=/backup-time-file-watcher.sh
user=root
[program:session-deduplicator]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=/session-deduplicator.sh
user=www-data
[program:domain-validator]
# Logging is disabled as otherwise all attempts will be logged which spams the logs
stdout_logfile=%(ENV_SUPERVISORD_STDOUT)s
stderr_logfile=%(ENV_SUPERVISORD_STDOUT)s
command=php -S 127.0.0.1:9876 /var/www/docker-aio/php/domain-validator.php
user=www-data
+3 -10
View File
@@ -20,7 +20,7 @@ ENV AIO_URL=localhost
COPY --chmod=775 Containers/nextcloud/*.sh /
COPY --chmod=774 Containers/nextcloud/upgrade.exclude /upgrade.exclude
COPY Containers/nextcloud/config/*.php /
COPY Containers/nextcloud/supervisord.conf /supervisord.conf
COPY Containers/nextcloud/dinit.d/ /etc/dinit.d/
# AIO cloning start # Do not remove or change this line!
COPY app /usr/src/nextcloud/apps/nextcloud-aio
@@ -191,7 +191,7 @@ RUN set -ex; \
ffmpeg \
procps \
samba-client \
supervisor \
dinit \
# libreoffice \
; \
\
@@ -224,13 +224,6 @@ RUN set -ex; \
apk add --no-cache --virtual .nextcloud-phpext-rundeps $runDeps; \
apk del .build-deps; \
\
mkdir -p \
/var/log/supervisord \
/var/run/supervisord \
; \
chmod 777 -R /var/log/supervisord; \
chmod 777 -R /var/run/supervisord; \
\
apk add --no-cache \
bash \
netcat-openbsd \
@@ -286,7 +279,7 @@ RUN set -ex; \
# hadolint ignore=DL3002
USER root:root
ENTRYPOINT ["/start.sh"]
CMD ["/usr/bin/supervisord", "-c", "/supervisord.conf"]
CMD ["dinit", "--system", "--container", "php-fpm", "cron", "taskprocessing-worker", "run-exec-commands", "is-nextcloud-online"]
HEALTHCHECK CMD ["/healthcheck.sh"]
LABEL com.centurylinklabs.watchtower.enable="false" \
+2 -2
View File
@@ -13,9 +13,9 @@ The Nextcloud container provides the core Nextcloud application environment, inc
## Contents
- **Dockerfile**: Instructions for building the Nextcloud container image.
- **Entrypoint script**: The `start.sh` script is used for container initialization and runtime configuration before starting supervisord.
- **Entrypoint script**: The `start.sh` script is used for container initialization and runtime configuration before starting dinit.
- **Nextcloud configuration files**: Specific to running in a containerized setting and/or within AIO.
- **Supervisor**: The `supervisord.conf` file defines the long-running services hosted within the container (php-fpm, cron, etc.).
- **dinit**: The service description files in `dinit.d/` define the long-running services hosted within the container (php-fpm, cron, etc.).
## Usage
+6
View File
@@ -0,0 +1,6 @@
type = process
command = /cron.sh
run-as = www-data
term-signal = TERM
restart = yes
options = shares-console
@@ -0,0 +1,6 @@
type = process
command = timeout 86400 nc -lk 9001
run-as = www-data
term-signal = TERM
restart = yes
options = shares-console
+5
View File
@@ -0,0 +1,5 @@
type = process
command = php-fpm
term-signal = QUIT
restart = yes
options = shares-console
@@ -0,0 +1,6 @@
type = process
command = /run-exec-commands.sh
run-as = www-data
term-signal = TERM
restart = yes
options = shares-console
@@ -0,0 +1,6 @@
type = process
command = php /var/www/html/occ taskprocessing:worker --timeout 300
run-as = www-data
term-signal = TERM
restart = yes
options = shares-console
-54
View File
@@ -1,54 +0,0 @@
# From https://github.com/nextcloud/docker/blob/master/.examples/dockerfiles/full/fpm/supervisord.conf
[supervisord]
nodaemon=true
logfile=/var/log/supervisord/supervisord.log
pidfile=/var/run/supervisord/supervisord.pid
childlogdir=/var/log/supervisord/
logfile_maxbytes=50MB ; maximum size of logfile before rotation
logfile_backups=10 ; number of backed up logfiles
loglevel=%(ENV_AIO_LOG_LEVEL)s
user=root
[program:php-fpm]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=php-fpm
user=root
[program:cron]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=/cron.sh
user=www-data
[program:taskprocessing-worker]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=php /var/www/html/occ taskprocessing:worker --timeout 300
autorestart=true
user=www-data
[program:run-exec-commands]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=/run-exec-commands.sh
user=www-data
# This is a hack but no better solution is there
[program:is-nextcloud-online]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
# Restart the netcat command once a day to ensure that it stays reachable
# See https://github.com/nextcloud/all-in-one/issues/6334
command=timeout 86400 nc -lk 9001
user=www-data
+5 -11
View File
@@ -26,7 +26,7 @@ COPY --from=signaling --chmod=777 --chown=1000:1000 /usr/bin/nextcloud-spreed-si
COPY --chmod=775 start.sh /start.sh
COPY --chmod=775 healthcheck.sh /healthcheck.sh
COPY --chmod=664 supervisord.conf /supervisord.conf
COPY dinit.d/ /etc/dinit.d/
SHELL ["/bin/ash", "-o", "pipefail", "-c"]
RUN set -ex; \
@@ -36,7 +36,7 @@ RUN set -ex; \
tzdata \
bash \
openssl \
supervisor \
dinit \
bind-tools \
netcat-openbsd \
\
@@ -66,24 +66,18 @@ RUN set -ex; \
/var/tmp \
/conf \
/var/lib/turn \
/var/log/supervisord \
/var/run/supervisord \
/usr/lib/janus/loggers; \
chown eturnal:eturnal -R \
/etc/nats.conf \
/var/log/supervisord \
/var/run/supervisord; \
/etc/nats.conf; \
chmod 777 -R \
/tmp \
/conf \
/var/run/supervisord \
/var/log/supervisord; \
/conf; \
ln -s /opt/eturnal/bin/stun /usr/local/bin/stun; \
ln -s /opt/eturnal/bin/eturnalctl /usr/local/bin/eturnalctl
USER eturnal:eturnal
ENTRYPOINT ["/start.sh"]
CMD ["supervisord", "-c", "/supervisord.conf"]
CMD ["dinit", "--system", "--container", "nats-server", "eturnal", "janus", "signaling"]
HEALTHCHECK CMD ["/healthcheck.sh"]
LABEL com.centurylinklabs.watchtower.enable="false" \
+5
View File
@@ -0,0 +1,5 @@
type = process
command = eturnalctl foreground
term-signal = TERM
restart = yes
options = shares-console
+5
View File
@@ -0,0 +1,5 @@
type = process
command = janus --config=/conf/janus.jcfg --disable-colors --log-stdout --full-trickle --debug-level $JANUS_LOG_LEVEL
term-signal = TERM
restart = yes
options = shares-console
+5
View File
@@ -0,0 +1,5 @@
type = process
command = nats-server -c /etc/nats.conf
term-signal = TERM
restart = yes
options = shares-console
+7
View File
@@ -0,0 +1,7 @@
type = process
command = nextcloud-spreed-signaling -config /conf/signaling.conf
term-signal = TERM
restart = yes
options = shares-console
depends-on = nats-server
depends-on = janus
-44
View File
@@ -1,44 +0,0 @@
[supervisord]
nodaemon=true
logfile=/var/log/supervisord/supervisord.log
pidfile=/var/run/supervisord/supervisord.pid
childlogdir=/var/log/supervisord/
logfile_maxbytes=50MB
logfile_backups=10
loglevel=%(ENV_AIO_LOG_LEVEL)s
[program:nats-server]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=nats-server -c /etc/nats.conf
# Start first: signaling depends on NATS being available
priority=10
[program:eturnal]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=eturnalctl foreground
# Start alongside Janus; independent of signaling
priority=20
[program:janus]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=janus --config=/conf/janus.jcfg --disable-colors --log-stdout --full-trickle --debug-level %(ENV_JANUS_LOG_LEVEL)s
# Start alongside eturnal; signaling connects to Janus via WebSocket
priority=20
[program:signaling]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=nextcloud-spreed-signaling -config /conf/signaling.conf
# Start last: depends on NATS (priority=10) and Janus (priority=20) being up
priority=30