mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
[BUGFIX] Dynamically determine healthcheck URL (#1444)
This commit is contained in:
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
|
||||||
|
|
17
healthcheck.sh
Executable file
17
healthcheck.sh
Executable file
|
@ -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
Block a user