mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-08-28 03:30:05 +00:00
Fix ci healthcheck
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
#!/usr/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
set -euf -o pipefail
|
||||||
VER=0.0.0
|
|
||||||
|
|
||||||
echo "Given Args: ${*}"
|
echo "Given Args: ${*}"
|
||||||
echo
|
echo
|
||||||
|
@@ -2,13 +2,7 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"description": "HealthObject",
|
"description": "HealthObject",
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"required": [
|
"required": ["version", "commit", "healthy", "setup", "error_reporting"],
|
||||||
"version",
|
|
||||||
"commit",
|
|
||||||
"healthy",
|
|
||||||
"setup",
|
|
||||||
"error_reporting"
|
|
||||||
],
|
|
||||||
"properties": {
|
"properties": {
|
||||||
"version": {
|
"version": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@@ -36,6 +30,12 @@
|
|||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Will the application send any error reporting?",
|
"description": "Will the application send any error reporting?",
|
||||||
"example": true
|
"example": true
|
||||||
|
},
|
||||||
|
"acme.sh": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Acme.sh version",
|
||||||
|
"example": "v3.0.0",
|
||||||
|
"minLength": 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -35,12 +35,14 @@ RUN mkdir -p /dist \
|
|||||||
# Final image
|
# Final image
|
||||||
#===============
|
#===============
|
||||||
|
|
||||||
FROM jc21/nginx-full:github-acme.sh AS final
|
FROM jc21/nginx-full:github-no-acme AS final
|
||||||
|
|
||||||
COPY --from=gobuild /dist/server /app/bin/server
|
COPY --from=gobuild /dist/server /app/bin/server
|
||||||
|
|
||||||
ENV SUPPRESS_NO_CONFIG_WARNING=1
|
ENV SUPPRESS_NO_CONFIG_WARNING=1 \
|
||||||
ENV S6_FIX_ATTRS_HIDDEN=1
|
S6_FIX_ATTRS_HIDDEN=1 \
|
||||||
|
CERT_HOME=/data/acme/
|
||||||
|
|
||||||
RUN echo "fs.file-max = 65535" > /etc/sysctl.conf
|
RUN echo "fs.file-max = 65535" > /etc/sysctl.conf
|
||||||
|
|
||||||
# s6 overlay
|
# s6 overlay
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
FROM jc21/nginx-full:github-acme.sh-golang
|
FROM jc21/nginx-full:github-no-acme-golang
|
||||||
LABEL maintainer="Jamie Curnow <jc@jc21.com>"
|
LABEL maintainer="Jamie Curnow <jc@jc21.com>"
|
||||||
|
|
||||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||||
|
7
docker/rootfs/bin/healthcheck.sh
Executable file
7
docker/rootfs/bin/healthcheck.sh
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euf -o pipefail
|
||||||
|
|
||||||
|
HEALTHY="$(curl --silent "http://127.0.0.1:3000/api" | jq --raw-output '.result.healthy')"
|
||||||
|
|
||||||
|
echo "Healthy: ${HEALTHY}"
|
||||||
|
[ "$HEALTHY" = 'true' ] || exit 1
|
@@ -5,29 +5,28 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|||||||
|
|
||||||
if [ "$1" == "" ]; then
|
if [ "$1" == "" ]; then
|
||||||
echo "Waits for a docker container to be healthy."
|
echo "Waits for a docker container to be healthy."
|
||||||
echo "Usage: $0 docker-container"
|
echo "Usage: $0 docker-container 30"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SERVICE=$1
|
SERVICE=$1
|
||||||
LOOPCOUNT=0
|
|
||||||
HEALTHY=
|
|
||||||
LIMIT=${2:-90}
|
LIMIT=${2:-90}
|
||||||
|
|
||||||
echo -e "${BLUE}❯ ${CYAN}Waiting for healthy: ${YELLOW}${SERVICE}${RESET}"
|
echo -e "${BLUE}❯ ${CYAN}Waiting for healthy: ${YELLOW}${SERVICE}${RESET}"
|
||||||
|
|
||||||
until [ "${HEALTHY}" = "healthy" ]; do
|
is_up() {
|
||||||
echo -n "."
|
docker exec "$SERVICE" /bin/healthcheck.sh
|
||||||
sleep 1
|
}
|
||||||
HEALTHY="$(docker inspect -f '{{.State.Health.Status}}' $SERVICE)"
|
|
||||||
((LOOPCOUNT++))
|
|
||||||
|
|
||||||
if [ "$LOOPCOUNT" == "$LIMIT" ]; then
|
i=0
|
||||||
echo ""
|
while ! is_up; do
|
||||||
echo ""
|
i=$((i + 1))
|
||||||
|
if [ "$i" == "$LIMIT" ]; then
|
||||||
echo -e "${BLUE}❯ ${RED}Timed out waiting for healthy${RESET}"
|
echo -e "${BLUE}❯ ${RED}Timed out waiting for healthy${RESET}"
|
||||||
|
docker logs --tail 50 "$SERVICE"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
Reference in New Issue
Block a user