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/*;
COPY --chmod=775 healthcheck.sh /healthcheck.sh
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"

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/*;
COPY --chmod=775 healthcheck.sh /healthcheck.sh
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"

View file

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

View file

@ -1,7 +1,7 @@
# syntax=docker/dockerfile:latest
FROM golang:1.23.3-alpine3.20 AS go
ENV IMAGINARY_HASH=8f36a26c448be8c151a3878404b75fcd1cd3cf0c
ENV IMAGINARY_HASH=8f36a26c448be8c151a3878404b75fcd1cd3cf0c
RUN set -ex; \
apk add --no-cache \
@ -30,6 +30,7 @@ RUN set -ex; \
COPY --from=go /go/bin/imaginary /usr/local/bin/imaginary
COPY --chmod=775 start.sh /start.sh
COPY --chmod=775 healthcheck.sh /healthcheck.sh
ENV PORT=9000
@ -39,5 +40,5 @@ USER 65534
ENV MALLOC_ARENA_MAX=2
ENTRYPOINT ["/start.sh"]
HEALTHCHECK CMD nc -z 127.0.0.1 "$PORT" || exit 1
HEALTHCHECK CMD /healthcheck.sh
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"]
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"

View file

@ -4,5 +4,7 @@ FROM onlyoffice/documentserver:8.2.2.1
# 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"

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
rm -f /usr/local/bin/gosu;
COPY --chmod=775 healthcheck.sh /healthcheck.sh
USER 999
ENTRYPOINT ["/start.sh"]
HEALTHCHECK CMD redis-cli -a $REDIS_HOST_PASSWORD PING || exit 1
HEALTHCHECK CMD /healthcheck.sh
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
COPY --chmod=775 start.sh /start.sh
COPY --chmod=775 healthcheck.sh /healthcheck.sh
ENV RECORDING_VERSION=v0.1
ENV ALLOW_ALL=false
@ -54,5 +55,5 @@ USER 122
ENTRYPOINT ["/start.sh"]
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"

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
# Probably from this file: https://github.com/nextcloud/whiteboard/blob/main/Dockerfile
FROM ghcr.io/nextcloud-releases/whiteboard:v1.0.4
USER root
@ -8,6 +9,9 @@ RUN set -ex; \
USER 65534
COPY --chmod=775 start.sh /start.sh
COPY --chmod=775 healthcheck.sh /healthcheck.sh
HEALTHCHECK CMD /healthcheck.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
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
cp sample.conf /tmp/
sed -i 's|^|export |' /tmp/sample.conf
@ -117,6 +119,12 @@ EOL
DEPLOYMENTS="$(find ./ -name '*deployment.yaml')"
mapfile -t DEPLOYMENTS <<< "$DEPLOYMENTS"
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 echo "$variable" | grep -q database; then
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
find ./ -name '*deployment.yaml' -exec sed -i "/medium: Memory/d" \{} \;
# 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: \{\}|" \{} \;
# shellcheck disable=SC1083
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": {
"type": "array",
"items": {

View file

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