Skip to content

Commit

Permalink
feat(tf2-base): add healthcheck
Browse files Browse the repository at this point in the history
Add healthcheck that queries the server status periodically.
  • Loading branch information
garrappachc committed Aug 13, 2021
1 parent dd95750 commit 257a22c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/tf2-base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,13 @@ ENV DOWNLOAD_URL="https://dl.serveme.tf/"

WORKDIR $SERVER_DIR
COPY entrypoint.sh .
COPY healthcheck.sh .

ENTRYPOINT ["./entrypoint.sh"]
CMD ["+sv_pure", "1", "+map", "cp_badlands", "+maxplayers", "24"]

EXPOSE $PORT/tcp
EXPOSE $PORT/udp
EXPOSE $STV_PORT/udp

HEALTHCHECK --interval=30s --timeout=30s --start-period=20s --retries=3 CMD [ "./healthcheck.sh" ]
3 changes: 3 additions & 0 deletions packages/tf2-base/healthcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

"${SERVER_DIR}/rcon" -H 127.0.0.1 -p ${PORT} -P ${RCON_PASSWORD} status

0 comments on commit 257a22c

Please sign in to comment.