Add healthcheck

This commit is contained in:
Laura Demkowicz-Duffy committed 2021-05-09 00:25:38 +02:00
1 parent fabb9083e9
commit 0fa050f7bf
2 files changed
+16

No files matched your search

+2
View File
@@ -34,6 +34,7 @@ USER patuser
# Get the server files
COPY --from=downloader --chown=patuser /patserver/$PA_STREAM_NAME $INSTALL_LOC
COPY --chown=patuser ./docker-entrypoint.sh /docker-entrypoint.sh
COPY healthcheck.sh /healthcheck.sh
ENV PA_TITANS_ENABLED=yes
ENV PA_AI_ENABLED=yes
@@ -46,6 +47,7 @@ ENV PA_REPLAY_TIMEOUT=180
ENV PA_GAMEOVER_TIMEOUT=360
ENV PA_EMPTY_TIMEOUT=3600
HEALTHCHECK CMD /healthcheck.sh
VOLUME $REPLAYS_LOC
EXPOSE 20545
WORKDIR $INSTALL_LOC
Executable
+14
View File
@@ -0,0 +1,14 @@
#!/bin/bash
# Based on https://stackoverflow.com/questions/9609130/efficiently-test-if-a-port-is-open-on-linux
exec 6<>/dev/tcp/127.0.0.1/20545
success=$?
exec 6>&- # close output connection
exec 6<&- # close input connection
if [[ $? != 0 ]]; then
exit 1
else
exit 0
fi