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 ( in http://steamcommunity.com/sharedfiles/filedetails/?id=) +#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