mirror of
https://github.com/optim-enterprises-bv/databunker.git
synced 2025-10-29 09:02:22 +00:00
Add health check to the project
This commit is contained in:
@@ -41,7 +41,8 @@ RUN /bin/busybox mkdir -p /databunker/data && \
|
|||||||
# Tell docker that all future commands should run as the appuser user
|
# Tell docker that all future commands should run as the appuser user
|
||||||
USER appuser
|
USER appuser
|
||||||
COPY --from=builder /go/bin/databunker /databunker/bin/databunker
|
COPY --from=builder /go/bin/databunker /databunker/bin/databunker
|
||||||
COPY run.sh /databunker/bin/
|
COPY run.sh health-check.sh /databunker/bin/
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
HEALTHCHECK --interval=5s --timeout=3s --start-period=33s --retries=3 CMD /databunker/bin/health-check.sh
|
||||||
ENTRYPOINT ["/bin/sh", "/databunker/bin/run.sh"]
|
ENTRYPOINT ["/bin/sh", "/databunker/bin/run.sh"]
|
||||||
#CMD ["/bin/sh", "-x", "-c", "/go/bin/databunker -init"]
|
#CMD ["/bin/sh", "-x", "-c", "/go/bin/databunker -init"]
|
||||||
|
|||||||
25
health-check.sh
Executable file
25
health-check.sh
Executable file
@@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# check if Databunker is using SSL port
|
||||||
|
if [ -n "$SSL_CERTIFICATE" ]; then
|
||||||
|
if [ -f "$SSL_CERTIFICATE" ]; then
|
||||||
|
/bin/busybox wget --tries=1 --spider --no-check-certificate -q https://localhost:3000/status || exit 1
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "/databunker/certs/server.cer" ]; then
|
||||||
|
/bin/busybox wget --tries=1 --spider --no-check-certificate -q https://localhost:3000/status || exit 1
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
CERT_FILE=`/bin/busybox sed -n -e '/ssl_certificate:/ s/ .*ssl_certificate: "\(.*\)"/\1/p' /databunker/conf/databunker.yaml`
|
||||||
|
if [ -n "$CERT_FILE" ]; then
|
||||||
|
if [ -f "$CERT_FILE" ]; then
|
||||||
|
/bin/busybox wget --tries=1 --spider --no-check-certificate -q https://localhost:3000/status || exit 1
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# by default check http port
|
||||||
|
/bin/busybox wget --tries=1 --spider -q http://localhost:3000/status || exit 1
|
||||||
Reference in New Issue
Block a user