[BUGFIX] Dynamically determine healthcheck URL (#1444)
parent
2834f3f8e8
commit
423cd09f26
|
@ -56,7 +56,7 @@ WORKDIR /app
|
||||||
RUN apk --no-cache add ca-certificates su-exec tzdata
|
RUN apk --no-cache add ca-certificates su-exec tzdata
|
||||||
|
|
||||||
COPY --from=builder-backend /go/src/app/cmd/authelia/authelia ./
|
COPY --from=builder-backend /go/src/app/cmd/authelia/authelia ./
|
||||||
COPY ./entrypoint.sh /usr/local/bin/entrypoint.sh
|
COPY entrypoint.sh healthcheck.sh /usr/local/bin/
|
||||||
|
|
||||||
EXPOSE 9091
|
EXPOSE 9091
|
||||||
|
|
||||||
|
@ -69,4 +69,4 @@ PGID=0
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||||
CMD ["--config", "/config/configuration.yml"]
|
CMD ["--config", "/config/configuration.yml"]
|
||||||
HEALTHCHECK --interval=30s --timeout=3s CMD wget --quiet --tries=1 --spider http://localhost:9091/api/state || exit 1
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=1m CMD /usr/local/bin/healthcheck.sh
|
||||||
|
|
|
@ -62,7 +62,7 @@ RUN apk --no-cache add ca-certificates su-exec tzdata && \
|
||||||
rm /usr/bin/qemu-arm-static
|
rm /usr/bin/qemu-arm-static
|
||||||
|
|
||||||
COPY --from=builder-backend /go/src/app/cmd/authelia/authelia ./
|
COPY --from=builder-backend /go/src/app/cmd/authelia/authelia ./
|
||||||
COPY ./entrypoint.sh /usr/local/bin/entrypoint.sh
|
COPY entrypoint.sh healthcheck.sh /usr/local/bin/
|
||||||
|
|
||||||
EXPOSE 9091
|
EXPOSE 9091
|
||||||
|
|
||||||
|
@ -75,4 +75,4 @@ PGID=0
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||||
CMD ["--config", "/config/configuration.yml"]
|
CMD ["--config", "/config/configuration.yml"]
|
||||||
HEALTHCHECK --interval=30s --timeout=3s CMD wget --quiet --tries=1 --spider http://localhost:9091/api/state || exit 1
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=1m CMD /usr/local/bin/healthcheck.sh
|
||||||
|
|
|
@ -62,7 +62,7 @@ RUN apk --no-cache add ca-certificates su-exec tzdata && \
|
||||||
rm /usr/bin/qemu-aarch64-static
|
rm /usr/bin/qemu-aarch64-static
|
||||||
|
|
||||||
COPY --from=builder-backend /go/src/app/cmd/authelia/authelia ./
|
COPY --from=builder-backend /go/src/app/cmd/authelia/authelia ./
|
||||||
COPY ./entrypoint.sh /usr/local/bin/entrypoint.sh
|
COPY entrypoint.sh healthcheck.sh /usr/local/bin/
|
||||||
|
|
||||||
EXPOSE 9091
|
EXPOSE 9091
|
||||||
|
|
||||||
|
@ -75,4 +75,4 @@ PGID=0
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||||
CMD ["--config", "/config/configuration.yml"]
|
CMD ["--config", "/config/configuration.yml"]
|
||||||
HEALTHCHECK --interval=30s --timeout=3s CMD wget --quiet --tries=1 --spider http://localhost:9091/api/state || exit 1
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=1m CMD /usr/local/bin/healthcheck.sh
|
||||||
|
|
|
@ -7,4 +7,4 @@ elif [[ $(id -u) != 0 ]] || [[ $(id -g) != 0 ]]; then
|
||||||
else
|
else
|
||||||
chown -R ${PUID}:${PGID} /config
|
chown -R ${PUID}:${PGID} /config
|
||||||
exec su-exec ${PUID}:${PGID} authelia "$@"
|
exec su-exec ${PUID}:${PGID} authelia "$@"
|
||||||
fi
|
fi
|
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
AUTHELIA_CONFIG=$(ps | grep authelia | awk '{print $6}' | head -1)
|
||||||
|
AUTHELIA_SCHEME=$(cat "${AUTHELIA_CONFIG}" | grep ^tls)
|
||||||
|
AUTHELIA_PORT=$(cat "${AUTHELIA_CONFIG}" | grep ^port | sed -e 's/port: //')
|
||||||
|
|
||||||
|
if [[ -z ${AUTHELIA_PORT} ]]; then
|
||||||
|
AUTHELIA_PORT=9091
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z ${AUTHELIA_SCHEME} ]]; then
|
||||||
|
AUTHELIA_SCHEME=http
|
||||||
|
else
|
||||||
|
AUTHELIA_SCHEME=https
|
||||||
|
fi
|
||||||
|
|
||||||
|
wget --quiet --tries=1 --spider ${AUTHELIA_SCHEME}://localhost:${AUTHELIA_PORT}/api/state || exit 1
|
Loading…
Reference in New Issue