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
|
||||
|
||||
VER=0.0.0
|
||||
#!/usr/bin/env bash
|
||||
set -euf -o pipefail
|
||||
|
||||
echo "Given Args: ${*}"
|
||||
echo
|
||||
|
@@ -2,13 +2,7 @@
|
||||
"type": "object",
|
||||
"description": "HealthObject",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"version",
|
||||
"commit",
|
||||
"healthy",
|
||||
"setup",
|
||||
"error_reporting"
|
||||
],
|
||||
"required": ["version", "commit", "healthy", "setup", "error_reporting"],
|
||||
"properties": {
|
||||
"version": {
|
||||
"type": "string",
|
||||
@@ -36,6 +30,12 @@
|
||||
"type": "boolean",
|
||||
"description": "Will the application send any error reporting?",
|
||||
"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
|
||||
#===============
|
||||
|
||||
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
|
||||
|
||||
ENV SUPPRESS_NO_CONFIG_WARNING=1
|
||||
ENV S6_FIX_ATTRS_HIDDEN=1
|
||||
ENV SUPPRESS_NO_CONFIG_WARNING=1 \
|
||||
S6_FIX_ATTRS_HIDDEN=1 \
|
||||
CERT_HOME=/data/acme/
|
||||
|
||||
RUN echo "fs.file-max = 65535" > /etc/sysctl.conf
|
||||
|
||||
# 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>"
|
||||
|
||||
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
|
||||
echo "Waits for a docker container to be healthy."
|
||||
echo "Usage: $0 docker-container"
|
||||
echo "Usage: $0 docker-container 30"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SERVICE=$1
|
||||
LOOPCOUNT=0
|
||||
HEALTHY=
|
||||
LIMIT=${2:-90}
|
||||
|
||||
echo -e "${BLUE}❯ ${CYAN}Waiting for healthy: ${YELLOW}${SERVICE}${RESET}"
|
||||
|
||||
until [ "${HEALTHY}" = "healthy" ]; do
|
||||
echo -n "."
|
||||
sleep 1
|
||||
HEALTHY="$(docker inspect -f '{{.State.Health.Status}}' $SERVICE)"
|
||||
((LOOPCOUNT++))
|
||||
is_up() {
|
||||
docker exec "$SERVICE" /bin/healthcheck.sh
|
||||
}
|
||||
|
||||
if [ "$LOOPCOUNT" == "$LIMIT" ]; then
|
||||
echo ""
|
||||
echo ""
|
||||
i=0
|
||||
while ! is_up; do
|
||||
i=$((i + 1))
|
||||
if [ "$i" == "$LIMIT" ]; then
|
||||
echo -e "${BLUE}❯ ${RED}Timed out waiting for healthy${RESET}"
|
||||
docker logs --tail 50 "$SERVICE"
|
||||
exit 1
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo ""
|
||||
|
Reference in New Issue
Block a user