Compare commits

..

10 Commits

Author SHA1 Message Date
e13bdd6e2a drone docker hub
All checks were successful
continuous-integration/drone/push Build is passing
2021-12-30 12:12:06 +01:00
83ef311fec added sourcemod admin 2021-11-16 21:05:27 +01:00
248559cc4a update url env 2021-11-16 16:55:36 +01:00
4a3e7ad0c7 added insecure mode 2021-11-15 00:02:04 +01:00
19e1f366c8 added source/meta mod 2021-11-15 00:01:25 +01:00
3f4d62daac more like the csgo docker image 2021-11-01 15:53:00 +01:00
c3494df3b5 fill server.cfg directly
All checks were successful
continuous-integration/drone/push Build is passing
2021-04-26 13:46:10 +02:00
d8a5c6a064 Revert "rcon password"
All checks were successful
continuous-integration/drone/push Build is passing
This reverts commit e5df3ba1a9.
2021-04-25 20:08:14 +02:00
e5df3ba1a9 rcon password
All checks were successful
continuous-integration/drone/push Build is passing
2021-04-25 20:04:05 +02:00
a9c28b89ea motd and host file
All checks were successful
continuous-integration/drone/push Build is passing
2021-04-18 15:25:45 +02:00
6 changed files with 76 additions and 28 deletions

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,12 +0,0 @@
hostname "Left4Dead2 Server"
sv_allow_lobby_connect_only "0"
mp_disable_autokick "1"
sv_alltalk "0"
sv_consistency "1"
sv_voiceenable "1"
sv_log_onefile "0"
sv_lan "0"
sv_cheats "0"

View File

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