Compare commits
61 Commits
Author | SHA1 | Date | |
---|---|---|---|
bf20c62986 | |||
ee97658e74 | |||
c4b87f796e | |||
2f9e82f4b3 | |||
c176888602 | |||
3594dce5aa | |||
2ef6c06767 | |||
d09496e7f3 | |||
5d0137e156
|
|||
a5e18d4a60
|
|||
322bf8bbb7
|
|||
43e57828d3
|
|||
693c5ddd4b
|
|||
4bd2d03b78
|
|||
7f441865bf
|
|||
7ce7529dcd
|
|||
6f07cf48af
|
|||
2f5b230e9f
|
|||
8b963d53d5
|
|||
dc0fe753b3
|
|||
2e1623f92d
|
|||
d280579b28
|
|||
0cdee2b575
|
|||
aa5d7be816
|
|||
1733f78291 | |||
20067899d2 | |||
f3815054a4 | |||
32268b8459 | |||
0110017d6e | |||
699f6f214a | |||
e109e79fc5 | |||
23bc65bd0d | |||
4261159c9f | |||
7428976135 | |||
6737e8b64e | |||
691f6c6221 | |||
d55ff25768 | |||
630f90d39a | |||
f0f3684408 | |||
43838489f2 | |||
a4ed582573 | |||
c957675c64 | |||
c35bafd5ec | |||
d49b27aee7 | |||
bf4b253b93 | |||
1b00343dad | |||
0fa2d740fc | |||
aa452073df | |||
f5776a90a4 | |||
7cc9329e8d | |||
ea7e6ea441 | |||
7fd9930cf3 | |||
988b0b0e09 | |||
039cb722e3 | |||
beecd2d8cc | |||
98c0923ab4 | |||
bc5047cbe2 | |||
c125a3a8a8 | |||
7c963b942a | |||
bebe772b6f | |||
885d8ef2d1 |
1
.github/FUNDING.yml
vendored
1
.github/FUNDING.yml
vendored
@@ -1 +0,0 @@
|
||||
github: ich777
|
11
Dockerfile
11
Dockerfile
@@ -1,10 +1,10 @@
|
||||
FROM ich777/debian-baseimage:bullseye_amd64
|
||||
FROM ich777/debian-baseimage
|
||||
|
||||
LABEL org.opencontainers.image.authors="admin@minenet.at"
|
||||
LABEL org.opencontainers.image.source="https://github.com/ich777/docker-steamcmd-server"
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get -y install --no-install-recommends lib32gcc-s1 lib32stdc++6 lib32z1 lsof libicu67 && \
|
||||
apt-get -y install --no-install-recommends lib32gcc-s1 screen unzip jq && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV DATA_DIR="/serverdata"
|
||||
@@ -14,6 +14,11 @@ ENV GAME_ID="template"
|
||||
ENV GAME_NAME="template"
|
||||
ENV GAME_PARAMS="template"
|
||||
ENV GAME_PORT=27015
|
||||
ENV SERVERCONFIG="serverconfig.xml"
|
||||
ENV ENABLE_BEPINEX="false"
|
||||
ENV BACKUP_FILES="false"
|
||||
ENV BACKUP_INTERVAL=60
|
||||
ENV BACKUP_TO_KEEP=12
|
||||
ENV VALIDATE=""
|
||||
ENV UMASK=000
|
||||
ENV UID=99
|
||||
@@ -34,4 +39,4 @@ ADD /scripts/ /opt/scripts/
|
||||
RUN chmod -R 770 /opt/scripts/
|
||||
|
||||
#Server Start
|
||||
ENTRYPOINT ["/opt/scripts/start.sh"]
|
||||
ENTRYPOINT ["/opt/scripts/start.sh"]
|
50
README.md
50
README.md
@@ -1,48 +1,44 @@
|
||||
# SteamCMD in Docker optimized for Unraid
|
||||
This Docker will download and install SteamCMD. It will also install Counter-Strike 2 and run it.
|
||||
This Docker will download and install SteamCMD. It will also install 7DaysToDie and run it.
|
||||
|
||||
**ATTENTION:** You have to provide a valid Steam account with the game in it is Library and SteamGuard completely disabled so that the download is working!
|
||||
_It is recommended that you create dedicated Steam account for your dedicated servers with the games in it and SteamGuard completely disabled!_
|
||||
**DON'T DISABLE STEAM GUARD ON YOUR PRIMARY ACCOUNT!!!**
|
||||
**Update Notice:** Simply restart the container if a newer version of the game is available.
|
||||
|
||||
**ATTENTION:** First Startup can take very long since it downloads the gameserver files!
|
||||
|
||||
**PUBLIC PLAY:** If you want that your server is public listed you must add '+sv_setsteamaccount YOURTOKEN' to the GAME_PARAMS (without the quotes and replace YOURTOKEN with your token).
|
||||
Create your token here: https://steamcommunity.com/dev/managegameservers (every gameserver needs it's own token!!!)
|
||||
|
||||
You can also run multiple servers with only one SteamCMD directory!
|
||||
|
||||
## Example Env
|
||||
## Env params
|
||||
| Name | Value | Example |
|
||||
| --- | --- | --- |
|
||||
| STEAMCMD_DIR | Folder for SteamCMD | /serverdata/steamcmd |
|
||||
| SERVER_DIR | Folder for gamefile | /serverdata/serverfiles |
|
||||
| GAME_ID | The GAME_ID that the container downloads at startup. If you want to install a static or beta version of the game change the value to: '730 -beta YOURBRANCH' (without quotes, replace YOURBRANCH with the branch or version you want to install). | 730 |
|
||||
| USERNAME | Leave blank for anonymous login | \<STEAMUSER> |
|
||||
| PASSWRD | Leave blank for anonymous login | \<STEAMPASSWORD> |
|
||||
| GAME_PARAMS | Values to start the server | -dedicated -dev +map de_inferno +game_type 0 +game_mode 1 -usercon |
|
||||
| GAME_ID | The GAME_ID that the container downloads at startup. If you want to use a static version of the game and not always the latest one then enter this: '294420 -beta stable_alpha19.4' or '294420 -beta latest_experimental' (without quotes) if you want to stay for example on alpha19.4. | 294420 |
|
||||
| SERVERCONFIG | Please change if your serverconfigfile has another name. | serverconfig.xml |
|
||||
| GAME_PARAMS | Values to start the server | -logfile 7DaysToDie_Data/output_log.txt $@ |
|
||||
| ENABLE_BEPINEX | If you want to enable BepInEx set this variable to 'true' (without quotes). | false |
|
||||
| BACKUP_FILES | Set this value to 'true' to enable the automated backup function from the container, you find the backups in '.../7dtd/Backups/'. Set to 'false' to disable the backup function. | false |
|
||||
| BACKUP_INTERVAL | The backup interval in minutes | 60 |
|
||||
|BACKUP_TO_KEEP | Number of backups to keep | 12 |
|
||||
| UID | User Identifier | 99 |
|
||||
| GID | Group Identifier | 100 |
|
||||
| GAME_PORT | Port the server will be running on | 27015 |
|
||||
| VALIDATE | Validates the game data | blank |
|
||||
| VALIDATE | Validates the game data | false |
|
||||
| USERNAME | Leave blank for anonymous login | blank |
|
||||
| PASSWRD | Leave blank for anonymous login | blank |
|
||||
|
||||
|
||||
## Run example
|
||||
```
|
||||
docker run --name CS2 -d \
|
||||
-p 27015:27015 -p 27015:27015/udp \
|
||||
--env 'GAME_ID=730' \
|
||||
--env 'USERNAME=<STEAMUSER>' \
|
||||
--env 'PASSWRD=<STEAMPASSWORD>' \
|
||||
--env 'GAME_PARAMS=-dedicated -dev +map de_inferno +game_type 0 +game_mode 1 -usercon' \
|
||||
docker run --name 7DtD -d \
|
||||
-p 26900:26900 -p 26900-26903:26900-26903/udp -p 27015:27015/udp -p 8080:8080 -p 8082:8082 \
|
||||
--env 'GAME_ID=294420' \
|
||||
--env 'SERVERCONFIG=serverconfig.xml' \
|
||||
--env 'GAME_PARAMS=-logfile 7DaysToDie_Data/output_log.txt $@' \
|
||||
--env 'UID=99' \
|
||||
--env 'GID=100' \
|
||||
--volume /path/to/steamcmd:/serverdata/steamcmd \
|
||||
--volume /path/to/cs2:/serverdata/serverfiles \
|
||||
ich777/steamcmd:cs2
|
||||
--volume /path/to/7dtd:/serverdata/serverfiles \
|
||||
ich777/steamcmd:7dtd
|
||||
```
|
||||
|
||||
This Docker was mainly edited for better use with Unraid, if you don't use Unraid you should definitely try it!
|
||||
|
||||
|
||||
This Docker is forked from mattieserver, thank you for this wonderfull Docker.
|
||||
|
||||
#### Support Thread: https://forums.unraid.net/topic/79530-support-ich777-gameserver-dockers/
|
||||
### Support Thread: https://forums.unraid.net/topic/79530-support-ich777-gameserver-dockers/
|
14
scripts/start-backup.sh
Normal file
14
scripts/start-backup.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
while true
|
||||
do
|
||||
sleep ${BACKUP_INTERVAL}m
|
||||
if [ -d ${SERVER_DIR}/User/Saves ]; then
|
||||
cd ${SERVER_DIR}/User/Saves
|
||||
tar -czf ${SERVER_DIR}/Backups/$(date '+%Y-%m-%d_%H.%M.%S').tar.gz .
|
||||
else
|
||||
echo "Backup ERROR: Save path ${SERVER_DIR}/User/Saves not found!"
|
||||
fi
|
||||
cd ${SERVER_DIR}/Backups
|
||||
ls -1tr ${SERVER_DIR}/Backups | sort | head -n -${BACKUP_TO_KEEP} | xargs -d '\n' rm -f --
|
||||
chmod -R ${DATA_PERM} ${SERVER_DIR}/Backups
|
||||
done
|
@@ -1,4 +1,6 @@
|
||||
#!/bin/bash
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${SERVER_DIR}
|
||||
|
||||
if [ ! -f ${STEAMCMD_DIR}/steamcmd.sh ]; then
|
||||
echo "SteamCMD not found!"
|
||||
wget -q -O ${STEAMCMD_DIR}/steamcmd_linux.tar.gz http://media.steampowered.com/client/steamcmd_linux.tar.gz
|
||||
@@ -51,18 +53,141 @@ else
|
||||
fi
|
||||
|
||||
echo "---Prepare Server---"
|
||||
if [ ! -f ${DATA_DIR}/.steam/sdk64/steamclient.so ]; then
|
||||
if [ ! -d ${DATA_DIR}/.steam ]; then
|
||||
mkdir ${DATA_DIR}/.steam
|
||||
fi
|
||||
if [ ! -d ${DATA_DIR}/.steam/sdk64 ]; then
|
||||
mkdir ${DATA_DIR}/.steam/sdk64
|
||||
fi
|
||||
cp -R ${STEAMCMD_DIR}/linux64/* ${DATA_DIR}/.steam/sdk64/
|
||||
#${SERVER_DIR}/User/Saves
|
||||
#if [ ! -d ${SERVER_DIR}/Saves ]; then
|
||||
# mkdir ${SERVER_DIR}/Saves
|
||||
#fi
|
||||
#if grep -rq '<property name="SaveGameFolder"' ${SERVER_DIR}/${SERVERCONFIG}; then
|
||||
# if grep -rq '<!-- <property name="SaveGameFolder"' ${SERVER_DIR}/${SERVERCONFIG}; then
|
||||
# echo "---Moving SaveGameFolder location---"
|
||||
# sed -i '/<!-- <property name="SaveGameFolder"/c\\t<property name="SaveGameFolder"\t\t\t\t\tvalue="/serverdata/serverfiles/Saves" />' ${SERVER_DIR}/${SERVERCONFIG}
|
||||
# elif grep -rq 'value="/serverdata/serverfiles/Saves"' ${SERVER_DIR}/${SERVERCONFIG}; then
|
||||
# echo "---SaveGameFolder location correct---"
|
||||
# fi
|
||||
#else
|
||||
# echo "---Creating SaveGameFolder config ---"
|
||||
# sed -i '4i\ <property name="SaveGameFolder" value="/serverdata/serverfiles/Saves" />\' ${SERVER_DIR}/${SERVERCONFIG}
|
||||
#fi
|
||||
#echo "---Savegame location found---"
|
||||
|
||||
if [ ! -d ${SERVER_DIR}/User ]; then
|
||||
mkdir ${SERVER_DIR}/User
|
||||
fi
|
||||
if grep -rq '<property name="UserDataFolder"' ${SERVER_DIR}/${SERVERCONFIG}; then
|
||||
if grep -rq '<!-- <property name="UserDataFolder"' ${SERVER_DIR}/${SERVERCONFIG}; then
|
||||
echo "---Moving UserDataFolder location---"
|
||||
sed -i '/<!-- <property name="UserDataFolder"/c\\t<property name="UserDataFolder"\t\t\t\t\tvalue="/serverdata/serverfiles/User" />' ${SERVER_DIR}/${SERVERCONFIG}
|
||||
elif grep -rq 'value="/serverdata/serverfiles/User"' ${SERVER_DIR}/${SERVERCONFIG}; then
|
||||
echo "---UserDataFolder location correct---"
|
||||
fi
|
||||
else
|
||||
echo "---Creating UserDataFolder config ---"
|
||||
sed -i '4i\ <property name="UserDataFolder" value="/serverdata/serverfiles/User" />\' ${SERVER_DIR}/${SERVERCONFIG}
|
||||
fi
|
||||
echo "---UserDataFolder location found---"
|
||||
|
||||
if [ "${ENABLE_BEPINEX}" == "true" ]; then
|
||||
echo "---BepInEx enabled!---"
|
||||
CUR_V="$(find ${SERVER_DIR} -maxdepth 1 -name "BepInEx-*" | cut -d '-' -f2)"
|
||||
LAT_DL_URL="$(wget -qO- https://api.github.com/repos/BepInEx/BepInEx/releases/latest | jq -r '.assets[] | .browser_download_url | match("^.*BepInEx_linux_x64_.*") | .string')"
|
||||
LAT_V="$(echo "$LAT_DL_URL" | cut -d '/' -f8)"
|
||||
if [ -z "${LAT_V}" ]; then
|
||||
if [ -z "${CUR_V}" ]; then
|
||||
echo "---Can't get latest version of BepInEx and found no local installed version!---"
|
||||
echo "---Please try to run the Container without BepInEx, putting Container into sleep mode!---"
|
||||
sleep infinity
|
||||
else
|
||||
echo "---Can't get latest version of BepInEx!---"
|
||||
echo "---Falling back to current installed version: ${CUR_V}!---"
|
||||
LAT_V=$CUR_V
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f ${SERVER_DIR}/BepInEx.zip ]; then
|
||||
rm -rf ${SERVER_DIR}/BepInEx.zip
|
||||
fi
|
||||
|
||||
echo "---BepInEx Version Check---"
|
||||
echo
|
||||
echo "---https://github.com/BepInEx/BepInEx---"
|
||||
echo
|
||||
if [ -z "${CUR_V}" ]; then
|
||||
echo "---BepInEx for Valheim not found, downloading and installing v$LAT_V...---"
|
||||
cd ${SERVER_DIR}
|
||||
if wget -q -nc --show-progress --progress=bar:force:noscroll -O ${SERVER_DIR}/BepInEx.zip "${LAT_DL_URL}" ; then
|
||||
echo "---Successfully downloaded BepInEx v$LAT_V---"
|
||||
else
|
||||
echo "---Something went wrong, can't download BepInEx v$LAT_V, putting container into sleep mode!---"
|
||||
sleep infinity
|
||||
fi
|
||||
unzip -o ${SERVER_DIR}/BepInEx.zip -d ${SERVER_DIR}
|
||||
touch ${SERVER_DIR}/BepInEx-$LAT_V
|
||||
rm -rf ${SERVER_DIR}/BepInEx.zip
|
||||
elif [ "$CUR_V" != "$LAT_V" ]; then
|
||||
echo "---Version missmatch, BepInEx v$CUR_V installed, downloading and installing v$LAT_V...---"
|
||||
cd ${SERVER_DIR}
|
||||
rm -rf ${SERVER_DIR}/BepInEx-$CUR_V
|
||||
mkdir /tmp/Backup
|
||||
cp -R ${SERVER_DIR}/BepInEx/config /tmp/Backup/ 2>/dev/null
|
||||
if wget -q -nc --show-progress --progress=bar:force:noscroll -O ${SERVER_DIR}/BepInEx.zip "${LAT_DL_URL}" ; then
|
||||
echo "---Successfully downloaded BepInEx v$LAT_V---"
|
||||
else
|
||||
echo "---Something went wrong, can't download BepInEx v$LAT_V, putting container into sleep mode!---"
|
||||
sleep infinity
|
||||
fi
|
||||
unzip -o ${SERVER_DIR}/BepInEx.zip -d ${SERVER_DIR}
|
||||
touch ${SERVER_DIR}/BepInEx-$LAT_V
|
||||
cp -R /tmp/Backup/config ${SERVER_DIR}/BepInEx/ 2>/dev/null
|
||||
rm -rf ${SERVER_DIR}/BepInEx.zip /tmp/Backup
|
||||
elif [ "${CUR_V}" == "${LAT_V}" ]; then
|
||||
echo "---BepInEx v$CUR_V up-to-date---"
|
||||
fi
|
||||
fi
|
||||
|
||||
chmod -R ${DATA_PERM} ${DATA_DIR}
|
||||
screen -wipe 2&>/dev/null
|
||||
echo "---Server ready---"
|
||||
|
||||
if [ "${BACKUP_FILES}" == "true" ]; then
|
||||
echo "---Starting Backup daemon---"
|
||||
if [ ! -d ${SERVER_DIR}/Backups ]; then
|
||||
mkdir -p ${SERVER_DIR}/Backups
|
||||
fi
|
||||
screen -S backup -d -m /opt/scripts/start-backup.sh
|
||||
fi
|
||||
|
||||
echo "---Start Server---"
|
||||
|
||||
GAME_PARAMS=${GAME_PARAMS/-nographics/}
|
||||
GAME_PARAMS=${GAME_PARAMS/-batchmode/}
|
||||
|
||||
cd ${SERVER_DIR}
|
||||
${SERVER_DIR}/game/bin/linuxsteamrt64/cs2 ${GAME_PARAMS}
|
||||
if [ "${ENABLE_BEPINEX}" == "true" ]; then
|
||||
echo "---with BepInEx---"
|
||||
echo
|
||||
echo "---https://github.com/BepInEx/BepInEx---"
|
||||
echo
|
||||
export DOORSTOP_ENABLE=TRUE
|
||||
export DOORSTOP_INVOKE_DLL_PATH=${SERVER_DIR}/BepInEx/core/BepInEx.Preloader.dll
|
||||
if [ ! ${DOORSTOP_CORLIB_OVERRIDE_PATH+x} ]; then
|
||||
export DOORSTOP_CORLIB_OVERRIDE_PATH=${SERVER_DIR}/unstripped_corlib
|
||||
fi
|
||||
export LD_LIBRARY_PATH="${SERVER_DIR}/doorstop_libs":$LD_LIBRARY_PATH
|
||||
export LD_PRELOAD=libdoorstop_x64.so:$LD_PRELOAD
|
||||
export DYLD_LIBRARY_PATH="${SERVER_DIR}/doorstop_libs"
|
||||
export DYLD_INSERT_LIBRARIES="${SERVER_DIR}/libdoorstop_x64.so"
|
||||
export templdpath="$LD_LIBRARY_PATH"
|
||||
export LD_LIBRARY_PATH=${SERVER_DIR}/linux64:"$LD_LIBRARY_PATH"
|
||||
export SteamAppId=251570
|
||||
if [ "${LOG_TIMESTAMP}" != "true" ]; then
|
||||
${SERVER_DIR}/7DaysToDieServer.x86_64 -configfile=${SERVERCONFIG} -nographics -batchmode ${GAME_PARAMS}
|
||||
else
|
||||
${SERVER_DIR}/7DaysToDieServer.x86_64 -configfile=${SERVERCONFIG} -logfile 7DaysToDie_Data/output_log_$(date +"%F_%H.%M.%S").txt -nographics -batchmode ${GAME_PARAMS}
|
||||
fi
|
||||
else
|
||||
if [ "${LOG_TIMESTAMP}" != "true" ]; then
|
||||
${SERVER_DIR}/7DaysToDieServer.x86_64 -configfile=${SERVERCONFIG} -nographics -batchmode ${GAME_PARAMS}
|
||||
else
|
||||
${SERVER_DIR}/7DaysToDieServer.x86_64 -configfile=${SERVERCONFIG} -logfile 7DaysToDie_Data/output_log_$(date +"%F_%H.%M.%S").txt -nographics -batchmode ${GAME_PARAMS}
|
||||
fi
|
||||
fi
|
@@ -26,8 +26,9 @@ chown -R ${UID}:${GID} ${DATA_DIR}
|
||||
|
||||
echo "---Starting...---"
|
||||
term_handler() {
|
||||
kill -SIGTERM "$killpid"
|
||||
wait "$killpid" -f 2>/dev/null
|
||||
kill -SIGINT $(pidof 7DaysToDieServer.x86_64)
|
||||
tail --pid=$(pidof 7DaysToDieServer.x86_64) -f 2>/dev/null
|
||||
sleep 0.5
|
||||
exit 143;
|
||||
}
|
||||
|
||||
@@ -38,4 +39,4 @@ while true
|
||||
do
|
||||
wait $killpid
|
||||
exit 0;
|
||||
done
|
||||
done
|
Reference in New Issue
Block a user