Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Added HealthCheck #33

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ LABEL org.opencontainers.image.title="zerotier" \
org.opencontainers.image.source="https://github.com/zyclonite/zerotier-docker"

COPY --from=builder /src/zerotier-one /scripts/entrypoint.sh /usr/sbin/
COPY --from=builder --chmod=755 /scripts/healthcheck.sh /usr/sbin/

RUN apk add --no-cache --purge --clean-protected libc6-compat libstdc++ \
&& mkdir -p /var/lib/zerotier-one \
Expand All @@ -37,6 +38,9 @@ RUN apk add --no-cache --purge --clean-protected libc6-compat libstdc++ \

EXPOSE 9993/udp

HEALTHCHECK --interval=60s --timeout=8s \
CMD /bin/sh /usr/sbin/healthcheck.sh

ENTRYPOINT ["entrypoint.sh"]

CMD ["-U"]
14 changes: 14 additions & 0 deletions scripts/healthcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## Adding of HealthCheck has been sponsored by PMGA Tech LLP.
#!/bin/sh

#Exit Codes
# 0= Success
# Failure

status=$(zerotier-cli status | awk '{print $5}')

if [[ "$status" = "ONLINE" ]] ; then
exit 0
else
exit 1
fi