Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
f988206993 | |||
6f6f4e6ce0
|
|||
6230b288a5
|
|||
5d4643a474
|
|||
36d6f2ddf5
|
|||
96b1b66051
|
|||
a00fd3a15b
|
|||
d05b8ccf5a
|
|||
47cb1b0724
|
|||
c6215deddd
|
|||
561e8f6805
|
|||
5b4953ee19
|
|||
841f3e55a9
|
|||
31454f81f4
|
|||
0cce5a366e
|
|||
5c5495e457
|
|||
02492400af
|
|||
83992eb6cb
|
17
Dockerfile
17
Dockerfile
@@ -1,19 +1,26 @@
|
||||
FROM ich777/debian-baseimage
|
||||
|
||||
LABEL maintainer="admin@minenet.at"
|
||||
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 && \
|
||||
apt-get -y install --no-install-recommends lib32gcc-s1 lib32stdc++6 screen && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN wget -O /tmp/gotty.tar.gz https://github.com/yudai/gotty/releases/download/v1.0.1/gotty_linux_amd64.tar.gz && \
|
||||
tar -C /usr/bin/ -xvf /tmp/gotty.tar.gz && \
|
||||
rm -rf /tmp/gotty.tar.gz
|
||||
|
||||
ENV DATA_DIR="/serverdata"
|
||||
ENV STEAMCMD_DIR="${DATA_DIR}/steamcmd"
|
||||
ENV SERVER_DIR="${DATA_DIR}/serverfiles"
|
||||
ENV GAME_ID="template"
|
||||
ENV GAME_NAME="template"
|
||||
ENV GAME_PARAMS="template"
|
||||
ENV GAME_PARAMS=""
|
||||
ENV GAME_PORT=27015
|
||||
ENV VALIDATE=""
|
||||
ENV WORLD_NAME="World"
|
||||
ENV ENABLE_WEBCONSOLE="true"
|
||||
ENV GOTTY_PARAMS="-w --title-format Necesse"
|
||||
ENV UMASK=000
|
||||
ENV UID=99
|
||||
ENV GID=100
|
||||
@@ -25,7 +32,7 @@ ENV DATA_PERM=770
|
||||
RUN mkdir $DATA_DIR && \
|
||||
mkdir $STEAMCMD_DIR && \
|
||||
mkdir $SERVER_DIR && \
|
||||
useradd -d $DATA_DIR -s /bin/bash $USER && \
|
||||
useradd -d $SERVER_DIR -s /bin/bash $USER && \
|
||||
chown -R $USER $DATA_DIR && \
|
||||
ulimit -n 2048
|
||||
|
||||
|
43
README.md
43
README.md
@@ -1,45 +1,38 @@
|
||||
# SteamCMD in Docker optimized for Unraid
|
||||
This Docker will download and install SteamCMD and the according game that is pulled via specifying the Tag.
|
||||
This Docker will download and install SteamCMD. It will also install Necesse and run it.
|
||||
|
||||
**Please see the different Tags/Branches which games are available.**
|
||||
**ATTENTION:** First Startup can take very long since it downloads the gameserver files!
|
||||
|
||||
## Example Env params for CS:Source
|
||||
**Update Notice:** Simply restart the container if a newer version of the game is available.
|
||||
|
||||
>**WEB CONSOLE:** You can connect to the Necesse console by opening your browser and go to HOSTIP:9023 (eg: 192.168.1.1:9023) or click on WebUI on the Docker page within Unraid.
|
||||
|
||||
## Example 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: '232330 -beta YOURBRANCH' (without quotes, replace YOURBRANCH with the branch or version you want to install). | 232330 |
|
||||
| GAME_NAME | SRCDS gamename | cstrike |
|
||||
| GAME_PARAMS | Values to start the server | -secure +maxplayers 32 +map de_dust2 |
|
||||
| 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: '1169370 -beta YOURBRANCH' (without quotes, replace YOURBRANCH with the branch or version you want to install). | 1169370 |
|
||||
| WORLD_NAME | Specify the world name here (your worlds are saved in .../.config/Necesse/saves/) | World |
|
||||
| GAME_PARAMS | Enter your extra startup parameters here if needed | empty |
|
||||
| UID | User Identifier | 99 |
|
||||
| GID | Group Identifier | 100 |
|
||||
| GAME_PORT | Port the server will be running on | 27015 |
|
||||
| VALIDATE | Validates the game data | true |
|
||||
| USERNAME | Leave blank for anonymous login | blank |
|
||||
| PASSWRD | Leave blank for anonymous login | blank |
|
||||
|
||||
**ATTENTION: You have to disable Steam Guard for games that require authentication, but not all games need Steam credentials, Steam recommends to create a seperate account for dedicated servers **
|
||||
|
||||
>**NOTE** GAME_ID values can be found [here](https://developer.valvesoftware.com/wiki/Dedicated_Servers_List)
|
||||
|
||||
> And for GAME_NAME there is no list, so a quick search should give you the result
|
||||
|
||||
## Run example for CS:Source
|
||||
## Run example
|
||||
```
|
||||
docker run --name CSSource -d \
|
||||
-p 27015:27015 -p 27015:27015/udp \
|
||||
--env 'GAME_ID=232330' \
|
||||
--env 'GAME_NAME=cstrike' \
|
||||
--env 'GAME_PORT=27015' \
|
||||
--env 'GAME_PARAMS=-secure +maxplayers 32 +map de_dust2' \
|
||||
docker run --name Necesse -d \
|
||||
-p 14159:14159/udp -p 9023:8080 \
|
||||
--env 'GAME_ID=1169370' \
|
||||
--env 'WORLD_NAME=World' \
|
||||
--env 'UID=99' \
|
||||
--env 'GID=100' \
|
||||
--volume /mnt/user/appdata/steamcmd:/serverdata/steamcmd \
|
||||
--volume /mnt/user/appdata/cstrikesource:/serverdata/serverfiles \
|
||||
ich777/steamcmd:latest
|
||||
--volume /path/to/steamcmd:/serverdata/steamcmd \
|
||||
--volume /path/to/necesse:/serverdata/serverfiles \
|
||||
ich777/steamcmd:necesse
|
||||
```
|
||||
>**NOTE** port 26900 is the port for vac, in case of multiple servers make sure these are not the same
|
||||
|
||||
|
||||
This Docker was mainly edited for better use with Unraid, if you don't use Unraid you should definitely try it!
|
||||
|
||||
|
3
scripts/start-gotty.sh
Normal file
3
scripts/start-gotty.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
sleep 5
|
||||
TERM=linux gotty ${GOTTY_PARAMS} screen -xS Necesse
|
@@ -51,18 +51,22 @@ else
|
||||
fi
|
||||
|
||||
echo "---Prepare Server---"
|
||||
if [ ! -f ${DATA_DIR}/.steam/sdk32/steamclient.so ]; then
|
||||
if [ ! -d ${DATA_DIR}/.steam ]; then
|
||||
mkdir ${DATA_DIR}/.steam
|
||||
fi
|
||||
if [ ! -d ${DATA_DIR}/.steam/sdk32 ]; then
|
||||
mkdir ${DATA_DIR}/.steam/sdk32
|
||||
fi
|
||||
cp -R ${STEAMCMD_DIR}/linux32/* ${DATA_DIR}/.steam/sdk32/
|
||||
if [ ! -f ~/.screenrc ]; then
|
||||
echo "defscrollback 30000
|
||||
bindkey \"^C\" echo 'Blocked. Please use to command \"stop\" to shutdown the server or close this window to exit the terminal.'" > ~/.screenrc
|
||||
fi
|
||||
echo "---Checking for old logs---"
|
||||
find ${SERVER_DIR} -name "masterLog.*" -exec rm -f {} \;
|
||||
screen -wipe 2&>/dev/null
|
||||
chmod -R ${DATA_PERM} ${DATA_DIR}
|
||||
echo "---Server ready---"
|
||||
|
||||
echo "---Start Server---"
|
||||
cd ${SERVER_DIR}
|
||||
${SERVER_DIR}/srcds_run -game ${GAME_NAME} ${GAME_PARAMS} -console +port ${GAME_PORT}
|
||||
screen -S Necesse -L -Logfile ${SERVER_DIR}/masterLog.0 -d -m ${SERVER_DIR}/jre/bin/java ${EXTRA_JVM_PARAMS} -jar Server.jar -ip 0.0.0.0 -world ${WORLD_NAME} -nogui ${GAME_PARAMS}
|
||||
sleep 2
|
||||
if [ "${ENABLE_WEBCONSOLE}" == "true" ]; then
|
||||
/opt/scripts/start-gotty.sh 2>/dev/null &
|
||||
fi
|
||||
/opt/scripts/start-watchdog.sh &
|
||||
tail -f ${SERVER_DIR}/masterLog.0
|
8
scripts/start-watchdog.sh
Normal file
8
scripts/start-watchdog.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
killpid="$(pidof java)"
|
||||
while true
|
||||
do
|
||||
tail --pid=$killpid -f /dev/null
|
||||
kill "$(pidof tail)"
|
||||
exit 0
|
||||
done
|
@@ -1,28 +1,34 @@
|
||||
#!/bin/bash
|
||||
echo "---Checking if UID: ${UID} matches user---"
|
||||
echo "---Ensuring UID: ${UID} matches user---"
|
||||
usermod -u ${UID} ${USER}
|
||||
echo "---Checking if GID: ${GID} matches user---"
|
||||
echo "---Ensuring GID: ${GID} matches user---"
|
||||
groupmod -g ${GID} ${USER} > /dev/null 2>&1 ||:
|
||||
usermod -g ${GID} ${USER}
|
||||
echo "---Setting umask to ${UMASK}---"
|
||||
umask ${UMASK}
|
||||
|
||||
echo "---Checking for optional scripts---"
|
||||
if [ -f /opt/scripts/user.sh ]; then
|
||||
echo "---Found optional script, executing---"
|
||||
chmod +x /opt/scripts/user.sh
|
||||
/opt/scripts/user.sh
|
||||
cp -f /opt/custom/user.sh /opt/scripts/start-user.sh > /dev/null 2>&1 ||:
|
||||
cp -f /opt/scripts/user.sh /opt/scripts/start-user.sh > /dev/null 2>&1 ||:
|
||||
|
||||
if [ -f /opt/scripts/start-user.sh ]; then
|
||||
echo "---Found optional script, executing---"
|
||||
chmod -f +x /opt/scripts/start-user.sh ||:
|
||||
/opt/scripts/start-user.sh || echo "---Optional Script has thrown an Error---"
|
||||
else
|
||||
echo "---No optional script found, continuing---"
|
||||
echo "---No optional script found, continuing---"
|
||||
fi
|
||||
|
||||
echo "---Starting...---"
|
||||
echo "---Taking ownership of data...---"
|
||||
chown -R root:${GID} /opt/scripts
|
||||
chmod -R 750 /opt/scripts
|
||||
chown -R ${UID}:${GID} ${DATA_DIR}
|
||||
|
||||
echo "---Starting...---"
|
||||
term_handler() {
|
||||
kill -SIGTERM "$killpid"
|
||||
wait "$killpid" -f 2>/dev/null
|
||||
screenpid="$(su $USER -c "screen -list | grep "Detached" | grep "Necesse" | cut -d '.' -f1")"
|
||||
su $USER -c "screen -S Necesse -X stuff 'stop^M'" >/dev/null
|
||||
tail --pid=$(pidof java) -f 2>/dev/null
|
||||
exit 143;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user