first commit

This commit is contained in:
TuRz4m 2015-09-17 11:21:35 +02:00
commit 46604d40b4
3 changed files with 170 additions and 0 deletions

79
Dockerfile Normal file
View file

@ -0,0 +1,79 @@
FROM ubuntu:14.04
MAINTAINER TuRzAm
# Var for first config
# Server Name
ENV SESSIONNAME "Ark Docker"
# Map name
ENV SERVERMAP "TheIsland"
# Server password
ENV SERVERPASSWORD ""
# Admin password
ENV ADMINPASSWORD "adminpassword"
# Nb Players
ENV NBPLAYERS 70
# If the server is updating when start with docker start
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
# Install dependencies
RUN apt-get update &&\
apt-get install -y curl lib32gcc1 git
# Run commands as the steam user
RUN adduser \
--disabled-login \
--shell /bin/bash \
--gecos "" \
steam
# Copy & rights to folders
COPY run.sh /home/steam/run.sh
COPY arkmanager.cfg /home/steam/arkmanager.cfg
RUN chmod 777 /home/steam/run.sh
RUN mkdir /ark
# We use the git method, because api github has a limit ;)
RUN git clone https://github.com/FezVrasta/ark-server-tools.git /home/steam/ark-server-tools
# Install
WORKDIR /home/steam/ark-server-tools/tools
RUN chmod +x install.sh
RUN ./install.sh steam
# Define default config file in /ark
RUN echo 'source /ark/arkmanager.cfg' > /etc/arkmanager/arkmanager.cfg
RUN chown steam -R /ark && chmod 755 -R /ark
USER steam
# download steamcmd
RUN mkdir /home/steam/steamcmd &&\
cd /home/steam/steamcmd &&\
curl http://media.steampowered.com/installer/steamcmd_linux.tar.gz | tar -vxz
# First run is on anonymous to download the app
RUN /home/steam/steamcmd/steamcmd.sh +login anonymous +quit
EXPOSE 7778 27016 32330
VOLUME /ark
# Update game launch the game.
ENTRYPOINT ["/home/steam/run.sh"]

37
arkmanager.cfg Normal file
View file

@ -0,0 +1,37 @@
arkstChannel="master" # change it to a different branch to get non-stable versions
# config SteamCMD
steamcmdroot="/home/steam/steamcmd" # path of your steamcmd instance
steamcmdexec="steamcmd.sh" # name of steamcmd executable
steamcmd_user="steam" # name of the system user who own steamcmd folder
steamcmd_appinfocache="/home/steam/Steam/appcache/appinfo.vdf" # cache of the appinfo command
# config environment
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
# ARK server options - use ark_<optionname>=<value>
# 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_RCONEnabled="True" # Enable RCON Protocol
ark_RCONPort="32330" # RCON Port
ark_SessionName=${SESSIONNAME} # if your session name needs special characters please use the .ini instead
ark_Port="7778" # ARK server port (default 7778)
ark_QueryPort="27016" # ARK query port (default 27016)
ark_ServerPassword=${SERVERPASSWORD} # ARK server password, empty: no password required to login
ark_ServerAdminPassword=$ADMINPASSWORD # ARK server admin password, KEEP IT SAFE!
ark_MaxPlayers=${NBPLAYER}
#ark_GameModIds="487516323,487516324,487516325" # Uncomment to specify additional mods by Mod Id separated by commas
# config Service
servicename="arkserv" # Name of the service (don't change if you don't know what are you doing)
logdir="/ark/log/" # Logs path (default /var/log/arktools)
# steamdb specific
appid=376030 # Linux server App ID

54
run.sh Normal file
View file

@ -0,0 +1,54 @@
#!/usr/bin/env bash
echo "###########################################################################"
echo "# Ark Server - " `date`
echo "###########################################################################"
[ -p /tmp/FIFO ] && rm /tmp/FIFO
mkfifo /tmp/FIFO
export TERM=linux
[ ! -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
if [ ! -d "/ark/server" ];then
echo "Install ark..."
arkmanager install
fi
if [ ${BACKUPONSTART} -eq 1 ]; then
echo "[Backup]"
arkmanager backup
fi
if [ ${UPDATEONSTART} -eq 1 ]; then
echo "[Update]"
arkmanager update
fi
# Launching ark server
arkmanager start
# Stop server in case of signal INT or TERM
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 ; 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