Compare commits
12 Commits
04518e61f7
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| e13bdd6e2a | |||
| 83ef311fec | |||
| 248559cc4a | |||
| 4a3e7ad0c7 | |||
| 19e1f366c8 | |||
| 3f4d62daac | |||
| c3494df3b5 | |||
| d8a5c6a064 | |||
| e5df3ba1a9 | |||
| a9c28b89ea | |||
| 6e3adaec3b | |||
| 4ac6837cf4 |
@@ -5,5 +5,10 @@ steps:
|
||||
- name: docker
|
||||
image: plugins/docker
|
||||
settings:
|
||||
repo: docker.kapelle.org/l4d2
|
||||
registry: docker.kapelle.org
|
||||
repo: djeeberjr/l4d2-docker
|
||||
username: djeeberjr
|
||||
password:
|
||||
from_secret: DOCKER_HUB_TOKEN
|
||||
trigger:
|
||||
branch:
|
||||
- master
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
FROM cm2network/steamcmd:latest
|
||||
|
||||
RUN mkdir -p /home/steam/server
|
||||
COPY start.sh /home/steam/start.sh
|
||||
COPY server.cfg /home/steam/server.cfg
|
||||
|
||||
VOLUME "/home/steam/server"
|
||||
WORKDIR /home/steam/
|
||||
|
||||
ENV METAMOD_DL_URL "https://mms.alliedmods.net/mmsdrop/1.11/mmsource-1.11.0-git1145-linux.tar.gz"
|
||||
ENV SOURCEMOD_DL_URL "https://sm.alliedmods.net/smdrop/1.10/sourcemod-1.10.0-git6524-linux.tar.gz"
|
||||
ENTRYPOINT /home/steam/start.sh
|
||||
|
||||
15
README.md
15
README.md
@@ -1,13 +1,24 @@
|
||||
Left 4 dead 2 server.
|
||||
Left 4 dead 2 server. With Metamod and Sourcemod.
|
||||
|
||||
[Github](https://github.com/Djeeberjr/l4d2-docker)
|
||||
|
||||
# Ports
|
||||
- 27015
|
||||
- 27015/udp
|
||||
|
||||
# Volumes
|
||||
|
||||
You can create a volume at `/home/steam/server` to not redownload the game every time you make a change at the docker-compose file.
|
||||
|
||||
# Configuration
|
||||
|
||||
The `server.cfg` gets created on the fly and gets filled with the enviroment variable starting with `CVAR_`.
|
||||
You can set ANY conVar you want simply by prefixing the enviroment with `CVAR_`.
|
||||
So for example to set the RCON password set the enviroment variable `CVAR_RCON_PASSWORD=password123`.
|
||||
Try to avoid variables with the word `CVAR_` and avoid `=` in it.
|
||||
|
||||
A list of available cvars can be found [here](https://developer.valvesoftware.com/wiki/List_of_L4D2_Cvars).
|
||||
|
||||
Add your steam ids to `SM_ADMIN` to be added as a sourcemod admin.
|
||||
|
||||
If there is a new version of Metamod or Sourcemod and is not yet set in the image you can manually set the download URL in `METAMOD_DL_URL` and `SOURCEMOD_DL_URL`.
|
||||
It will only get update if the addon directory is empty.
|
||||
|
||||
@@ -6,7 +6,24 @@ services:
|
||||
environment:
|
||||
- CVAR_HOSTNAME=My left 4 dead server
|
||||
- CVAR_RCON_PASSWORD=password123
|
||||
- CVAR_SV_ALLOW_LOBBY_CONNECT_ONLY=0
|
||||
- CVAR_SV_CONSISTENCY=0
|
||||
- CAVR_SV_VOICEENABLE=1
|
||||
- CVAR_MP_DISABLE_AUTOKICK=1
|
||||
- SM_ADMIN=STEAM_0:1:123,STEAM_0:1:456
|
||||
- INSECURE=true
|
||||
- "MOTD_FILE_CONTENT=Put your MODT here. \n
|
||||
Multiline is also supported."
|
||||
- "HOST_FILE_CONTENT=Same with the host file \n
|
||||
lalalalal"
|
||||
ports:
|
||||
- 27015:27015
|
||||
- 27015:27015/udp
|
||||
volumes:
|
||||
- l4d2_game:/home/steam/server
|
||||
stdin_open: true
|
||||
tty: true
|
||||
volumes:
|
||||
l4d2_game:
|
||||
name: l4d2_game
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
hostname "Left4Dead2 Server"
|
||||
sv_lan "0"
|
||||
43
start.sh
43
start.sh
@@ -2,17 +2,44 @@
|
||||
|
||||
set -e
|
||||
|
||||
echo "### Installing / Updateing l4d2 ###"
|
||||
/home/steam/steamcmd/steamcmd.sh +login anonymous +force_install_dir "$HOME/server" +app_update 222860 +quit
|
||||
|
||||
/home/steam/steamcmd/steamcmd.sh +login anonymous +force_install_dir $HOME/server +app_update 222860 validate +quit
|
||||
|
||||
echo "### Creating config ###"
|
||||
if [ ! -e "$HOME/server/left4dead2/addons/metamod.vdf" ]; then
|
||||
echo "Installing Metamod"
|
||||
curl "$METAMOD_DL_URL" -o /tmp/metamod.tar.gz
|
||||
tar -xf /tmp/metamod.tar.gz -C "$HOME/server/left4dead2"
|
||||
rm /tmp/metamod.tar.gz
|
||||
|
||||
cd $HOME/server
|
||||
cp $HOME/server.cfg $HOME/server/left4dead2/cfg/server.cfg
|
||||
echo "Install Sourcemod"
|
||||
curl "$SOURCEMOD_DL_URL" -o /tmp/sourcemod.tar.gz
|
||||
tar -xf /tmp/sourcemod.tar.gz -C "$HOME/server/left4dead2"
|
||||
rm /tmp/sourcemod.tar.gz
|
||||
fi
|
||||
|
||||
env | awk -F "=" '/^CVAR_/ {sub("CVAR_","",$1); print tolower($1),($2 ~ /^[0-9]+$/)?$2:"\""$2"\""}' > docker_server.cfg
|
||||
|
||||
echo "### Starting l4d2 ###"
|
||||
mkdir -p "$HOME/server/left4dead2/addons/sourcemod/configs/"
|
||||
echo "// Autogenerated. DO NOT EDIT. Sourcemod admin can be added with the SM_ADMIN environment variable" \
|
||||
> "$HOME/server/left4dead2/addons/sourcemod/configs/admins_simple.ini"
|
||||
for id in $(echo "$SM_ADMIN" | sed 's/,/\n/g')
|
||||
do
|
||||
echo "\"$id\" \"99:z\"" >> "$HOME/server/left4dead2/addons/sourcemod/configs/admins_simple.ini"
|
||||
done
|
||||
|
||||
$HOME/server/srcds_run -console -game left4dead2 +maxplayers 16 -maxclients 16 -ip 0.0.0.0 +map c1m1_hotel +exec docker_server.cfg
|
||||
|
||||
echo -n "$MOTD_FILE_CONTENT" > "$HOME/server/left4dead2/motd.txt"
|
||||
|
||||
echo -n "$HOST_FILE_CONTENT" > "$HOME/server/left4dead2/host.txt"
|
||||
|
||||
env | awk -F "=" '/^CVAR_/ {sub("CVAR_","",$1); print tolower($1),($2 ~ /^[0-9]+$/)?$2:"\""$2"\""}' > /home/steam/server/left4dead2/cfg/server.cfg
|
||||
|
||||
cat /home/steam/server/left4dead2/cfg/server.cfg
|
||||
|
||||
SRCDS_ARGS=""
|
||||
|
||||
if [ -n "$INSECURE" ]; then
|
||||
SRCDS_ARGS="${SRCDS_ARGS} -insecure"
|
||||
echo "Running with VAC disabled."
|
||||
fi
|
||||
|
||||
"$HOME/server/srcds_run" -console -game left4dead2 +maxplayers 16 -maxclients 16 -ip 0.0.0.0 $SRCDS_ARGS
|
||||
|
||||
Reference in New Issue
Block a user