Compare commits

...

24 commits
1.2 ... master

Author SHA1 Message Date
94e1ab98bd
Update run.sh 2021-01-24 00:31:25 +01:00
59d9699760
added sudo package 2020-11-28 21:29:28 +01:00
87d566639d
upgraded ubuntu 2020-11-28 20:53:38 +01:00
4fb984b9e2
update ark-server-tools git tag 2020-11-28 20:34:45 +01:00
a217aa5a86
update ark-server-tools in docker 2020-06-14 12:31:29 +02:00
665137a9f0
Updated git tag for ark server manager 2020-02-14 22:10:57 +01:00
TuRz4m
76fd195f91 Update docker-compose.yml 2016-07-15 14:55:01 +02:00
TuRz4m
214494a322 : Fix Ark Server Tools errors on first start. 2016-07-13 09:56:38 +02:00
TuRz4m
119915c382 Remove steam update in image. Should work with docker hub now. 2016-07-12 13:52:25 +02:00
TuRz4m
4fa41cd219 Update README.md 2016-07-08 16:26:56 +02:00
TuRz4m
d82ef8c3d2 Update docker-compose 2016-07-08 16:17:02 +02:00
TuRz4m
142c15a438 : add UID & GID. 2016-07-08 16:12:46 +02:00
TuRz4m
50db7b51b9 Resolve : expose UDP ports. 2016-07-07 16:35:42 +02:00
TuRz4m
dcf915587f Fix issue : set the flag arkAutoUpdateOnStart to true. 2016-04-04 10:48:55 +02:00
TuRz4m
4b74e14d4a Update README.md 2016-03-23 16:06:42 +01:00
TuRz4m
3ada6fe319 Merge branch '1.3-dev' of https://github.com/TuRz4m/Ark-docker into 1.3-dev 2016-03-23 16:02:02 +01:00
TuRz4m
d177be717c Checkout the tag v1.5 2016-03-23 16:01:54 +01:00
TuRz4m
b03fff8ddb Update README.md 2016-03-23 15:44:04 +01:00
TuRz4m
22e5a21e07 Add instance.cfg 2016-03-23 15:32:02 +01:00
TuRz4m
6e5e3c2b81 Upgrade to Ark Server Tools 1.5 2016-03-23 15:31:28 +01:00
TuRz4m
1608d2c603 Merge pull request from lhw/docker-compose
Add a docker-compose example file
2016-01-29 09:06:19 +01:00
Lennart Weller
fe31ba1f82 Add a docker-compose example file 2016-01-28 15:04:19 +01:00
TuRz4m
7a16e83b09 Add mods download on first run 2016-01-05 10:32:57 +01:00
TuRz4m
6a93408761 Fix Typo 2016-01-04 15:39:28 +01:00
8 changed files with 153 additions and 31 deletions

View file

@ -1,4 +1,4 @@
FROM ubuntu:14.04
FROM ubuntu:16.04
MAINTAINER TuRzAm
@ -17,16 +17,24 @@ 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.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)
ENV STEAMPORT 7778
# if the server should backup after stopping
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 &&\
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 \
@ -44,15 +52,20 @@ 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
# 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
@ -61,12 +74,15 @@ 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
#USER steam
# download steamcmd
RUN mkdir /home/steam/steamcmd &&\
@ -75,9 +91,12 @@ 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
EXPOSE ${STEAMPORT}/udp ${SERVERPORT}/udp
VOLUME /ark
@ -85,4 +104,4 @@ VOLUME /ark
WORKDIR /ark
# Update game launch the game.
ENTRYPOINT ["/home/steam/run.sh"]
ENTRYPOINT ["/home/steam/user.sh"]

View file

@ -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`
@ -100,8 +100,16 @@ 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").
+ __UID__
UID of the user used. Owner of the volume /ark
+ __GID__
GID of the user used. Owner of the volume /ark
---
@ -118,6 +126,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 +155,13 @@ 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](https://github.com/fkoester))
- Add WARNONSTOP to add warning message when you stop the server (default: 60 min)
- 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
- 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)

View file

@ -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,14 @@ ark_RCONPort="32330" # RCON Port
# steamdb specific
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"
# We don't use the dots because it doesn't show.
progressDisplayType=spinner
source /ark/arkmanager.cfg

View file

@ -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,22 @@ 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
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

21
docker-compose.yml Normal file
View file

@ -0,0 +1,21 @@
ark:
container_name: ark
image: turzam/ark
environment:
- 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:
- 7778:7778/udp
- 7778:7778
- 27015:27015/udp
- 27015:27015
- 32330:32330

2
instance.cfg Normal file
View file

@ -0,0 +1,2 @@
# Config root directory
arkserverroot="/ark/server"

51
run.sh
View file

@ -1,16 +1,27 @@
#!/usr/bin/env bash
echo "###########################################################################"
echo "# Ark Server - " `date`
echo "# UID $UID - GID $GID"
echo "###########################################################################"
[ -p /tmp/FIFO ] && rm /tmp/FIFO
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
function stop {
if [ ${BACKUPONSTOP} -eq 1 ] && [ "$(ls -A server/ShooterGame/Saved/SavedArks)" ]; then
echo "[Backup on stop]"
arkmanager backup
fi
if [ ${WARNONSTOP} -eq 1 ];then
arkmanager stop --warn
else
arkmanager stop
fi
exit
}
# Change working directory to /ark to allow relative path
cd /ark
@ -24,28 +35,30 @@ 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
[ ! -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
[ ! -d /ark/staging ] && mkdir /ark/staging
[ ! -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
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
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
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
@ -59,13 +72,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

21
user.sh Normal file
View file

@ -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