From 5d4651c16898e41cfd001771d6ca2ef2babc6cdf Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Fri, 3 Feb 2023 16:42:24 -0600 Subject: [PATCH] fix: delay squadjs startup by 10 seconds We have to wait until the Squad server is initialized and has a full RCON connection up. This allows SquadJS to be started in tandem with a Squad docker image in docker compose without conflict. This is a bit hacky and a healthcheck would be superior, but there's a lot of instances to check in the Squad log to even verify if the RCON connection is good to go. Another potential way of doing this health check is to attempt to login into the rcon connection ourselves in a loop and then start SquadJS once that rcon connection succeeds (after closing the RCON connection we made). --- Dockerfile | 3 ++- scripts/entry.sh | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 scripts/entry.sh diff --git a/Dockerfile b/Dockerfile index 1cc7707..b274e07 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,4 +44,5 @@ FROM setup as prod USER "${USER}" WORKDIR "${USER_HOME}/SquadJS" -ENTRYPOINT ["/usr/bin/node", "./index.js"] +COPY ./scripts/entry.sh . +ENTRYPOINT ["/bin/sh", "entry.sh"] diff --git a/scripts/entry.sh b/scripts/entry.sh new file mode 100644 index 0000000..e5b65c9 --- /dev/null +++ b/scripts/entry.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +printf "Starting SquadJS...\n" +sleep 10 +/usr/bin/node ./index.js +