Merge pull request #5689 from nextcloud/enh/noid/add-healthcheck

containers-schema.json: add healtchecks
This commit is contained in:
Simon L. 2024-12-03 15:46:01 +01:00 committed by GitHub
commit 9341392c00
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 188 additions and 8 deletions

View file

@ -15,7 +15,9 @@ RUN set -ex; \
; \ ; \
rm -rf /var/lib/apt/lists/*; rm -rf /var/lib/apt/lists/*;
COPY --chmod=775 healthcheck.sh /healthcheck.sh
USER 100 USER 100
HEALTHCHECK CMD nc -z 127.0.0.1 9980 || exit 1 HEALTHCHECK --start-period=360s CMD /healthcheck.sh
LABEL com.centurylinklabs.watchtower.enable="false" LABEL com.centurylinklabs.watchtower.enable="false"

View file

@ -0,0 +1,3 @@
#!/bin/bash
nc -z 127.0.0.1 9980 || exit 1

View file

@ -16,7 +16,9 @@ RUN set -ex; \
; \ ; \
rm -rf /var/lib/apt/lists/*; rm -rf /var/lib/apt/lists/*;
COPY --chmod=775 healthcheck.sh /healthcheck.sh
USER 1000:0 USER 1000:0
HEALTHCHECK CMD nc -z 127.0.0.1 9200 || exit 1 HEALTHCHECK --interval=10s --timeout=5s --start-period=1m --retries=5 CMD /healthcheck.sh
LABEL com.centurylinklabs.watchtower.enable="false" LABEL com.centurylinklabs.watchtower.enable="false"

View file

@ -0,0 +1,3 @@
#!/bin/bash
nc -z 127.0.0.1 9200 || exit 1

View file

@ -30,6 +30,7 @@ RUN set -ex; \
COPY --from=go /go/bin/imaginary /usr/local/bin/imaginary COPY --from=go /go/bin/imaginary /usr/local/bin/imaginary
COPY --chmod=775 start.sh /start.sh COPY --chmod=775 start.sh /start.sh
COPY --chmod=775 healthcheck.sh /healthcheck.sh
ENV PORT=9000 ENV PORT=9000
@ -39,5 +40,5 @@ USER 65534
ENV MALLOC_ARENA_MAX=2 ENV MALLOC_ARENA_MAX=2
ENTRYPOINT ["/start.sh"] ENTRYPOINT ["/start.sh"]
HEALTHCHECK CMD nc -z 127.0.0.1 "$PORT" || exit 1 HEALTHCHECK CMD /healthcheck.sh
LABEL com.centurylinklabs.watchtower.enable="false" LABEL com.centurylinklabs.watchtower.enable="false"

View file

@ -0,0 +1,3 @@
#!/bin/bash
nc -z 127.0.0.1 "$PORT" || exit 1

View file

@ -279,5 +279,5 @@ USER root
ENTRYPOINT ["/start.sh"] ENTRYPOINT ["/start.sh"]
CMD ["/usr/bin/supervisord", "-c", "/supervisord.conf"] CMD ["/usr/bin/supervisord", "-c", "/supervisord.conf"]
HEALTHCHECK --start-period=60s CMD sudo -E -u www-data bash /healthcheck.sh HEALTHCHECK CMD /healthcheck.sh
LABEL com.centurylinklabs.watchtower.enable="false" LABEL com.centurylinklabs.watchtower.enable="false"

View file

@ -4,5 +4,7 @@ FROM onlyoffice/documentserver:8.2.2.1
# USER root is probably used # USER root is probably used
HEALTHCHECK CMD nc -z 127.0.0.1 80 || exit 1 COPY --chmod=775 healthcheck.sh /healthcheck.sh
HEALTHCHECK --start-period=360s CMD /healthcheck.sh
LABEL com.centurylinklabs.watchtower.enable="false" LABEL com.centurylinklabs.watchtower.enable="false"

View file

@ -0,0 +1,3 @@
#!/bin/bash
nc -z 127.0.0.1 80 || exit 1

View file

@ -14,8 +14,10 @@ RUN set -ex; \
# Get rid of unused binaries # Get rid of unused binaries
rm -f /usr/local/bin/gosu; rm -f /usr/local/bin/gosu;
COPY --chmod=775 healthcheck.sh /healthcheck.sh
USER 999 USER 999
ENTRYPOINT ["/start.sh"] ENTRYPOINT ["/start.sh"]
HEALTHCHECK CMD redis-cli -a $REDIS_HOST_PASSWORD PING || exit 1 HEALTHCHECK CMD /healthcheck.sh
LABEL com.centurylinklabs.watchtower.enable="false" LABEL com.centurylinklabs.watchtower.enable="false"

View file

@ -0,0 +1,3 @@
#!/bin/bash
redis-cli -a "$REDIS_HOST_PASSWORD" PING || exit 1

View file

@ -2,6 +2,7 @@
FROM python:3.13.0-alpine3.20 FROM python:3.13.0-alpine3.20
COPY --chmod=775 start.sh /start.sh COPY --chmod=775 start.sh /start.sh
COPY --chmod=775 healthcheck.sh /healthcheck.sh
ENV RECORDING_VERSION=v0.1 ENV RECORDING_VERSION=v0.1
ENV ALLOW_ALL=false ENV ALLOW_ALL=false
@ -54,5 +55,5 @@ USER 122
ENTRYPOINT ["/start.sh"] ENTRYPOINT ["/start.sh"]
CMD ["python", "-m", "nextcloud.talk.recording", "--config", "/conf/recording.conf"] CMD ["python", "-m", "nextcloud.talk.recording", "--config", "/conf/recording.conf"]
HEALTHCHECK CMD nc -z 127.0.0.1 1234 || exit 1 HEALTHCHECK CMD /healthcheck.sh
LABEL com.centurylinklabs.watchtower.enable="false" LABEL com.centurylinklabs.watchtower.enable="false"

View file

@ -0,0 +1,3 @@
#!/bin/bash
nc -z 127.0.0.1 1234 || exit 1

View file

@ -1,4 +1,5 @@
# syntax=docker/dockerfile:latest # syntax=docker/dockerfile:latest
# Probably from this file: https://github.com/nextcloud/whiteboard/blob/main/Dockerfile
FROM ghcr.io/nextcloud-releases/whiteboard:v1.0.4 FROM ghcr.io/nextcloud-releases/whiteboard:v1.0.4
USER root USER root
@ -8,6 +9,9 @@ RUN set -ex; \
USER 65534 USER 65534
COPY --chmod=775 start.sh /start.sh COPY --chmod=775 start.sh /start.sh
COPY --chmod=775 healthcheck.sh /healthcheck.sh
HEALTHCHECK CMD /healthcheck.sh
ENTRYPOINT ["/start.sh"] ENTRYPOINT ["/start.sh"]

View file

@ -0,0 +1,4 @@
#!/bin/bash
nc -z "$REDIS_HOST" 6379 || exit 0
nc -z 127.0.0.1 3002 || exit 1

View file

@ -25,6 +25,8 @@ set -ex
cd manual-install cd manual-install
cp latest.yml latest.yml.backup cp latest.yml latest.yml.backup
# Additional config
# shellcheck disable=SC1083
sed -i -E '/^( *- )(NET_RAW|SYS_NICE|MKNOD|SYS_ADMIN)$/!s/( *- )([A-Z_]+)$/\1\2=${\2}/' latest.yml sed -i -E '/^( *- )(NET_RAW|SYS_NICE|MKNOD|SYS_ADMIN)$/!s/( *- )([A-Z_]+)$/\1\2=${\2}/' latest.yml
cp sample.conf /tmp/ cp sample.conf /tmp/
sed -i 's|^|export |' /tmp/sample.conf sed -i 's|^|export |' /tmp/sample.conf
@ -117,6 +119,12 @@ EOL
DEPLOYMENTS="$(find ./ -name '*deployment.yaml')" DEPLOYMENTS="$(find ./ -name '*deployment.yaml')"
mapfile -t DEPLOYMENTS <<< "$DEPLOYMENTS" mapfile -t DEPLOYMENTS <<< "$DEPLOYMENTS"
for variable in "${DEPLOYMENTS[@]}"; do for variable in "${DEPLOYMENTS[@]}"; do
if grep -q livenessProbe "$variable"; then
sed -n "/.*livenessProbe/,/timeoutSeconds.*/p" "$variable" > /tmp/liveness.probe
cat /tmp/liveness.probe
sed -i "s|livenessProbe|readinessProbe|" /tmp/liveness.probe
sed -i "/^ image:/r /tmp/liveness.probe" "$variable"
fi
if grep -q volumeMounts "$variable"; then if grep -q volumeMounts "$variable"; then
if echo "$variable" | grep -q database; then if echo "$variable" | grep -q database; then
sed -i "/^ spec:/r /tmp/initcontainers.database" "$variable" sed -i "/^ spec:/r /tmp/initcontainers.database" "$variable"
@ -197,6 +205,8 @@ find ./ -name '*deployment.yaml' -exec sed -i "s|manual-install-nextcloud-aio|ne
# shellcheck disable=SC1083 # shellcheck disable=SC1083
find ./ -name '*deployment.yaml' -exec sed -i "/medium: Memory/d" \{} \; find ./ -name '*deployment.yaml' -exec sed -i "/medium: Memory/d" \{} \;
# shellcheck disable=SC1083 # shellcheck disable=SC1083
find ./ -name '*.yaml' -exec sed -i "/kompose.cmd/d" \{} \;
# shellcheck disable=SC1083
find ./ -name '*deployment.yaml' -exec sed -i "s|emptyDir:|emptyDir: \{\}|" \{} \; find ./ -name '*deployment.yaml' -exec sed -i "s|emptyDir:|emptyDir: \{\}|" \{} \;
# shellcheck disable=SC1083 # shellcheck disable=SC1083
find ./ -name '*deployment.yaml' -exec sed -i "/hostPort:/d" \{} \; find ./ -name '*deployment.yaml' -exec sed -i "/hostPort:/d" \{} \;

