put notify-push into its own container

Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
Simon L 2023-06-07 15:45:38 +02:00
parent 56e3f27d6c
commit 9b1421980f
6 changed files with 98 additions and 22 deletions

View file

@ -30,7 +30,7 @@
# Notify Push
route /push/* {
uri strip_prefix /push
reverse_proxy {$NEXTCLOUD_HOST}:7867
reverse_proxy {$NOTIFY_PUSH_HOST}:7867
}
# Onlyoffice

View file

@ -131,14 +131,4 @@ if ! sudo -E -u www-data bash /entrypoint.sh; then
exit 1
fi
# Correctly set CPU_ARCH for notify_push
CPU_ARCH="$(uname -m)"
export CPU_ARCH
if [ -z "$CPU_ARCH" ]; then
echo "Could not get processor architecture. Exiting."
exit 1
elif [ "$CPU_ARCH" != "x86_64" ]; then
export CPU_ARCH="aarch64"
fi
exec "$@"

View file

@ -25,14 +25,6 @@ stderr_logfile_maxbytes=0
command=/cron.sh
user=www-data
[program:notify-push]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=/var/www/html/custom_apps/notify_push/bin/%(ENV_CPU_ARCH)s/notify_push /var/www/html/config/config.php --port 7867 --redis-url redis://:%(ENV_REDIS_HOST_PASSWORD)s@%(ENV_REDIS_HOST)s
user=www-data
[program:run-exec-commands]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0

View file

@ -0,0 +1,20 @@
FROM alpine:3.18.1
COPY --chmod=775 start.sh /start.sh
RUN set -ex; \
apk add --no-cache \
ca-certificates \
tzdata \
bash \
openssl; \
# Give root a random password
echo "root:$(openssl rand -base64 12)" | chpasswd; \
apk del --no-cache \
openssl;
USER 33
ENTRYPOINT ["/start.sh"]
HEALTHCHECK CMD nc -z localhost 7867 || exit 1
LABEL com.centurylinklabs.watchtower.monitor-only="true"

View file

@ -0,0 +1,38 @@
#!/bin/bash
if [ -z "$NEXTCLOUD_HOST" ]; then
echo "NEXTCLOUD_HOST need to be provided. Exiting!"
exit 1
elif [ -z "$POSTGRES_HOST" ]; then
echo "POSTGRES_HOST need to be provided. Exiting!"
exit 1
elif [ -z "$REDIS_HOST" ]; then
echo "REDIS_HOST need to be provided. Exiting!"
exit 1
fi
# Only start container if nextcloud is accessible
while ! nc -z "$NEXTCLOUD_HOST" 9000; do
echo "Waiting for Nextcloud to start..."
sleep 5
done
# Correctly set CPU_ARCH for notify_push
CPU_ARCH="$(uname -m)"
export CPU_ARCH
if [ -z "$CPU_ARCH" ]; then
echo "Could not get processor architecture. Exiting."
exit 1
elif [ "$CPU_ARCH" != "x86_64" ]; then
export CPU_ARCH="aarch64"
fi
# Run it
/nextcloud/custom_apps/notify_push/bin/"$CPU_ARCH"/notify_push \
--database-prefix="oc_" \
--nextcloud-url "https://$NC_DOMAIN" \
--port 7867 \
--redis-url "redis://:$REDIS_HOST_PASSWORD@$REDIS_HOST" \
--database-url "postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST/$POSTGRES_DB"
exec "$@"

View file

@ -6,6 +6,7 @@
"nextcloud-aio-onlyoffice",
"nextcloud-aio-collabora",
"nextcloud-aio-talk",
"nextcloud-aio-notify-push",
"nextcloud-aio-nextcloud"
],
"display_name": "Apache",
@ -27,7 +28,8 @@
"ONLYOFFICE_HOST=nextcloud-aio-onlyoffice",
"TZ=%TIMEZONE%",
"APACHE_MAX_SIZE=%APACHE_MAX_SIZE%",
"APACHE_MAX_TIME=%NEXTCLOUD_MAX_TIME%"
"APACHE_MAX_TIME=%NEXTCLOUD_MAX_TIME%",
"NOTIFY_PUSH_HOST=nextcloud-aio-notify-push"
],
"volumes": [
{
@ -104,8 +106,7 @@
"display_name": "Nextcloud",
"image": "nextcloud/aio-nextcloud",
"expose": [
"9000",
"7867"
"9000"
],
"internal_port": "9000",
"secrets": [
@ -193,6 +194,41 @@
"nextcloud-aio"
]
},
{
"container_name": "nextcloud-aio-notify-push",
"display_name": "Notify Push",
"image": "nextcloud/aio-notify-push",
"expose": [
"7867"
],
"internal_port": "7876",
"secrets": [
"REDIS_PASSWORD",
"POSTGRES_PASSWORD"
],
"volumes": [
{
"source": "nextcloud_aio_nextcloud",
"destination": "/nextcloud",
"writeable": false
}
],
"environment": [
"NC_DOMAIN=%NC_DOMAIN%",
"NEXTCLOUD_HOST=nextcloud-aio-nextcloud",
"REDIS_HOST=nextcloud-aio-redis",
"REDIS_HOST_PASSWORD=%REDIS_PASSWORD%",
"POSTGRES_HOST=nextcloud-aio-database",
"POSTGRES_PASSWORD=%DATABASE_PASSWORD%",
"POSTGRES_DB=nextcloud_database",
"POSTGRES_USER=nextcloud"
],
"restart": "unless-stopped",
"networks": [
"nextcloud-aio"
],
"read_only": true
},
{
"container_name": "nextcloud-aio-redis",
"display_name": "Redis",