From fa43f0af29e0708c662a3fec853c57a2aa985519 Mon Sep 17 00:00:00 2001 From: Mike K Date: Mon, 4 Jan 2021 15:44:30 -0500 Subject: [PATCH 1/4] Update Dockerfile Add Netcat to create a dummy port for a health check --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 8d7e6d8..c4db2c7 100755 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM thmhoag/steamcmd:latest USER root RUN apt-get update && \ - apt-get install -y curl cron bzip2 perl-modules lsof libc6-i386 lib32gcc1 sudo + apt-get install -y curl cron bzip2 perl-modules lsof libc6-i386 lib32gcc1 sudo netcat RUN curl -sL "https://raw.githubusercontent.com/FezVrasta/ark-server-tools/v1.6.54/netinstall.sh" | bash -s steam && \ ln -s /usr/local/bin/arkmanager /usr/bin/arkmanager From 0cbc224ad381fc1065fbedee1c809c8794f8445f Mon Sep 17 00:00:00 2001 From: Mike K Date: Mon, 4 Jan 2021 15:57:26 -0500 Subject: [PATCH 2/4] Update run.sh Start TCP listener with nc on 4000 and kill when server is set to go down --- run.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/run.sh b/run.sh index 560aead..63a237c 100755 --- a/run.sh +++ b/run.sh @@ -10,6 +10,10 @@ echo "########################################################################## echo "# Ark Server - " `date` echo "###########################################################################" +echo "Listen on TCP 4000 for health checks" +(nc -lk 4000) & +NC_PID=$! + echo "Ensuring correct permissions..." sudo find /ark -not -user steam -o -not -group steam -exec chown -v steam:steam {} \; sudo find /home/steam -not -user steam -o -not -group steam -exec chown -v steam:steam {} \; @@ -121,6 +125,8 @@ fi function stop { + echo "Killing TCP listen on 4000" + kill -SIGTERM $NC_PID arkmanager broadcast "Server is shutting down" arkmanager notify "Server is shutting down" arkmanager stop From a3a3a4632478880bcaa9e7f2b1f403731ea78f9f Mon Sep 17 00:00:00 2001 From: Mike K Date: Wed, 6 Jan 2021 21:06:03 -0500 Subject: [PATCH 3/4] Update Dockerfile Using socat instead --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index c4db2c7..f4d4eef 100755 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM thmhoag/steamcmd:latest USER root RUN apt-get update && \ - apt-get install -y curl cron bzip2 perl-modules lsof libc6-i386 lib32gcc1 sudo netcat + apt-get install -y curl cron bzip2 perl-modules lsof libc6-i386 lib32gcc1 sudo socat RUN curl -sL "https://raw.githubusercontent.com/FezVrasta/ark-server-tools/v1.6.54/netinstall.sh" | bash -s steam && \ ln -s /usr/local/bin/arkmanager /usr/bin/arkmanager From e8f03aed793c08f51073f8037bc6f43ac0523d00 Mon Sep 17 00:00:00 2001 From: Mike K Date: Wed, 6 Jan 2021 21:07:12 -0500 Subject: [PATCH 4/4] Update run.sh Switching to socat --- run.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/run.sh b/run.sh index 63a237c..ff98e6a 100755 --- a/run.sh +++ b/run.sh @@ -10,9 +10,10 @@ echo "########################################################################## echo "# Ark Server - " `date` echo "###########################################################################" -echo "Listen on TCP 4000 for health checks" -(nc -lk 4000) & -NC_PID=$! +echo "Starting listener on 4000/tcp for health checks" +(socat -4 -lf/dev/null TCP-LISTEN:4000,fork UNIX-CONNECT:/var/run/docker.sock) & +SOCAT_PID=$! +echo "Listener PID ${SOCAT_PID}" echo "Ensuring correct permissions..." sudo find /ark -not -user steam -o -not -group steam -exec chown -v steam:steam {} \; @@ -125,8 +126,8 @@ fi function stop { - echo "Killing TCP listen on 4000" - kill -SIGTERM $NC_PID + echo "Killing listener on 4000/tcp" + kill -SIGTERM $SOCAT_PID arkmanager broadcast "Server is shutting down" arkmanager notify "Server is shutting down" arkmanager stop