View file

@ -94,6 +94,36 @@
} }
} }
}, },
"healthcheck": {
"type": "object",
"additionalProperties": false,
"minProperties": 6,
"properties": {
"interval": {
"type": "string",
"pattern": "^[0-9]+s$"
},
"timeout": {
"type": "string",
"pattern": "^[0-9]+s$"
},
"retries": {
"type": "integer"
},
"start_period": {
"type": "string",
"pattern": "^[0-9]+s$"
},
"start_interval": {
"type": "string",
"pattern": "^[0-9]+s$"
},
"test": {
"type": "string",
"pattern": "^.*$"
}
}
},
"aio_variables": { "aio_variables": {
"type": "array", "type": "array",
"items": { "items": {

View file

@ -15,6 +15,14 @@
"image": "nextcloud/aio-apache", "image": "nextcloud/aio-apache",
"user": "33", "user": "33",
"init": true, "init": true,
"healthcheck": {
"start_period": "0s",
"test": "/healthcheck.sh",
"interval": "30s",
"timeout": "30s",
"start_interval": "5s",
"retries": 3
},
"ports": [ "ports": [
{ {
"ip_binding": "%APACHE_IP_BINDING%", "ip_binding": "%APACHE_IP_BINDING%",
@ -81,6 +89,14 @@
"image": "nextcloud/aio-postgresql", "image": "nextcloud/aio-postgresql",
"user": "999", "user": "999",
"init": true, "init": true,
"healthcheck": {
"start_period": "0s",
"test": "/healthcheck.sh",
"interval": "30s",
"timeout": "30s",
"start_interval": "5s",
"retries": 3
},
"expose": [ "expose": [
"5432" "5432"
], ],
@ -140,6 +156,14 @@
"display_name": "Nextcloud", "display_name": "Nextcloud",
"image": "nextcloud/aio-nextcloud", "image": "nextcloud/aio-nextcloud",
"init": true, "init": true,
"healthcheck": {
"start_period": "0s",
"test": "/healthcheck.sh",
"interval": "30s",
"timeout": "30s",
"start_interval": "5s",
"retries": 3
},
"expose": [ "expose": [
"9000", "9000",
"9001" "9001"
@ -255,6 +279,14 @@
"image": "nextcloud/aio-notify-push", "image": "nextcloud/aio-notify-push",
"user": "33", "user": "33",
"init": true, "init": true,
"healthcheck": {
"start_period": "0s",
"test": "/healthcheck.sh",
"interval": "30s",
"timeout": "30s",
"start_interval": "5s",
"retries": 3
},
"expose": [ "expose": [
"7867" "7867"
], ],
@ -297,6 +329,14 @@
"image": "nextcloud/aio-redis", "image": "nextcloud/aio-redis",
"user": "999", "user": "999",
"init": true, "init": true,
"healthcheck": {
"start_period": "0s",
"test": "/healthcheck.sh",
"interval": "30s",
"timeout": "30s",
"start_interval": "5s",
"retries": 3
},
"expose": [ "expose": [
"6379" "6379"
], ],
@ -333,6 +373,14 @@
"display_name": "Collabora", "display_name": "Collabora",
"image": "nextcloud/aio-collabora", "image": "nextcloud/aio-collabora",
"init": true, "init": true,
"healthcheck": {
"start_period": "360s",
"test": "/healthcheck.sh",
"interval": "30s",
"timeout": "30s",
"start_interval": "5s",
"retries": 3
},
"expose": [ "expose": [
"9980" "9980"
], ],
@ -372,6 +420,14 @@
"image": "nextcloud/aio-talk", "image": "nextcloud/aio-talk",
"user": "1000", "user": "1000",
"init": true, "init": true,
"healthcheck": {
"start_period": "0s",
"test": "/healthcheck.sh",
"interval": "30s",
"timeout": "30s",
"start_interval": "5s",
"retries": 3
},
"ports": [ "ports": [
{ {
"ip_binding": "", "ip_binding": "",
@ -429,6 +485,14 @@
"image": "nextcloud/aio-talk-recording", "image": "nextcloud/aio-talk-recording",
"user": "122", "user": "122",
"init": true, "init": true,
"healthcheck": {
"start_period": "0s",
"test": "/healthcheck.sh",
"interval": "30s",
"timeout": "30s",
"start_interval": "5s",
"retries": 3
},
"expose": [ "expose": [
"1234" "1234"
], ],
@ -591,6 +655,14 @@
"image": "nextcloud/aio-clamav", "image": "nextcloud/aio-clamav",
"user": "100", "user": "100",
"init": false, "init": false,
"healthcheck": {
"start_period": "360s",
"test": "clamdcheck.sh",
"interval": "30s",
"timeout": "30s",
"start_interval": "5s",
"retries": 3
},
"expose": [ "expose": [
"3310" "3310"
], ],
@ -630,6 +702,14 @@
"display_name": "OnlyOffice", "display_name": "OnlyOffice",
"image": "nextcloud/aio-onlyoffice", "image": "nextcloud/aio-onlyoffice",
"init": true, "init": true,
"healthcheck": {
"start_period": "360s",
"test": "/healthcheck.sh",
"interval": "30s",
"timeout": "30s",
"start_interval": "5s",
"retries": 3
},
"expose": [ "expose": [
"80" "80"
], ],
@ -672,6 +752,14 @@
"image": "nextcloud/aio-imaginary", "image": "nextcloud/aio-imaginary",
"user": "65534", "user": "65534",
"init": true, "init": true,
"healthcheck": {
"start_period": "0s",
"test": "/healthcheck.sh",
"interval": "30s",
"timeout": "30s",
"start_interval": "5s",
"retries": 3
},
"expose": [ "expose": [
"9000" "9000"
], ],
@ -708,6 +796,14 @@
"display_name": "Fulltextsearch", "display_name": "Fulltextsearch",
"image": "nextcloud/aio-fulltextsearch", "image": "nextcloud/aio-fulltextsearch",
"init": false, "init": false,
"healthcheck": {
"start_period": "60s",
"test": "/healthcheck.sh",
"interval": "10s",
"timeout": "5s",
"start_interval": "5s",
"retries": 5
},
"expose": [ "expose": [
"9200" "9200"
], ],
@ -778,6 +874,14 @@
"image": "nextcloud/aio-whiteboard", "image": "nextcloud/aio-whiteboard",
"user": "65534", "user": "65534",
"init": true, "init": true,
"healthcheck": {
"start_period": "0s",
"test": "/healthcheck.sh",
"interval": "30s",
"timeout": "30s",
"start_interval": "5s",
"retries": 3
},
"expose": [ "expose": [
"3002" "3002"
], ],