From 55ef946ea2375255354cd7b4c7550dff947109bd Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Tue, 27 Oct 2015 10:55:32 +0100 Subject: [PATCH 01/39] Remove old auto-backup && old auto-update --- Dockerfile | 4 ---- run.sh | 20 +++++--------------- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/Dockerfile b/Dockerfile index 18d846b..e353ee2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,10 +17,6 @@ ENV NBPLAYERS 70 ENV UPDATEONSTART 1 # if the server is backup when start with docker start ENV BACKUPONSTART 1 -# Nb minute between auto update (warm) (-1 : no auto update) -ENV AUTOUPDATE -1 -# Nb minute between auto backup (-1 : no auto backup) -ENV AUTOBACKUP -1 # branch on github for ark server tools ENV BRANCH master # Server PORT (you can't remap with docker, it doesn't work) diff --git a/run.sh b/run.sh index 382d994..580032f 100644 --- a/run.sh +++ b/run.sh @@ -7,16 +7,16 @@ mkfifo /tmp/FIFO export TERM=linux +# Creating directory tree && symbolic link [ ! -f /ark/arkmanager.cfg ] && cp /home/steam/arkmanager.cfg /ark/arkmanager.cfg [ ! -d /ark/log ] && mkdir /ark/log [ ! -d /ark/backup ] && mkdir /ark/backup - -#echo "Upgrade Ark server tools..." -#arkmanager upgrade-tools +[ ! -f /ark/Game.ini ] && ln -s /ark/server/ShooterGame/Saved/Config/Game.ini /ark/Game.ini +[ ! -f /ark/GameUserSetting.ini ] && ln -s /ark/server/ShooterGame/Saved/Config/GameUserSetting.ini /ark/GameUserSetting.ini -if [ ! -d "/ark/server" ] && [ ! -f "/ark/server/arkversion" ];then - echo "Install ark..." + +if [ ! -d "/ark/server" ] || [ ! -f "/ark/server/arkversion" ];then arkmanager install # Create mod dir mkdir /ark/server/ShooterGame/Content/Mods @@ -42,15 +42,5 @@ echo "Waiting..." trap 'arkmanager stop' INT trap 'arkmanager stop' TERM -# Auto update every $AUTOUPDATE minutes -if [ $AUTOUPDATE -gt 0 ]; then - while :; do sleep $(($AUTOUPDATE * 60)); echo "[`date +'%y/%m/%d %H:%M'`] [Auto-Update]"; arkmanager update --warn --update-mods --backup ; done & -fi - -# Auto backup every $AUTOBACKUP minutes -if [ $AUTOBACKUP -gt 0 ]; then - while :; do sleep $(($AUTOBACKUP * 60)); echo "[`date +'%Y/%m/%d %H:%M'`] [Auto-Backup]"; arkmanager backup ; done & -fi - read < /tmp/FIFO & wait From 5f7500706157058eea99f51f79334178ac2c567a Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Tue, 27 Oct 2015 11:19:58 +0100 Subject: [PATCH 02/39] Add crontab support. --- run.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/run.sh b/run.sh index 580032f..27c05a5 100644 --- a/run.sh +++ b/run.sh @@ -33,6 +33,22 @@ else fi fi +# We load the crontab file if it exist. +if [ -f /ark/crontab ]; then + crontab /ark/crontab +else + cat <<EOT >> /ark/crontab +# Minute Hour Day of Month Month Day of Week Command +# (0-59) (0-23) (1-31) (1-12 or Jan-Dec) (0-6 or Sun-Sat) +# Example : update every hour +# 0 * * * * arkmanager update +# Example : backup every 15min +# */15 * * * * arkmanager backup +# Example : backup every day at midnight +# 0 0 * * * arkmanager backup + EOT +fi + # Launching ark server arkmanager start From ad1098fb349d0d0b3fd9055930f4ae13ba145d5a Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Tue, 27 Oct 2015 11:33:50 +0100 Subject: [PATCH 03/39] Add crontab example in default file. --- run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run.sh b/run.sh index 27c05a5..c9f96c5 100644 --- a/run.sh +++ b/run.sh @@ -46,7 +46,7 @@ else # */15 * * * * arkmanager backup # Example : backup every day at midnight # 0 0 * * * arkmanager backup - EOT +EOT fi # Launching ark server From 8b389d0bfbad19a346e713e4d376b6b8b7a42faa Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Tue, 27 Oct 2015 11:39:58 +0100 Subject: [PATCH 04/39] Change crontab examples --- run.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/run.sh b/run.sh index c9f96c5..1004b80 100644 --- a/run.sh +++ b/run.sh @@ -38,8 +38,14 @@ if [ -f /ark/crontab ]; then crontab /ark/crontab else cat <<EOT >> /ark/crontab -# Minute Hour Day of Month Month Day of Week Command -# (0-59) (0-23) (1-31) (1-12 or Jan-Dec) (0-6 or Sun-Sat) +# Example of job definition: +# .---------------- minute (0 - 59) +# | .------------- hour (0 - 23) +# | | .---------- day of month (1 - 31) +# | | | .------- month (1 - 12) OR jan,feb,mar,apr ... +# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat +# | | | | | +# * * * * * user command to be executed # Example : update every hour # 0 * * * * arkmanager update # Example : backup every 15min From 3629b0d1b923478abf67eb8ff808855890de2e40 Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Tue, 27 Oct 2015 13:42:32 +0100 Subject: [PATCH 05/39] Add link to arkmanager in /usr/bin to allow crontab to call it directly --- Dockerfile | 3 +++ run.sh | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e353ee2..2e5f8fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -57,6 +57,9 @@ WORKDIR /home/steam/ark-server-tools/tools RUN chmod +x install.sh RUN ./install.sh steam +# Allow crontab to call arkmanager +RUN ln -s /usr/local/bin/arkmanager /usr/bin/arkmanager + # Define default config file in /ark COPY arkmanager-system.cfg /etc/arkmanager/arkmanager.cfg diff --git a/run.sh b/run.sh index 1004b80..c8f619b 100644 --- a/run.sh +++ b/run.sh @@ -36,6 +36,8 @@ fi # We load the crontab file if it exist. if [ -f /ark/crontab ]; then crontab /ark/crontab + # Cron is attached to this process + sudo cron -f & else cat <<EOT >> /ark/crontab # Example of job definition: @@ -52,6 +54,8 @@ else # */15 * * * * arkmanager backup # Example : backup every day at midnight # 0 0 * * * arkmanager backup +# WARNING : the container timezone is maybe not your current timezone +# You can sync them with option -v /etc/localtime:/etc/localtime:ro or -e "TZ=UTC" EOT fi @@ -61,7 +65,7 @@ arkmanager start # Stop server in case of signal INT or TERM echo "Waiting..." -trap 'arkmanager stop' INT +trap 'arkmanager stop;' INT trap 'arkmanager stop' TERM read < /tmp/FIFO & From 4165d86e46a169794c9d24f4617a4218981cd49b Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Tue, 27 Oct 2015 14:06:31 +0100 Subject: [PATCH 06/39] Update README.md --- README.md | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index f220a86..f16b54c 100644 --- a/README.md +++ b/README.md @@ -5,13 +5,14 @@ Docker build for managing an ARK: Survival Evolved server. This image uses [Ark Server Tools](https://github.com/FezVrasta/ark-server-tools) to manage an ark server. *If you use an old volume, delete arkmanager.cfg to get the new configuration file.* +__Don't forget to use `docker pull turzam/ark` to get the latest version of the image__ ## Features - Easy install (no steamcmd / lib32... to install) - Use Ark Server Tools : update/install/start/backup/rcon - - Auto update (on start or on timer) - - Auto backup (on start or on timer) + - Easy crontab configuration + - Easy access to ark config file - Mods handling (via Ark Server Tools) - `Docker stop` is a clean stop @@ -21,14 +22,11 @@ Fast & Easy server setup : You can map the ark volume to access config files : `docker run -d -p 7778:7778 -p 7778:7778/udp -p 27015:27015 -p 27015:27015/udp -e SESSIONNAME=myserver -v /my/path/to/ark:/ark --name ark turzam/ark` -Then you can edit */my/path/to/ark/arkcmanager.cfg* (the values override GameUserSetting.ini) and */my/path/to/ark/server/ShooterGame/Saved/Config/LinuxServer/[GameUserSetting.ini/Game.ini]* +Then you can edit */my/path/to/ark/arkcmanager.cfg* (the values override GameUserSetting.ini) and */my/path/to/ark/[GameUserSetting.ini/Game.ini]* You can manager your server with rcon if you map the rcon port (you can rebind the rcon port with docker): `docker run -d -p 7778:7778 -p 7778:7778/udp -p 27015:27015 -p 27015:27015/udp -p 32330:32330 -e SESSIONNAME=myserver --name ark turzam/ark` -You can define a server that updates itself every 2 hours (with 1 hour warning) and backups itself every hours: -`docker run -d -p 7778:7778 -p 7778:7778/udp -p 27015:27015 -p 27015:27015/udp -e SESSIONNAME=myserver -e AUTOBACKUP=60 -e AUTOUPDATE=120 -e WARNMINUTE=60 --name ark turzam/ark` - You can change server and steam port to allow multiple servers on same host: *(You can't just rebind the port with docker. It won't work, you need to change STEAMPORT & SERVERPORT variable)* `docker run -d -p 7779:7779 -p 7779:7779/udp -p 27016:27016 -p 27016:27016/udp -p 32331:32330 -e SESSIONNAME=myserver2 -e SERVERPORT=27016 -e STEAMPORT=7779 --name ark2 turzam/ark` @@ -54,13 +52,25 @@ You can use rcon command via docker : __You can check all available command for arkmanager__ [here](https://github.com/FezVrasta/ark-server-tools/blob/master/README.md) +You can easily configure automatic update and backup. +If you edit the file `/my/path/to/ark/crontab` you can add your crontab job. +For example : +`# Update the server every hours` +`0 * * * * arkmanager update --warn --update-mods >> /ark/log/crontab.log 2&>1` + `# Backup the server each day at 00:00 ` + `0 0 * * * arkmanager backup >> /ark/log/crontab.log 2&>1` +*You can check [this website](http://www.unix.com/man-page/linux/5/crontab/) for more information on cron.* + --- ## Recommended Usage - First run `docker run -it -p 7778:7778 -p 7778:7778/udp -p 27015:27015 -p 27015:27015/udp -p 32330:32330 -e SESSIONNAME=myserver -e ADMINPASSWORD="mypasswordadmin" -e AUTOUPDATE=120 -e AUTOBACKUP=60 -e WARNMINUTE=30 -v /my/path/to/ark:/ark --name ark turzam/ark` - Wait for ark to be downloaded installed and launched, then Ctrl+C to stop the server. -- Modify */my/path/to/ark/server/ShooterGame/Saved/Config/LinuxServer/GameUserSetting.ini and Game.ini* +- Modify */my/path/to/ark/GameUserSetting.ini and Game.ini* +- Add auto update every day and autobackup by editing */my/path/to/ark/crontab* with this lines : +`0 0 * * * arkmanager update --warn --update-mods >> /ark/log/crontab.log 2&>1 + 0 0 * * * arkmanager backup >> /ark/log/crontab.log 2&>1 ` - `docker start ark` - Check your server with : `docker exec ark arkmanager status` @@ -84,11 +94,6 @@ Steam server port (can't rebind with docker, it doesn't work) (default : 7778) 1 : Backup the server when the container is started. 0: no backup (default : 1) + __UPDATEPONSTART__ 1 : Update the server when the container is started. 0: no update (default : 1) -+ __AUTOUPDATE__ -Number of minute between each check for une newer version (-1 disable auto update) (default : -1) -Auto update is set to --warn and warn the players 30 minutes before update (default, can be changed in /ark/arkmanager.cfg). -+ __AUTOBACKUP__ -Number of minute between each backup (-1 disable auto backup) (default : -1) + __WARNMINUTE__ Number of minute to warn the players when auto-update (default : 30) @@ -101,6 +106,9 @@ Number of minute to warn the players when auto-update (default : 30) + /ark/log : logs + /ark/backup : backups + /ark/arkmanager.cfg : config file + + /ark/crontab : crontab config file + + /ark/Game.ini : ark game.ini config file + + /ark/GameUserSetting.ini : ark gameusersetting.ini config file --- @@ -122,4 +130,8 @@ Number of minute to warn the players when auto-update (default : 30) + 1.1 : - Works with Ark Server Tools 1.4 [See changelog here](https://github.com/FezVrasta/ark-server-tools/releases/tag/v1.4) - Handle mods && auto update mods ++ 1.2 : + - Remove variable AUTOBACKUP & AUTOUPDATE + - Add crontab support + - You can now config crontab with the file /your/ark/path/crontab From ecd3ec73d005254449d3b1a27f759d186328a5e6 Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Tue, 27 Oct 2015 14:17:29 +0100 Subject: [PATCH 07/39] Check directory permissions before starting --- run.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/run.sh b/run.sh index c8f619b..001c610 100644 --- a/run.sh +++ b/run.sh @@ -7,6 +7,11 @@ mkfifo /tmp/FIFO export TERM=linux +if [ ! -w /ark ]; then + echo "[Error] Can't access ark directory. Check permissions on your mapped directory with /ark" + exit 1 +fi + # Creating directory tree && symbolic link [ ! -f /ark/arkmanager.cfg ] && cp /home/steam/arkmanager.cfg /ark/arkmanager.cfg [ ! -d /ark/log ] && mkdir /ark/log From 16aaa29f578982d73f558510cbd4a765084477b0 Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Thu, 5 Nov 2015 11:00:30 +0100 Subject: [PATCH 08/39] Put arkwarnminutes the arkmanager user config. --- arkmanager-system.cfg | 1 - arkmanager-user.cfg | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/arkmanager-system.cfg b/arkmanager-system.cfg index b4f4480..ab328d1 100644 --- a/arkmanager-system.cfg +++ b/arkmanager-system.cfg @@ -16,7 +16,6 @@ steamcmd_appinfocache="/home/steam/Steam/appcache/appinfo.vdf" # cache of t arkserverroot="/ark/server" # path of your ARK server files (default ~/ARK) arkserverexec="ShooterGame/Binaries/Linux/ShooterGameServer" # name of ARK server executable arkbackupdir="/ark/backup" # path to backup directory -arkwarnminutes="30" # number of minutes to warn players when using update --warn arkautorestartfile="ShooterGame/Saved/.autorestart" # path to autorestart file # config Service diff --git a/arkmanager-user.cfg b/arkmanager-user.cfg index e82ca30..a972ff4 100644 --- a/arkmanager-user.cfg +++ b/arkmanager-user.cfg @@ -32,3 +32,4 @@ mod_branch=Windows msgWarnUpdateMinutes="This ARK server will shutdown for an update in %d minutes" msgWarnUpdateSeconds="This ARK server will shutdown for an update in %d seconds" arkBackupPreUpdate="false" # set this to true if you want to perform a backup before updating +arkwarnminutes="30" # number of minutes to warn players when using update --warn From 1b24a83708acaf1ee04692da267f9b737d158632 Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Thu, 5 Nov 2015 12:02:45 +0100 Subject: [PATCH 09/39] Change image base to debian:8 --- Dockerfile | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2e5f8fc..1d8fdd7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:14.04 +FROM debian:8 MAINTAINER TuRzAm @@ -26,7 +26,7 @@ ENV STEAMPORT 7778 # Install dependencies RUN apt-get update &&\ - apt-get install -y curl lib32gcc1 lsof git + apt-get install -y curl lib32gcc1 lsof git sudo cron # Enable passwordless sudo for users under the "sudo" group RUN sed -i.bkp -e \ @@ -63,11 +63,8 @@ RUN ln -s /usr/local/bin/arkmanager /usr/bin/arkmanager # Define default config file in /ark COPY arkmanager-system.cfg /etc/arkmanager/arkmanager.cfg - RUN chown steam -R /ark && chmod 755 -R /ark - - USER steam # download steamcmd @@ -79,8 +76,6 @@ RUN mkdir /home/steam/steamcmd &&\ # First run is on anonymous to download the app RUN /home/steam/steamcmd/steamcmd.sh +login anonymous +quit - - EXPOSE ${STEAMPORT} 32330 ${SERVERPORT} VOLUME /ark From 57213b0d3911267d5e37d67d32d314a067dfc865 Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Thu, 5 Nov 2015 12:15:20 +0100 Subject: [PATCH 10/39] Revert to base image ubuntu:14.04 --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1d8fdd7..7e8d580 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:8 +FROM ubuntu:14.04 MAINTAINER TuRzAm @@ -26,7 +26,7 @@ ENV STEAMPORT 7778 # Install dependencies RUN apt-get update &&\ - apt-get install -y curl lib32gcc1 lsof git sudo cron + apt-get install -y curl lib32gcc1 lsof git # Enable passwordless sudo for users under the "sudo" group RUN sed -i.bkp -e \ From 7c45399b4822bb19640268c7edef233c620400b7 Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Thu, 5 Nov 2015 14:48:46 +0100 Subject: [PATCH 11/39] Update README.md --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f16b54c..e634f03 100644 --- a/README.md +++ b/README.md @@ -93,9 +93,9 @@ Steam server port (can't rebind with docker, it doesn't work) (default : 7778) + __BACKUPONSTART__ 1 : Backup the server when the container is started. 0: no backup (default : 1) + __UPDATEPONSTART__ -1 : Update the server when the container is started. 0: no update (default : 1) -+ __WARNMINUTE__ -Number of minute to warn the players when auto-update (default : 30) +1 : Update the server when the container is started. 0: no update (default : 1) ++ __TZ__ +Time Zone : Set the container timezone (for crontab). --- @@ -131,7 +131,8 @@ Number of minute to warn the players when auto-update (default : 30) - Works with Ark Server Tools 1.4 [See changelog here](https://github.com/FezVrasta/ark-server-tools/releases/tag/v1.4) - Handle mods && auto update mods + 1.2 : - - Remove variable AUTOBACKUP & AUTOUPDATE + - Remove variable AUTOBACKUP & AUTOUPDATE + - Remove variable WARNMINUTE (can now be find in arkmanager.cfg) - Add crontab support - You can now config crontab with the file /your/ark/path/crontab From 67a4e95509ee3102a9a9b75542aa21c8ac47f706 Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Thu, 5 Nov 2015 14:50:09 +0100 Subject: [PATCH 12/39] Fix GameUserSettings Name. --- run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run.sh b/run.sh index 001c610..cd58072 100644 --- a/run.sh +++ b/run.sh @@ -17,7 +17,7 @@ fi [ ! -d /ark/log ] && mkdir /ark/log [ ! -d /ark/backup ] && mkdir /ark/backup [ ! -f /ark/Game.ini ] && ln -s /ark/server/ShooterGame/Saved/Config/Game.ini /ark/Game.ini -[ ! -f /ark/GameUserSetting.ini ] && ln -s /ark/server/ShooterGame/Saved/Config/GameUserSetting.ini /ark/GameUserSetting.ini +[ ! -f /ark/GameUserSettings.ini ] && ln -s /ark/server/ShooterGame/Saved/Config/GameUserSetting.ini /ark/GameUserSettings.ini From 94f2005ba7431f885962fa0a6681435e14cd27ad Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Thu, 5 Nov 2015 16:02:00 +0100 Subject: [PATCH 13/39] Add Template config file in template directory --- Dockerfile | 1 + crontab | 16 ++++++++++++++++ run.sh | 34 ++++++++++++---------------------- 3 files changed, 29 insertions(+), 22 deletions(-) create mode 100644 crontab diff --git a/Dockerfile b/Dockerfile index 7e8d580..74bf6af 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,6 +44,7 @@ RUN usermod -a -G sudo steam # Copy & rights to folders COPY run.sh /home/steam/run.sh +COPY crontab /home/steam/crontab COPY arkmanager-user.cfg /home/steam/arkmanager.cfg RUN chmod 777 /home/steam/run.sh diff --git a/crontab b/crontab new file mode 100644 index 0000000..91e388f --- /dev/null +++ b/crontab @@ -0,0 +1,16 @@ +# Example of job definition: +# .---------------- minute (0 - 59) +# | .------------- hour (0 - 23) +# | | .---------- day of month (1 - 31) +# | | | .------- month (1 - 12) OR jan,feb,mar,apr ... +# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat +# | | | | | +# * * * * * user command to be executed +# Example : update every hour +# 0 * * * * arkmanager update +# Example : backup every 15min +# */15 * * * * arkmanager backup +# Example : backup every day at midnight +# 0 0 * * * arkmanager backup +# WARNING : the container timezone is maybe not your current timezone +# You can sync them with option -v /etc/localtime:/etc/localtime:ro or -e "TZ=UTC" diff --git a/run.sh b/run.sh index cd58072..8d0bdb2 100644 --- a/run.sh +++ b/run.sh @@ -12,12 +12,16 @@ if [ ! -w /ark ]; then exit 1 fi +# Add a template directory to store the last version of config file +[ ! -d /ark/template ] && mkdir /ark/template +[ -f /ark/arkmanager.cfg ] && cp /home/steam/arkmanager.cfg /ark/template/arkmanager.cfg +[ -f /ark/crontab ] && cp /home/steam/crontab /ark/template/crontab # Creating directory tree && symbolic link [ ! -f /ark/arkmanager.cfg ] && cp /home/steam/arkmanager.cfg /ark/arkmanager.cfg [ ! -d /ark/log ] && mkdir /ark/log [ ! -d /ark/backup ] && mkdir /ark/backup -[ ! -f /ark/Game.ini ] && ln -s /ark/server/ShooterGame/Saved/Config/Game.ini /ark/Game.ini -[ ! -f /ark/GameUserSettings.ini ] && ln -s /ark/server/ShooterGame/Saved/Config/GameUserSetting.ini /ark/GameUserSettings.ini +[ ! -f /ark/Game.ini ] && ln -s /ark/server/ShooterGame/Saved/Config/LinuxServer/Game.ini /ark/Game.ini +[ ! -f /ark/GameUserSettings.ini ] && ln -s /ark/server/ShooterGame/Saved/Config/LinuxServer/GameUserSettings.ini /ark/GameUserSettings.ini @@ -38,30 +42,16 @@ else fi fi -# We load the crontab file if it exist. -if [ -f /ark/crontab ]; then +# If there is uncommented line in the file +CRONNUMBER=`grep -v "^#" /ark/crontab | wc -l` +if [ $CRONNUMBER -gt 0 ]; then + echo "Loading crontab..." + # We load the crontab file if it exist. crontab /ark/crontab # Cron is attached to this process sudo cron -f & else - cat <<EOT >> /ark/crontab -# Example of job definition: -# .---------------- minute (0 - 59) -# | .------------- hour (0 - 23) -# | | .---------- day of month (1 - 31) -# | | | .------- month (1 - 12) OR jan,feb,mar,apr ... -# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat -# | | | | | -# * * * * * user command to be executed -# Example : update every hour -# 0 * * * * arkmanager update -# Example : backup every 15min -# */15 * * * * arkmanager backup -# Example : backup every day at midnight -# 0 0 * * * arkmanager backup -# WARNING : the container timezone is maybe not your current timezone -# You can sync them with option -v /etc/localtime:/etc/localtime:ro or -e "TZ=UTC" -EOT + echo "No crontab set." fi # Launching ark server From 575921cf7914239a69d3ce366241aabe90338d06 Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Thu, 5 Nov 2015 16:10:08 +0100 Subject: [PATCH 14/39] Fix symbolic link & always copy template file --- Dockerfile | 3 +++ run.sh | 12 ++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 74bf6af..054704a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -81,5 +81,8 @@ EXPOSE ${STEAMPORT} 32330 ${SERVERPORT} VOLUME /ark +# Change the working directory to /arkd +WORKDIR /ark + # Update game launch the game. ENTRYPOINT ["/home/steam/run.sh"] diff --git a/run.sh b/run.sh index 8d0bdb2..fbe2fe6 100644 --- a/run.sh +++ b/run.sh @@ -12,16 +12,20 @@ if [ ! -w /ark ]; then exit 1 fi +# Change working directory to /ark to allow relative path +cd /ark + # Add a template directory to store the last version of config file [ ! -d /ark/template ] && mkdir /ark/template -[ -f /ark/arkmanager.cfg ] && cp /home/steam/arkmanager.cfg /ark/template/arkmanager.cfg -[ -f /ark/crontab ] && cp /home/steam/crontab /ark/template/crontab +# We overwrite the template file each time +cp /home/steam/arkmanager.cfg /ark/template/arkmanager.cfg +cp /home/steam/crontab /ark/template/crontab # Creating directory tree && symbolic link [ ! -f /ark/arkmanager.cfg ] && cp /home/steam/arkmanager.cfg /ark/arkmanager.cfg [ ! -d /ark/log ] && mkdir /ark/log [ ! -d /ark/backup ] && mkdir /ark/backup -[ ! -f /ark/Game.ini ] && ln -s /ark/server/ShooterGame/Saved/Config/LinuxServer/Game.ini /ark/Game.ini -[ ! -f /ark/GameUserSettings.ini ] && ln -s /ark/server/ShooterGame/Saved/Config/LinuxServer/GameUserSettings.ini /ark/GameUserSettings.ini +[ ! -f /ark/Game.ini ] && ln -s server/ShooterGame/Saved/Config/LinuxServer/Game.ini Game.ini +[ ! -f /ark/GameUserSettings.ini ] && ln -s server/ShooterGame/Saved/Config/LinuxServer/GameUserSettings.ini GameUserSettings.ini From 536e5e831c2e2c1edf8946e6a573a64e2b02609a Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Thu, 5 Nov 2015 16:22:43 +0100 Subject: [PATCH 15/39] Update README.md --- README.md | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index e634f03..4cbf40b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Docker build for managing an ARK: Survival Evolved server. This image uses [Ark Server Tools](https://github.com/FezVrasta/ark-server-tools) to manage an ark server. -*If you use an old volume, delete arkmanager.cfg to get the new configuration file.* +*If you use an old volume, get the new arkmanager.cfg in the template directory.* __Don't forget to use `docker pull turzam/ark` to get the latest version of the image__ @@ -55,10 +55,10 @@ __You can check all available command for arkmanager__ [here](https://github.com You can easily configure automatic update and backup. If you edit the file `/my/path/to/ark/crontab` you can add your crontab job. For example : -`# Update the server every hours` -`0 * * * * arkmanager update --warn --update-mods >> /ark/log/crontab.log 2&>1` - `# Backup the server each day at 00:00 ` - `0 0 * * * arkmanager backup >> /ark/log/crontab.log 2&>1` +`# Update the server every hours ` +`0 * * * * arkmanager update --warn --update-mods >> /ark/log/crontab.log 2&>1 ` +`# Backup the server each day at 00:00 ` +`0 0 * * * arkmanager backup >> /ark/log/crontab.log 2&>1` *You can check [this website](http://www.unix.com/man-page/linux/5/crontab/) for more information on cron.* --- @@ -69,8 +69,8 @@ For example : - Wait for ark to be downloaded installed and launched, then Ctrl+C to stop the server. - Modify */my/path/to/ark/GameUserSetting.ini and Game.ini* - Add auto update every day and autobackup by editing */my/path/to/ark/crontab* with this lines : -`0 0 * * * arkmanager update --warn --update-mods >> /ark/log/crontab.log 2&>1 - 0 0 * * * arkmanager backup >> /ark/log/crontab.log 2&>1 ` +`0 0 * * * arkmanager update --warn --update-mods >> /ark/log/crontab.log 2&>1` +`0 0 * * * arkmanager backup >> /ark/log/crontab.log 2&>1` - `docker start ark` - Check your server with : `docker exec ark arkmanager status` @@ -95,7 +95,7 @@ Steam server port (can't rebind with docker, it doesn't work) (default : 7778) + __UPDATEPONSTART__ 1 : Update the server when the container is started. 0: no update (default : 1) + __TZ__ -Time Zone : Set the container timezone (for crontab). +Time Zone : Set the container timezone (for crontab). (You can get your timezone posix format with the command `tzselect`. For example, France is "Europe/Paris"). --- @@ -105,10 +105,13 @@ Time Zone : Set the container timezone (for crontab). + /ark/server : Server files and data. + /ark/log : logs + /ark/backup : backups - + /ark/arkmanager.cfg : config file + + /ark/arkmanager.cfg : config file for Ark Server Tools + /ark/crontab : crontab config file + /ark/Game.ini : ark game.ini config file + /ark/GameUserSetting.ini : ark gameusersetting.ini config file + + /ark/template : Default config files + + /ark/template/arkmanager.cfg : default config file for Ark Server Tools + + /ark/template/crontab : default config file for crontab --- @@ -135,4 +138,6 @@ Time Zone : Set the container timezone (for crontab). - Remove variable WARNMINUTE (can now be find in arkmanager.cfg) - Add crontab support - You can now config crontab with the file /your/ark/path/crontab + - Add template directory with default config files. + - Add documentation on TZ variable. From a9e52d1dca363e6fc58b1b90234d74a1db6e4f47 Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Thu, 5 Nov 2015 16:35:05 +0100 Subject: [PATCH 16/39] Update README.md --- README.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4cbf40b..9a64f36 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ __Don't forget to use `docker pull turzam/ark` to get the latest version of the ## Features - Easy install (no steamcmd / lib32... to install) - - Use Ark Server Tools : update/install/start/backup/rcon + - Use Ark Server Tools : update/install/start/backup/rcon/mods - Easy crontab configuration - Easy access to ark config file - Mods handling (via Ark Server Tools) @@ -22,7 +22,7 @@ Fast & Easy server setup : You can map the ark volume to access config files : `docker run -d -p 7778:7778 -p 7778:7778/udp -p 27015:27015 -p 27015:27015/udp -e SESSIONNAME=myserver -v /my/path/to/ark:/ark --name ark turzam/ark` -Then you can edit */my/path/to/ark/arkcmanager.cfg* (the values override GameUserSetting.ini) and */my/path/to/ark/[GameUserSetting.ini/Game.ini]* +Then you can edit */my/path/to/ark/arkmanager.cfg* (the values override GameUserSetting.ini) and */my/path/to/ark/[GameUserSetting.ini/Game.ini]* You can manager your server with rcon if you map the rcon port (you can rebind the rcon port with docker): `docker run -d -p 7778:7778 -p 7778:7778/udp -p 27015:27015 -p 27015:27015/udp -p 32330:32330 -e SESSIONNAME=myserver --name ark turzam/ark` @@ -34,6 +34,9 @@ You can change server and steam port to allow multiple servers on same host: You can check your server with : `docker exec ark arkmanager status` +You can manually update your mods: +`docker exec ark arkmanager update --update-mods` + You can manually update your server: `docker exec ark arkmanager update --force` @@ -61,14 +64,17 @@ For example : `0 0 * * * arkmanager backup >> /ark/log/crontab.log 2&>1` *You can check [this website](http://www.unix.com/man-page/linux/5/crontab/) for more information on cron.* +To add mods, you only need to change the variable ark_GameModIds in *arkmanager.cfg* with a list of your modIds (like this `ark_GameModIds="987654321,1234568"`). If UPDATEONSTART is enable, just restart your docker or use `docker exec ark arkmanager update --update-mods`. + --- ## Recommended Usage - First run `docker run -it -p 7778:7778 -p 7778:7778/udp -p 27015:27015 -p 27015:27015/udp -p 32330:32330 -e SESSIONNAME=myserver -e ADMINPASSWORD="mypasswordadmin" -e AUTOUPDATE=120 -e AUTOBACKUP=60 -e WARNMINUTE=30 -v /my/path/to/ark:/ark --name ark turzam/ark` - Wait for ark to be downloaded installed and launched, then Ctrl+C to stop the server. -- Modify */my/path/to/ark/GameUserSetting.ini and Game.ini* -- Add auto update every day and autobackup by editing */my/path/to/ark/crontab* with this lines : +- Edit */my/path/to/ark/GameUserSetting.ini and Game.ini* +- Edit */my/path/to/ark/arkserver.cfg* to add mods and configure warning time. +- Add auto update every day and autobackup by editing */my/path/to/ark/crontab* with this lines : `0 0 * * * arkmanager update --warn --update-mods >> /ark/log/crontab.log 2&>1` `0 0 * * * arkmanager backup >> /ark/log/crontab.log 2&>1` - `docker start ark` From a179f36264139eec17caedf3c01927b60b88a41a Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Fri, 13 Nov 2015 14:21:52 +0100 Subject: [PATCH 17/39] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9a64f36..8aabce0 100644 --- a/README.md +++ b/README.md @@ -58,8 +58,8 @@ __You can check all available command for arkmanager__ [here](https://github.com You can easily configure automatic update and backup. If you edit the file `/my/path/to/ark/crontab` you can add your crontab job. For example : -`# Update the server every hours ` -`0 * * * * arkmanager update --warn --update-mods >> /ark/log/crontab.log 2&>1 ` +`# Update the server every hours` +`0 * * * * arkmanager update --warn --update-mods >> /ark/log/crontab.log 2&>1` `# Backup the server each day at 00:00 ` `0 0 * * * arkmanager backup >> /ark/log/crontab.log 2&>1` *You can check [this website](http://www.unix.com/man-page/linux/5/crontab/) for more information on cron.* From 6a9340876159ea937b2c1ca2ca7175d7e03a23c3 Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Mon, 4 Jan 2016 15:39:28 +0100 Subject: [PATCH 18/39] Fix Typo --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8aabce0..b37c76e 100644 --- a/README.md +++ b/README.md @@ -59,9 +59,9 @@ You can easily configure automatic update and backup. If you edit the file `/my/path/to/ark/crontab` you can add your crontab job. For example : `# Update the server every hours` -`0 * * * * arkmanager update --warn --update-mods >> /ark/log/crontab.log 2&>1` +`0 * * * * arkmanager update --warn --update-mods >> /ark/log/crontab.log 2>&1` `# Backup the server each day at 00:00 ` -`0 0 * * * arkmanager backup >> /ark/log/crontab.log 2&>1` +`0 0 * * * arkmanager backup >> /ark/log/crontab.log 2>&1` *You can check [this website](http://www.unix.com/man-page/linux/5/crontab/) for more information on cron.* To add mods, you only need to change the variable ark_GameModIds in *arkmanager.cfg* with a list of your modIds (like this `ark_GameModIds="987654321,1234568"`). If UPDATEONSTART is enable, just restart your docker or use `docker exec ark arkmanager update --update-mods`. @@ -75,8 +75,8 @@ To add mods, you only need to change the variable ark_GameModIds in *arkmanager. - Edit */my/path/to/ark/GameUserSetting.ini and Game.ini* - Edit */my/path/to/ark/arkserver.cfg* to add mods and configure warning time. - Add auto update every day and autobackup by editing */my/path/to/ark/crontab* with this lines : -`0 0 * * * arkmanager update --warn --update-mods >> /ark/log/crontab.log 2&>1` -`0 0 * * * arkmanager backup >> /ark/log/crontab.log 2&>1` +`0 0 * * * arkmanager update --warn --update-mods >> /ark/log/crontab.log 2>&1` +`0 0 * * * arkmanager backup >> /ark/log/crontab.log 2>&1` - `docker start ark` - Check your server with : `docker exec ark arkmanager status` From 7a16e83b09ecd1cfb82b011da9be6afe14ef58d7 Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Tue, 5 Jan 2016 10:32:57 +0100 Subject: [PATCH 19/39] Add mods download on first run --- run.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/run.sh b/run.sh index fbe2fe6..fb38aa4 100644 --- a/run.sh +++ b/run.sh @@ -33,6 +33,8 @@ if [ ! -d "/ark/server" ] || [ ! -f "/ark/server/arkversion" ];then arkmanager install # Create mod dir mkdir /ark/server/ShooterGame/Content/Mods + # Download mods + arkmanager update --update-mods else if [ ${BACKUPONSTART} -eq 1 ]; then From fe31ba1f82eb2a54d8209f12cbf09f7ebdcc69e5 Mon Sep 17 00:00:00 2001 From: Lennart Weller <lhw+github@ring0.de> Date: Thu, 28 Jan 2016 15:04:19 +0100 Subject: [PATCH 20/39] Add a docker-compose example file --- docker-compose.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..bf00912 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,17 @@ +ark: + image: turzam/ark + environment: + SESSIONNAME: Ark Docker + SERVERMAP: TheIsland + SERVERPASSWORD: + ADMINPASSWORD: adminpassword + BACKUPONSTART: 1 + UPDATEONSTART: 1 + volumes: + - /my/path/to/ark:/ark + ports: + - 7778:7778/udp + - 7778:7778 + - 27015:27015/udp + - 27015:27015 + - 32330:32330 From 6e5e3c2b81742236d91d6b007af71c5189040672 Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Wed, 23 Mar 2016 15:31:28 +0100 Subject: [PATCH 21/39] Upgrade to Ark Server Tools 1.5 --- Dockerfile | 9 ++++++++- arkmanager-system.cfg | 4 ++++ arkmanager-user.cfg | 17 ++++++++++++++++- docker-compose.yml | 2 ++ run.sh | 34 ++++++++++++++++++++++++---------- 5 files changed, 54 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 054704a..a3dbcab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,6 +23,10 @@ ENV BRANCH master ENV SERVERPORT 27015 # Steam port (you can't remap with docker, it doesn't work) ENV STEAMPORT 7778 +# if the server should backup after stopping +ENV BACKUPONSTOP 0 +# If the server warn the players before stopping +ENV WARNONSTOP 0 # Install dependencies RUN apt-get update &&\ @@ -61,9 +65,12 @@ RUN ./install.sh steam # Allow crontab to call arkmanager RUN ln -s /usr/local/bin/arkmanager /usr/bin/arkmanager -# Define default config file in /ark +# Define default config file in /etc/arkmanager COPY arkmanager-system.cfg /etc/arkmanager/arkmanager.cfg +# Define default config file in /etc/arkmanager +COPY instance.cfg /etc/arkmanager/instances/main.cfg + RUN chown steam -R /ark && chmod 755 -R /ark USER steam diff --git a/arkmanager-system.cfg b/arkmanager-system.cfg index ab328d1..b665a2b 100644 --- a/arkmanager-system.cfg +++ b/arkmanager-system.cfg @@ -17,6 +17,7 @@ arkserverroot="/ark/server" # path of yo arkserverexec="ShooterGame/Binaries/Linux/ShooterGameServer" # name of ARK server executable arkbackupdir="/ark/backup" # path to backup directory arkautorestartfile="ShooterGame/Saved/.autorestart" # path to autorestart file +arkStagingDir="/ark/staging" # config Service servicename="arkserv" # Name of the service (don't change if you don't know what are you doing) @@ -30,5 +31,8 @@ ark_RCONPort="32330" # RCON Port # steamdb specific appid=376030 # Linux server App ID +mod_appid=346110 # App ID for mods + +defaultinstance="main" source /ark/arkmanager.cfg diff --git a/arkmanager-user.cfg b/arkmanager-user.cfg index a972ff4..edd74b1 100644 --- a/arkmanager-user.cfg +++ b/arkmanager-user.cfg @@ -3,6 +3,8 @@ # comment out these values if you want to define them # inside your GameUserSettings.ini file serverMap=${SERVERMAP} # server map (default TheIsland) +#serverMapModId="469987622" # Uncomment this to specify the Map Mod Id (<fileid> in http://steamcommunity.com/sharedfiles/filedetails/?id=<fileid>) +#ark_TotalConversionMod="496735411" # Uncomment this to specify a total-conversion mod ark_SessionName=${SESSIONNAME} # if your session name needs special characters please use the .ini instead ark_ServerPassword=${SERVERPASSWORD} # ARK server password, empty: no password required to login ark_ServerAdminPassword=${ADMINPASSWORD} # ARK server admin password, KEEP IT SAFE! @@ -26,10 +28,23 @@ mod_branch=Windows # ARK server options - i.e. for -optname=val, use arkopt_optname=val #arkopt_StructureDestructionTag=DestroySwampSnowStructures +#ark_AltSaveDirectoryName="SotF" # Uncomment to specify a different save directory name # Update warning messages # Modify as desired, putting the %d replacement operator where the number belongs msgWarnUpdateMinutes="This ARK server will shutdown for an update in %d minutes" msgWarnUpdateSeconds="This ARK server will shutdown for an update in %d seconds" +msgWarnRestartMinutes="This ARK server will shutdown for a restart in %d minutes" +msgWarnRestartSeconds="This ARK server will shutdown for a restart in %d seconds" +msgWarnShutdownMinutes="This ARK server will shutdown in %d minutes" +msgWarnShutdownSeconds="This ARK server will shutdown in %d seconds" + +# config environment +arkwarnminutes="60" # number of minutes to warn players when using update --warn +arkAutoUpdateOnStart="false" # set this to true if you want to always update before startup arkBackupPreUpdate="false" # set this to true if you want to perform a backup before updating -arkwarnminutes="30" # number of minutes to warn players when using update --warn + +# Options to automatically remove old backups to keep backup size in check +# Each compressed backup is generally about 1-2MB in size. +arkMaxBackupSizeMB="500" # Set to automatically remove old backups when size exceeds this limit +#arkMaxBackupSizeGB="2" # Uncomment this and comment the above to specify the limit in whole GB diff --git a/docker-compose.yml b/docker-compose.yml index bf00912..8a466d0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,6 +7,8 @@ ark: ADMINPASSWORD: adminpassword BACKUPONSTART: 1 UPDATEONSTART: 1 + BACKUPONSTOP: 0 + WARNONSTOP: 0 volumes: - /my/path/to/ark:/ark ports: diff --git a/run.sh b/run.sh index fb38aa4..f235743 100644 --- a/run.sh +++ b/run.sh @@ -7,6 +7,19 @@ mkfifo /tmp/FIFO export TERM=linux +function stop { + if [ ${BACKUPONSTOP} -eq 1 ]; then + echo "[Backup on stop]" + arkmanager backup + fi + if [ ${WARNONSTOP} -eq 1 ];then + arkmanager stop --warn + else + arkmanager stop + fi + exit +} + if [ ! -w /ark ]; then echo "[Error] Can't access ark directory. Check permissions on your mapped directory with /ark" exit 1 @@ -24,30 +37,27 @@ cp /home/steam/crontab /ark/template/crontab [ ! -f /ark/arkmanager.cfg ] && cp /home/steam/arkmanager.cfg /ark/arkmanager.cfg [ ! -d /ark/log ] && mkdir /ark/log [ ! -d /ark/backup ] && mkdir /ark/backup +[ ! -d /ark/staging ] && mkdir /ark/staging [ ! -f /ark/Game.ini ] && ln -s server/ShooterGame/Saved/Config/LinuxServer/Game.ini Game.ini [ ! -f /ark/GameUserSettings.ini ] && ln -s server/ShooterGame/Saved/Config/LinuxServer/GameUserSettings.ini GameUserSettings.ini +[ ! -f /ark/crontab ] && cp /ark/template/crontab /ark/crontab if [ ! -d "/ark/server" ] || [ ! -f "/ark/server/arkversion" ];then + mkdir /ark/server arkmanager install # Create mod dir mkdir /ark/server/ShooterGame/Content/Mods - # Download mods - arkmanager update --update-mods else if [ ${BACKUPONSTART} -eq 1 ]; then echo "[Backup]" arkmanager backup fi - - if [ ${UPDATEONSTART} -eq 1 ]; then - echo "[Update]" - arkmanager update --update-mods - fi fi + # If there is uncommented line in the file CRONNUMBER=`grep -v "^#" /ark/crontab | wc -l` if [ $CRONNUMBER -gt 0 ]; then @@ -61,13 +71,17 @@ else fi # Launching ark server -arkmanager start +if [ $UPDATEONSTART -eq 0 ]; then + arkmanager start -noautoupdate +else + arkmanager start +fi # Stop server in case of signal INT or TERM echo "Waiting..." -trap 'arkmanager stop;' INT -trap 'arkmanager stop' TERM +trap stop INT +trap stop TERM read < /tmp/FIFO & wait From 22e5a21e0786dddd291d1d1f19fbbdedce6ba7a0 Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Wed, 23 Mar 2016 15:32:02 +0100 Subject: [PATCH 22/39] Add instance.cfg --- instance.cfg | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 instance.cfg diff --git a/instance.cfg b/instance.cfg new file mode 100644 index 0000000..1585d84 --- /dev/null +++ b/instance.cfg @@ -0,0 +1,2 @@ +# Config root directory +arkserverroot="/ark/server" From b03fff8ddb4ddca60a0e20b1fd2db94838470813 Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Wed, 23 Mar 2016 15:44:04 +0100 Subject: [PATCH 23/39] Update README.md --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index b37c76e..998b1bd 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,10 @@ Steam server port (can't rebind with docker, it doesn't work) (default : 7778) 1 : Backup the server when the container is started. 0: no backup (default : 1) + __UPDATEPONSTART__ 1 : Update the server when the container is started. 0: no update (default : 1) ++ __BACKUPONSTOP__ +1 : Backup the server when the container is stopped. 0: no backup (default : 0) ++ __WARNONSTOP__ +1 : Warn the players before the container is stopped. 0: no warning (default : 0) + __TZ__ Time Zone : Set the container timezone (for crontab). (You can get your timezone posix format with the command `tzselect`. For example, France is "Europe/Paris"). @@ -118,6 +122,7 @@ Time Zone : Set the container timezone (for crontab). (You can get your timezone + /ark/template : Default config files + /ark/template/arkmanager.cfg : default config file for Ark Server Tools + /ark/template/crontab : default config file for crontab + + /ark/staging : default directory if you use the --downloadonly option when updating. --- @@ -146,4 +151,12 @@ Time Zone : Set the container timezone (for crontab). (You can get your timezone - You can now config crontab with the file /your/ark/path/crontab - Add template directory with default config files. - Add documentation on TZ variable. ++ 1.3 : + - Add BACKUPONSTOP to backup the server when you stop the server (thanks to *fkoester*) + - Add WARNONSTOP to add warning message when you stop the server (default: 60 min) + - Uses Ark Server Tools v1.5 + - Compressing backups so they take up less space + - Downloading updates to a staging directory before applying + - Added support for automatically updating on restart + - Show a spinner when updating From d177be717c73caff8b07ea7a2da9182ecc670028 Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Wed, 23 Mar 2016 16:01:54 +0100 Subject: [PATCH 24/39] Checkout the tag v1.5 --- Dockerfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index a3dbcab..670b552 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,8 +17,8 @@ ENV NBPLAYERS 70 ENV UPDATEONSTART 1 # if the server is backup when start with docker start ENV BACKUPONSTART 1 -# branch on github for ark server tools -ENV BRANCH master +# Tag on github for ark server tools +ENV GIT_TAG v1.5 # Server PORT (you can't remap with docker, it doesn't work) ENV SERVERPORT 27015 # Steam port (you can't remap with docker, it doesn't work) @@ -56,7 +56,9 @@ RUN mkdir /ark # We use the git method, because api github has a limit ;) -RUN git clone -b $BRANCH https://github.com/FezVrasta/ark-server-tools.git /home/steam/ark-server-tools +RUN git clone https://github.com/FezVrasta/ark-server-tools.git /home/steam/ark-server-tools +WORKDIR /home/steam/ark-server-tools/ +RUN git checkout $GIT_TAG # Install WORKDIR /home/steam/ark-server-tools/tools RUN chmod +x install.sh From 4b74e14d4ac719e2646d00fac01e841ba00036ec Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Wed, 23 Mar 2016 16:06:42 +0100 Subject: [PATCH 25/39] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 998b1bd..ec89afe 100644 --- a/README.md +++ b/README.md @@ -152,9 +152,9 @@ Time Zone : Set the container timezone (for crontab). (You can get your timezone - Add template directory with default config files. - Add documentation on TZ variable. + 1.3 : - - Add BACKUPONSTOP to backup the server when you stop the server (thanks to *fkoester*) + - Add BACKUPONSTOP to backup the server when you stop the server (thanks to [fkoester](https://github.com/fkoester)) - Add WARNONSTOP to add warning message when you stop the server (default: 60 min) - - Uses Ark Server Tools v1.5 + - Works with Ark Server Tools v1.5 - Compressing backups so they take up less space - Downloading updates to a staging directory before applying - Added support for automatically updating on restart From dcf915587f9e6d43d6f70361bb98de8bfb3aa4e7 Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Mon, 4 Apr 2016 10:48:55 +0200 Subject: [PATCH 26/39] Fix issue #10 : set the flag arkAutoUpdateOnStart to true. --- arkmanager-system.cfg | 3 +++ arkmanager-user.cfg | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/arkmanager-system.cfg b/arkmanager-system.cfg index b665a2b..86a2945 100644 --- a/arkmanager-system.cfg +++ b/arkmanager-system.cfg @@ -33,6 +33,9 @@ ark_RCONPort="32330" # RCON Port appid=376030 # Linux server App ID mod_appid=346110 # App ID for mods +# Need to be true to work with UPDATEPONSTART (See #10) +arkAutoUpdateOnStart="true" # set this to true if you want to always update before startup + defaultinstance="main" source /ark/arkmanager.cfg diff --git a/arkmanager-user.cfg b/arkmanager-user.cfg index edd74b1..f5d3ff2 100644 --- a/arkmanager-user.cfg +++ b/arkmanager-user.cfg @@ -41,7 +41,6 @@ msgWarnShutdownSeconds="This ARK server will shutdown in %d seconds" # config environment arkwarnminutes="60" # number of minutes to warn players when using update --warn -arkAutoUpdateOnStart="false" # set this to true if you want to always update before startup arkBackupPreUpdate="false" # set this to true if you want to perform a backup before updating # Options to automatically remove old backups to keep backup size in check From 50db7b51b9bd6d584b361d5cf472af774e55e10e Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Thu, 7 Jul 2016 16:35:42 +0200 Subject: [PATCH 27/39] Resolve #12 : expose UDP ports. --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 670b552..3a3724a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -87,6 +87,8 @@ RUN mkdir /home/steam/steamcmd &&\ RUN /home/steam/steamcmd/steamcmd.sh +login anonymous +quit EXPOSE ${STEAMPORT} 32330 ${SERVERPORT} +# Add UDP +EXPOSE ${STEAMPORT}/udp ${SERVERPORT}/udp VOLUME /ark From 142c15a438c04ce30ecb3a6ecc96698c543ecfcb Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Fri, 8 Jul 2016 16:12:46 +0200 Subject: [PATCH 28/39] #11 : add UID & GID. --- Dockerfile | 11 +++++++++-- run.sh | 14 ++++++-------- user.sh | 21 +++++++++++++++++++++ 3 files changed, 36 insertions(+), 10 deletions(-) create mode 100644 user.sh diff --git a/Dockerfile b/Dockerfile index 3a3724a..47b2b50 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,6 +27,10 @@ ENV STEAMPORT 7778 ENV BACKUPONSTOP 0 # If the server warn the players before stopping ENV WARNONSTOP 0 +# UID of the user steam +ENV UID 1000 +# GID of the user steam +ENV GID 1000 # Install dependencies RUN apt-get update &&\ @@ -48,10 +52,13 @@ RUN usermod -a -G sudo steam # Copy & rights to folders COPY run.sh /home/steam/run.sh +COPY user.sh /home/steam/user.sh COPY crontab /home/steam/crontab COPY arkmanager-user.cfg /home/steam/arkmanager.cfg +RUN touch /root/.bash_profile RUN chmod 777 /home/steam/run.sh +RUN chmod 777 /home/steam/user.sh RUN mkdir /ark @@ -75,7 +82,7 @@ COPY instance.cfg /etc/arkmanager/instances/main.cfg RUN chown steam -R /ark && chmod 755 -R /ark -USER steam +#USER steam # download steamcmd RUN mkdir /home/steam/steamcmd &&\ @@ -96,4 +103,4 @@ VOLUME /ark WORKDIR /ark # Update game launch the game. -ENTRYPOINT ["/home/steam/run.sh"] +ENTRYPOINT ["/home/steam/user.sh"] diff --git a/run.sh b/run.sh index f235743..a6721af 100644 --- a/run.sh +++ b/run.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash echo "###########################################################################" echo "# Ark Server - " `date` +echo "# UID $UID - GID $GID" echo "###########################################################################" [ -p /tmp/FIFO ] && rm /tmp/FIFO mkfifo /tmp/FIFO @@ -20,10 +21,7 @@ function stop { exit } -if [ ! -w /ark ]; then - echo "[Error] Can't access ark directory. Check permissions on your mapped directory with /ark" - exit 1 -fi + # Change working directory to /ark to allow relative path cd /ark @@ -38,14 +36,14 @@ cp /home/steam/crontab /ark/template/crontab [ ! -d /ark/log ] && mkdir /ark/log [ ! -d /ark/backup ] && mkdir /ark/backup [ ! -d /ark/staging ] && mkdir /ark/staging -[ ! -f /ark/Game.ini ] && ln -s server/ShooterGame/Saved/Config/LinuxServer/Game.ini Game.ini -[ ! -f /ark/GameUserSettings.ini ] && ln -s server/ShooterGame/Saved/Config/LinuxServer/GameUserSettings.ini GameUserSettings.ini +[ ! -L /ark/Game.ini ] && ln -s server/ShooterGame/Saved/Config/LinuxServer/Game.ini Game.ini +[ ! -L /ark/GameUserSettings.ini ] && ln -s server/ShooterGame/Saved/Config/LinuxServer/GameUserSettings.ini GameUserSettings.ini [ ! -f /ark/crontab ] && cp /ark/template/crontab /ark/crontab -if [ ! -d "/ark/server" ] || [ ! -f "/ark/server/arkversion" ];then - mkdir /ark/server +if [ ! -d /ark/server ] || [ ! -f /ark/server/arkversion ];then + echo "No game files found. Installing..." arkmanager install # Create mod dir mkdir /ark/server/ShooterGame/Content/Mods diff --git a/user.sh b/user.sh new file mode 100644 index 0000000..a49bdfc --- /dev/null +++ b/user.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +# Change the UID if needed +if [ ! "$(id -u steam)" -eq "$UID" ]; then + echo "Changing steam uid to $UID." + usermod -o -u "$UID" steam ; +fi +# Change gid if needed +if [ ! "$(id -g steam)" -eq "$GID" ]; then + echo "Changing steam gid to $GID." + groupmod -o -g "$GID" steam ; +fi + +# Put steam owner of directories (if the uid changed, then it's needed) +chown -R steam:steam /ark /home/steam + +# avoid error message when su -p (we need to read the /root/.bash_rc ) +chmod -R 777 /root/ + +# Launch run.sh with user steam (-p allow to keep env variables) +su -p - steam -c /home/steam/run.sh From d82ef8c3d223ca344ab6d82d5f5a7cfb1fa06e23 Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Fri, 8 Jul 2016 16:17:02 +0200 Subject: [PATCH 29/39] Update docker-compose --- docker-compose.yml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 8a466d0..0b38819 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,14 +1,16 @@ ark: - image: turzam/ark + container_name: ark + image: turzam/ark:1.3-dev environment: - SESSIONNAME: Ark Docker - SERVERMAP: TheIsland - SERVERPASSWORD: - ADMINPASSWORD: adminpassword - BACKUPONSTART: 1 - UPDATEONSTART: 1 - BACKUPONSTOP: 0 - WARNONSTOP: 0 + - SESSIONNAME=Ark Docker + - SERVERMAP=TheIsland + - SERVERPASSWORD="" + - ADMINPASSWORD=adminpassword + - BACKUPONSTART=1 + - UPDATEONSTART=1 + - TZ=Europe/Paris + - GID=1000 + - UID=1000 volumes: - /my/path/to/ark:/ark ports: From 4fa41cd219bb8d4697c8ef4a8c1a55d1725c0ffe Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Fri, 8 Jul 2016 16:26:56 +0200 Subject: [PATCH 30/39] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index ec89afe..79dc045 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,10 @@ Steam server port (can't rebind with docker, it doesn't work) (default : 7778) 1 : Warn the players before the container is stopped. 0: no warning (default : 0) + __TZ__ Time Zone : Set the container timezone (for crontab). (You can get your timezone posix format with the command `tzselect`. For example, France is "Europe/Paris"). ++ __UID__ +UID of the user used. Owner of the volume /ark ++ __GID__ +GID of the user used. Owner of the volume /ark --- @@ -159,4 +163,5 @@ Time Zone : Set the container timezone (for crontab). (You can get your timezone - Downloading updates to a staging directory before applying - Added support for automatically updating on restart - Show a spinner when updating + - Add UID & GID to set the uid & gid of the user used in the container (and permissions on the volume /ark) From 119915c382de4a0b4c50507a51448af2921b2a6a Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Tue, 12 Jul 2016 13:52:25 +0200 Subject: [PATCH 31/39] Remove steam update in image. Should work with docker hub now. --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 47b2b50..77da103 100644 --- a/Dockerfile +++ b/Dockerfile @@ -91,7 +91,8 @@ RUN mkdir /home/steam/steamcmd &&\ # First run is on anonymous to download the app -RUN /home/steam/steamcmd/steamcmd.sh +login anonymous +quit +# We can't download from docker hub anymore -_- +#RUN /home/steam/steamcmd/steamcmd.sh +login anonymous +quit EXPOSE ${STEAMPORT} 32330 ${SERVERPORT} # Add UDP From 214494a322d9548c3512fe780ec32979930934cb Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Wed, 13 Jul 2016 09:56:38 +0200 Subject: [PATCH 32/39] #12 : Fix Ark Server Tools errors on first start. --- arkmanager-system.cfg | 3 +++ run.sh | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/arkmanager-system.cfg b/arkmanager-system.cfg index 86a2945..b15199a 100644 --- a/arkmanager-system.cfg +++ b/arkmanager-system.cfg @@ -38,4 +38,7 @@ arkAutoUpdateOnStart="true" # set this to defaultinstance="main" +# We don't use the dots because it doesn't show. +progressDisplayType=spinner + source /ark/arkmanager.cfg diff --git a/run.sh b/run.sh index a6721af..55aa516 100644 --- a/run.sh +++ b/run.sh @@ -9,7 +9,7 @@ mkfifo /tmp/FIFO export TERM=linux function stop { - if [ ${BACKUPONSTOP} -eq 1 ]; then + if [ ${BACKUPONSTOP} -eq 1 ] && [ "$(ls -A server/ShooterGame/Saved/SavedArks)" ]; then echo "[Backup on stop]" arkmanager backup fi @@ -44,12 +44,15 @@ cp /home/steam/crontab /ark/template/crontab if [ ! -d /ark/server ] || [ ! -f /ark/server/arkversion ];then echo "No game files found. Installing..." + mkdir -p /ark/server/ShooterGame/Saved/SavedArks + mkdir -p /ark/server/ShooterGame/Content/Mods + mkdir -p /ark/server/ShooterGame/Binaries/Linux/ + touch /ark/server/ShooterGame/Binaries/Linux/ShooterGameServer arkmanager install # Create mod dir - mkdir /ark/server/ShooterGame/Content/Mods else - if [ ${BACKUPONSTART} -eq 1 ]; then + if [ ${BACKUPONSTART} -eq 1 ] && [ "$(ls -A server/ShooterGame/Saved/SavedArks/)" ]; then echo "[Backup]" arkmanager backup fi From 76fd195f9194ad3d2b0cb383e8134fdfe300a0f9 Mon Sep 17 00:00:00 2001 From: TuRz4m <peps.isima@gmail.com> Date: Fri, 15 Jul 2016 14:55:01 +0200 Subject: [PATCH 33/39] Update docker-compose.yml --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 0b38819..71126e9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ ark: container_name: ark - image: turzam/ark:1.3-dev + image: turzam/ark environment: - SESSIONNAME=Ark Docker - SERVERMAP=TheIsland From 665137a9f076b766b02da32e024edfb41a395f15 Mon Sep 17 00:00:00 2001 From: "Guillaume \"B.B.\" Van Hemmen" <GuillaumeHemmen@users.noreply.github.com> Date: Fri, 14 Feb 2020 22:10:57 +0100 Subject: [PATCH 34/39] Updated git tag for ark server manager --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 77da103..edf379f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,7 @@ ENV UPDATEONSTART 1 # if the server is backup when start with docker start ENV BACKUPONSTART 1 # Tag on github for ark server tools -ENV GIT_TAG v1.5 +ENV GIT_TAG v1.6.48 # Server PORT (you can't remap with docker, it doesn't work) ENV SERVERPORT 27015 # Steam port (you can't remap with docker, it doesn't work) From a217aa5a8607b3650240d438d7bf62cc0aad040a Mon Sep 17 00:00:00 2001 From: "Guillaume \"B.B.\" Van Hemmen" <GuillaumeHemmen@users.noreply.github.com> Date: Sun, 14 Jun 2020 12:31:29 +0200 Subject: [PATCH 35/39] update ark-server-tools in docker --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index edf379f..427a200 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,7 @@ ENV UPDATEONSTART 1 # if the server is backup when start with docker start ENV BACKUPONSTART 1 # Tag on github for ark server tools -ENV GIT_TAG v1.6.48 +ENV GIT_TAG v1.6.52 # Server PORT (you can't remap with docker, it doesn't work) ENV SERVERPORT 27015 # Steam port (you can't remap with docker, it doesn't work) From 4fb984b9e2cbe14111220171a3a87ffc6732fa48 Mon Sep 17 00:00:00 2001 From: "Guillaume \"B.B.\" Van Hemmen" <GuillaumeHemmen@users.noreply.github.com> Date: Sat, 28 Nov 2020 20:34:45 +0100 Subject: [PATCH 36/39] update ark-server-tools git tag --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 427a200..c4ae4f5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,7 @@ ENV UPDATEONSTART 1 # if the server is backup when start with docker start ENV BACKUPONSTART 1 # Tag on github for ark server tools -ENV GIT_TAG v1.6.52 +ENV GIT_TAG v1.6.56 # Server PORT (you can't remap with docker, it doesn't work) ENV SERVERPORT 27015 # Steam port (you can't remap with docker, it doesn't work) From 87d566639db2171beee6af374f10cf232b5be40b Mon Sep 17 00:00:00 2001 From: "Guillaume \"B.B.\" Van Hemmen" <GuillaumeHemmen@users.noreply.github.com> Date: Sat, 28 Nov 2020 20:53:38 +0100 Subject: [PATCH 37/39] upgraded ubuntu --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index c4ae4f5..c3e5c06 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:14.04 +FROM ubuntu:16.04 MAINTAINER TuRzAm From 59d96997607f4125da9b0f517f5a984f76c4676e Mon Sep 17 00:00:00 2001 From: "Guillaume \"B.B.\" Van Hemmen" <GuillaumeHemmen@users.noreply.github.com> Date: Sat, 28 Nov 2020 21:29:28 +0100 Subject: [PATCH 38/39] added sudo package --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index c3e5c06..e73fcce 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,7 +34,7 @@ ENV GID 1000 # Install dependencies RUN apt-get update &&\ - apt-get install -y curl lib32gcc1 lsof git + apt-get install -y curl lib32gcc1 lsof git sudo # Enable passwordless sudo for users under the "sudo" group RUN sed -i.bkp -e \ From 94e1ab98bdcd2eac2e85f0584b8aed06c4bd0f78 Mon Sep 17 00:00:00 2001 From: "Guillaume \"B.B.\" Van Hemmen" <GuillaumeHemmen@users.noreply.github.com> Date: Sun, 24 Jan 2021 00:31:25 +0100 Subject: [PATCH 39/39] Update run.sh --- run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run.sh b/run.sh index 55aa516..80fff6b 100644 --- a/run.sh +++ b/run.sh @@ -42,7 +42,7 @@ cp /home/steam/crontab /ark/template/crontab -if [ ! -d /ark/server ] || [ ! -f /ark/server/arkversion ];then +if [ ! -d /ark/server ] || [ ! -f /ark/server/version.txt ];then echo "No game files found. Installing..." mkdir -p /ark/server/ShooterGame/Saved/SavedArks mkdir -p /ark/server/ShooterGame/Content/Mods