init commit

This commit is contained in:
Nomi Nonsense (Nonszy) 2025-08-16 14:07:26 +07:00
commit cdc8bccef0
18 changed files with 983 additions and 0 deletions

24
.gitignore vendored Normal file
View File

@ -0,0 +1,24 @@
app/bin
app/dedicatedserver_readme.txt
app/hl2
app/hlds_steamgames.vdf
app/l4d2-devkit.sh
app/left4dead2.*
app/left4dead2_*
app/platform
app/srcds.exe
app/steam_appid.txt
app/steamapps
app/update
!app/left4dead2/motd.txt
!app/left4dead2/host.txt
!app/left4dead2/cfg
!app/left4dead2/addons/data
!app/left4dead2/addons/extensions
!app/left4dead2/addons/scripting
!app/left4dead2/addons/plugins
!app/left4dead2/addons/translations
keys
inventory*ini

25
README.md Normal file
View File

@ -0,0 +1,25 @@
a Docker container for Left 4 Dead 2 Dedicated Server
# Preparation
## Ansible
## Manual
On the remote host you need to install:
- Wine stable [(From WineHQ)](https://gitlab.winehq.org/wine/wine/-/wikis/Debian-Ubuntu)
- Zip and Unzip
- libarchive-tools
- Xvfb
- PM2
You need have these environment variables, name it `.game.env`
```sh
export DIR_WINE="/wine"
export DIR_STEAMCMD="/wine/drive_c/SteamCMD"
export DIR_SERVER="/wine/drive_c/l4d2server"
export WINEPREFIX=$DIR_WINE
```

View File

@ -0,0 +1 @@
"STEAM_0:0:607601479" "99:z"

View File

@ -0,0 +1,20 @@
hostname "Nonszy Server"
rcon_password "Sk1b1d1_TR1T4NN!"
sv_lan 0
sv_region 0
// sv_password ""
sv_gametypes "coop"
sv_logfile 1
sv_logbans 1
sv_logecho 1
sm_cvar survivor_friendly_fire_factor_easy 0
sm_cvar survivor_friendly_fire_factor_expert 0
sm_cvar survivor_friendly_fire_factor_hard 0
sm_cvar survivor_friendly_fire_factor_normal 0
l4d_maxplayers 8
heartbeat

View File

@ -0,0 +1,560 @@
// This file was auto-generated by SourceMod (v1.12.0.7210)
// ConVars for plugin "l4d2_points_system.smx"
// How many points the adrenaline costs
// -
// Default: "10"
l4d2_points_adrenaline "10"
// How many points the ak47 costs
// -
// Default: "12"
l4d2_points_ak "12"
// How many points the autoshotgun costs
// -
// Default: "10"
l4d2_points_autoshotgun "10"
// How many points the awp costs
// -
// Default: "15"
l4d2_points_awp "15"
// How many points the baseball bat costs
// -
// Default: "4"
l4d2_points_bat "4"
// How many points the bile jar costs
// -
// Default: "8"
l4d2_points_bile "8"
// How many points does biling a tank earn
// -
// Default: "2"
l4d2_points_bile_tank "6"
// How many points does booming a survivor earn
// -
// Default: "1"
l4d2_points_boom "1"
// How many points does a boomer cost
// -
// Default: "5"
l4d2_points_boomer "5"
// Enable health catergory
// -
// Default: "1"
l4d2_points_cat_health "1"
// Enable melee catergory
// -
// Default: "1"
l4d2_points_cat_melee "1"
// Enable misc catergory
// -
// Default: "1"
l4d2_points_cat_misc "1"
// Enable rifles catergory
// -
// Default: "1"
l4d2_points_cat_rifles "1"
// Enable shotguns catergory
// -
// Default: "1"
l4d2_points_cat_shotguns "1"
// Enable smg catergory
// -
// Default: "1"
l4d2_points_cat_smg "1"
// Enable snipers catergory
// -
// Default: "1"
l4d2_points_cat_snipers "1"
// Enable throwables catergory
// -
// Default: "1"
l4d2_points_cat_throwables "1"
// Enable upgrades catergory
// -
// Default: "1"
l4d2_points_cat_upgrades "1"
// Enable weapons catergory
// -
// Default: "1"
l4d2_points_cat_weapons "1"
// How many points the chainsaw costs
// -
// Default: "10"
l4d2_points_chainsaw "10"
// How many points does charging a survivor earn
// -
// Default: "2"
l4d2_points_charge "6"
// How many points does a charger cost
// -
// Default: "6"
l4d2_points_charger "6"
// How many points the chrome shotgun costs
// -
// Default: "7"
l4d2_points_chrome "7"
// How many points does killing a certain amount of infected earn
// -
// Default: "2"
l4d2_points_cikill_value "8"
// How many kills you need to earn a killing spree bounty
// -
// Default: "25"
l4d2_points_cikills "25"
// How many points cola bottles costs
// -
// Default: "8"
l4d2_points_cola "8"
// How many points the cricket bat costs
// -
// Default: "4"
l4d2_points_cricketbat "4"
// How many points the crowbar costs
// -
// Default: "4"
l4d2_points_crowbar "4"
// How many points does doing damage earn
// -
// Default: "2"
l4d2_points_damage "4"
// How many points the defib costs
// -
// Default: "20"
l4d2_points_defib "20"
// How many points does defibbing a team mate earn
// -
// Default: "5"
l4d2_points_defib_action "5"
// Enable Point System?
// -
// Default: "1"
l4d2_points_enable "1"
// How many points the explosive ammo costs
// -
// Default: "10"
l4d2_points_explosive_ammo "10"
// How many points the explosive ammo pack costs
// -
// Default: "15"
l4d2_points_explosive_ammo_pack "15"
// How many points the fireaxe costs
// -
// Default: "4"
l4d2_points_fireaxe "4"
// How many points the fireworks crate costs
// -
// Default: "2"
l4d2_points_fireworks "2"
// How many points the gas can costs
// -
// Default: "5"
l4d2_points_gascan "5"
// How many points the gnome costs
// -
// Default: "8"
l4d2_points_gnome "8"
// How many points the golf club costs
// -
// Default: "6"
l4d2_points_golfclub "6"
// How many points the grenade launcher costs
// -
// Default: "15"
l4d2_points_grenade "15"
// How many points the guitar costs
// -
// Default: "4"
l4d2_points_guitar "4"
// How many kills you need to earn a head hunter bonus
// -
// Default: "20"
l4d2_points_headshots "20"
// How many points does killing a certain amount of infected with headshots earn
// -
// Default: "4"
l4d2_points_headshots_value "10"
// How many points does healing a team mate earn
// -
// Default: "5"
l4d2_points_heal "5"
// How many points does healing a team mate who did not need healing earn
// -
// Default: "1"
l4d2_points_heal_warning "1"
// How many points does a horde cost
// -
// Default: "15"
l4d2_points_horde "15"
// How many points does a hunter cost
// -
// Default: "4"
l4d2_points_hunter "4"
// How many points the hunting rifle costs
// -
// Default: "10"
l4d2_points_hunting_rifle "10"
// How many points does impacting a survivor earn
// -
// Default: "1"
l4d2_points_impact "4"
// How many points does incapping a survivor earn
// -
// Default: "3"
l4d2_points_incap "6"
// How many points the incendiary ammo costs
// -
// Default: "10"
l4d2_points_incendiary_ammo "10"
// How many points the incendiary ammo pack costs
// -
// Default: "15"
l4d2_points_incendiary_ammo_pack "15"
// How many points does healing yourself as an infected cost
// -
// Default: "6"
l4d2_points_infected_heal "6"
// How many points does a jockey cost
// -
// Default: "6"
l4d2_points_jockey "6"
// How many points the katana costs
// -
// Default: "6"
l4d2_points_katana "6"
// How many points does killing a survivor earn
// -
// Default: "5"
l4d2_points_kill "10"
// How many points the health kit costs
// -
// Default: "20"
l4d2_points_kit "20"
// How many points the knife costs
// -
// Default: "6"
l4d2_points_knife "6"
// How many points the laser sight costs
// -
// Default: "10"
l4d2_points_laser "10"
// How many points does reviving a hanging team mate earn
// -
// Default: "1"
l4d2_points_ledge "3"
// How many points the m16 costs
// -
// Default: "12"
l4d2_points_m16 "12"
// How many points the m60 costs
// -
// Default: "50"
l4d2_points_m60 "50"
// How many points the machete costs
// -
// Default: "6"
l4d2_points_machete "6"
// How many points the magnum costs
// -
// Default: "6"
l4d2_points_magnum "6"
// How many points the military sniper costs
// -
// Default: "14"
l4d2_points_military_sniper "14"
// How many points does a mob cost
// -
// Default: "10"
l4d2_points_mob "10"
// Which game modes to use Point System
// -
// Default: "coop,realism,versus,teamversus"
l4d2_points_modes "coop,realism,versus,teamversus"
// How many points the molotov costs
// -
// Default: "8"
l4d2_points_molotov "8"
// How many points the mp5 costs
// -
// Default: "7"
l4d2_points_mp5 "7"
// Show messages when points are earned?
// -
// Default: "1"
l4d2_points_notify "1"
// How many points the oxgen tank costs
// -
// Default: "2"
l4d2_points_oxygen "2"
// How many points the frying pan costs
// -
// Default: "4"
l4d2_points_pan "4"
// How many points the pills costs
// -
// Default: "10"
l4d2_points_pills "10"
// How many points the pipe bomb costs
// -
// Default: "8"
l4d2_points_pipe "8"
// How many points the pistol costs
// -
// Default: "4"
l4d2_points_pistol "4"
// How many points does pouncing a survivor earn
// -
// Default: "1"
l4d2_points_pounce "4"
// How many points the propane tank costs
// -
// Default: "2"
l4d2_points_propane "2"
// How many points does protecting a team mate earn
// -
// Default: "1"
l4d2_points_protect "1"
// How many points the pump shotgun costs
// -
// Default: "7"
l4d2_points_pump "7"
// How many points an ammo refill costs
// -
// Default: "8"
l4d2_points_refill "8"
// Which game modes to reset point count on round end and round start
// -
// Default: "versus,teamversus"
l4d2_points_reset_mapchange "versus,teamversus"
// How many points does reviving a team mate earn
// -
// Default: "3"
l4d2_points_revive "8"
// How many points does riding a survivor earn
// -
// Default: "2"
l4d2_points_ride "2"
// How many points the scar costs
// -
// Default: "12"
l4d2_points_scar "12"
// How many points the scout sniper costs
// -
// Default: "10"
l4d2_points_scout "10"
// How many points the sg552 costs
// -
// Default: "12"
l4d2_points_sg "12"
// How many points the shield costs
// -
// Default: "6"
l4d2_points_shield "6"
// How many points does killing a special infected earn
// -
// Default: "1"
l4d2_points_sikill "6"
// How many points the smg costs
// -
// Default: "7"
l4d2_points_smg "7"
// How many points does smoking a survivor earn
// -
// Default: "2"
l4d2_points_smoke "6"
// How many points does a smoker cost
// -
// Default: "4"
l4d2_points_smoker "4"
// How many points the spas shotgun costs
// -
// Default: "10"
l4d2_points_spas "10"
// How many times to attempt respawning when buying an special infected
// -
// Default: "2"
l4d2_points_spawn_tries "2"
// How many points does a spitter cost
// -
// Default: "6"
l4d2_points_spitter "6"
// How many points the silenced smg costs
// -
// Default: "7"
l4d2_points_ssmg "7"
// Points to start each round/map with.
// -
// Default: "0"
l4d2_points_start "0"
// How many points does suicide cost
// -
// Default: "4"
l4d2_points_suicide "4"
// How many points a complete heal costs
// -
// Default: "25"
l4d2_points_survivor_heal "25"
// How many points does a tank cost
// -
// Default: "30"
l4d2_points_tank "30"
// How much l4d2_points_infected_heal should be multiplied for tank players
// -
// Default: "3"
l4d2_points_tank_heal_mult "3"
// How many tanks to be allowed spawned per team
// -
// Default: "2"
l4d2_points_tank_limit "2"
// How many points does burning a tank earn
// -
// Default: "2"
l4d2_points_tankburn "2"
// How many points does killing a tank earn
// -
// Default: "2"
l4d2_points_tankkill "14"
// How many points does killing a tank single-handedly earn
// -
// Default: "8"
l4d2_points_tanksolo "16"
// How many points the tonfa costs
// -
// Default: "4"
l4d2_points_tonfa "4"
// How many points does an uncommon mob cost
// -
// Default: "12"
l4d2_points_umob "12"
// How many points does a witch cost
// -
// Default: "20"
l4d2_points_witch "20"
// How many witchs' to be allwed spawned per team
// -
// Default: "3"
l4d2_points_witch_limit "3"
// How many points does burning a witch earn
// -
// Default: "1"
l4d2_points_witchburn "4"
// How many points does crowning a witch earn
// -
// Default: "2"
l4d2_points_witchcrown "8"
// How many points does killing a witch earn
// -
// Default: "4"
l4d2_points_witchkill "10"

1
app/left4dead2/host.txt Normal file
View File

@ -0,0 +1 @@
Nonszy Workspace - Private Server | Running in USA

5
app/left4dead2/motd.txt Normal file
View File

@ -0,0 +1,5 @@
Welcome to my server :D
You are joining one of the Nonszy's a little corner of the Internet.
Currently only co-op game mode is supported.
Enjoy!

128
example.Jenkinsfile Normal file
View File

@ -0,0 +1,128 @@
// We use example so that you can create a new pipeline and modify it
pipeline {
agent any
environment {
NODE_USER = "steam"
NODE_HOST = "10.0.0.40"
DIR_WINE = "/wine"
DIR_STEAMCMD = "/wine/drive_c/SteamCMD"
DIR_SERVER = "/wine/drive_c/l4d2server"
DOWNLOAD_URL_SOURCEMOD = "https://sm.alliedmods.net/smdrop/1.12/sourcemod-1.12.0-git7210-windows.zip"
DOWNLOAD_URL_METAMOD = "https://mms.alliedmods.net/mmsdrop/1.12/mmsource-1.12.0-git1219-windows.zip"
L4D2_MAP = "c8m1_apartment"
L4D2_MAX_PLAYERS = 8
}
stages {
stage('Test Connection') {
steps {
sshagent(['l4d2-server']) {
sh '''
ssh ${NODE_USER}@${NODE_HOST} echo "Test Connection"
mkdir ~/.ssh || true
rm ~/.ssh/known_hosts || true
ssh-keyscan ${NODE_HOST} >> ~/.ssh/known_hosts
'''
}
}
}
stage('Test Installation') {
steps {
sshagent(['l4d2-server']) {
sh '''
ssh ${NODE_USER}@${NODE_HOST} 'bash -s' < ./scripts/checkwine.sh
'''
}
}
}
stage('Compiling addons') {
agent {
docker {
image 'debian:bookworm'
args '-u root'
}
}
environment {
DIR_WORKDIR = "/dependencies"
DIR_ADDONS = "${DIR_WORKDIR}/addons"
DIR_SOURCEMOD = "${DIR_ADDONS}/sourcemod"
DIR_SCRIPTING = "${DIR_SOURCEMOD}/scripting"
DIR_WORKSPACE_SCRIPTING = "${WORKSPACE}/app/left4dead2/addons/sourcemod/scripting"
}
steps {
sh '''
apt update && apt install -y wget git curl libarchive-tools lib32stdc++6
mkdir $DIR_WORKDIR
bash ./scripts/getbuildtools.sh
'''
sh '''
for scrs in ./scripts/addons/*.sh; do bash "$scrs"; done
if [ -d "$DIR_WORKSPACE_SCRIPTING" ]; then
cp -v "$DIR_WORKSPACE_SCRIPTING"/*.sp $DIR_SCRIPTING || true
fi
bash $DIR_SCRIPTING/compile.sh
bash ./scripts/cleantools.sh
'''
}
}
stage('Install and check the game server') {
when {
expression { !params.SKIP_UPDATE }
}
steps {
sshagent(['l4d2-server']) {
sh '''
echo "Cleaning configuration"
ssh ${NODE_USER}@${NODE_HOST} "
rm -r ${DIR_SERVER}/left4dead2/cfg/sourcemod || true
"
ssh ${NODE_USER}@${NODE_HOST} 'bash -s' < ./scripts/getgame.sh
echo "Cleaning Addons"
ssh ${NODE_USER}@${NODE_HOST} "
rm -r ${DIR_SERVER}/left4dead2/addons/metam* || true
rm -r ${DIR_SERVER}/left4dead2/addons/sourcemod || true
curl -sL ${DOWNLOAD_URL_SOURCEMOD} | bsdtar -xf - -C ${DIR_SERVER}/left4dead2
curl -sL ${DOWNLOAD_URL_METAMOD} | bsdtar -xf - -C ${DIR_SERVER}/left4dead2
"
'''
}
}
}
stage('Ship the configuration') {
steps {
sshagent(['l4d2-server']) {
sh '''
tar czf - -C ./app left4dead2 | ssh ${NODE_USER}@${NODE_HOST} "tar xzf - -C ${DIR_SERVER}"
'''
}
}
}
stage('Run the game') {
steps {
sshagent(['l4d2-server']) {
sh '''
ssh ${NODE_USER}@${NODE_HOST} "
source /home/${NODE_USER}/.bashrc
source /home/${NODE_USER}/.game.env
pm2 start 'xvfb-run -a \
wine $DIR_SERVER/srcds.exe \
-console \
-game left4dead2 \
-usercon \
+map ${L4D2_MAP} \
+exec server.cfg \
+maxplayers ${L4D2_MAX_PLAYERS}' \
--name l4d2server
sleep 5
pm2 logs --nostream l4d2-server
"
'''
}
}
}
}
}

110
playbook.yml Normal file
View File

@ -0,0 +1,110 @@
# ansible-playbook -i inventory.ini playbook.yml --key-file=keys/server -vv
- name: Setup Left 4 Dead Server
hosts: l4d2servers
remote_user: root
tasks:
- name: Enable 32 bit architecture
command: dpkg --add-architecture i386
- name: Update apt cache
apt:
update_cache: yes
- name: Upgrade all packages
apt:
upgrade: dist
- name: Install required packages
apt:
name:
- wget
- unzip
- libarchive-tools
- xvfb
- curl
state: present
- name: Create keyrings directory
file:
path: /etc/apt/keyrings
state: directory
mode: '0755'
- name: Download WineHQ repository key
get_url:
url: https://dl.winehq.org/wine-builds/winehq.key
dest: /tmp/winehq.key
- name: Convert WineHQ key to gpg format
command:
cmd: gpg --dearmor -o /etc/apt/keyrings/winehq-archive.key /tmp/winehq.key
creates: /etc/apt/keyrings/winehq-archive.key
- name: Add WineHQ repository
get_url:
url: https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources
dest: /etc/apt/sources.list.d/winehq-jammy.sources
- name: Upgrade packages
apt:
upgrade: dist
- name: Install WineHQ
apt:
name:
- winehq-stable
state: latest
install_recommends: yes
- name: Download NodeSource setup script
get_url:
url: https://deb.nodesource.com/setup_18.x
dest: /tmp/nodesource_setup.sh
- name: Run NodeSource setup script
command: bash /tmp/nodesource_setup.sh
- name: Install Node.js
apt:
name: nodejs
state: present
- name: Install PM2
npm:
name: pm2
global: yes
- name: Create steam user
user:
name: steam
shell: /bin/bash
state: present
create_home: yes
- name: Create /wine directory
file:
path: /wine
state: directory
owner: steam
group: steam
mode: '0755'
- name: Create game environment
copy:
dest: /home/steam/.game.env
owner: steam
group: steam
mode: '0644'
content: |
export DIR_WINE="/wine"
export DIR_STEAMCMD="/wine/drive_c/SteamCMD"
export DIR_SERVER="/wine/drive_c/l4d2server"
export WINEPREFIX=$DIR_WINE
- name: Add environment source to .bashrc
lineinfile:
path: /home/steam/.bashrc
line: 'source $HOME/.game.env'
owner: steam
group: steam
mode: '0644'

View File

@ -0,0 +1,13 @@
#!/bin/bash
SRCD_URL=https://gitea.nonszy.space/nomi-nonsz/left4dead2-admingod.git
echo "Installing AdminGOD"
cd $DIR_SOURCEMOD
git clone -b main --single-branch $SRCD_URL
rm -rvf $DIR_SOURCEMOD/left4dead2-admingod/.git
cp -rv $DIR_SOURCEMOD/left4dead2-admingod/* $DIR_SOURCEMOD
rm -rv $DIR_SOURCEMOD/left4dead2-admingod

View File

@ -0,0 +1,7 @@
#!/bin/bash
SRCD_URL="https://forums.alliedmods.net/attachment.php?attachmentid=195507&d=1751361366"
echo "Installing Left 4 DHooks"
curl -sL "$SRCD_URL" | bsdtar -xf - -C $DIR_ADDONS

View File

@ -0,0 +1,9 @@
#!/bin/bash
SRCD_URL="https://forums.alliedmods.net/attachment.php?attachmentid=111241&d=1350927414"
echo "Installing Left 4 Downtown 2"
curl -sL "$SRCD_URL" | bsdtar -xf - -C $DIR_SOURCEMOD
rm -v $DIR_SOURCEMOD/README.txt

View File

@ -0,0 +1,13 @@
#!/bin/bash
SRCD_URL=https://github.com/nomi-nonsz/PointsSystem.git
echo "Installing Points System"
cd $DIR_SOURCEMOD
git clone -b fix/sourcemod-1.10-enum --single-branch $SRCD_URL
rm -rvf $DIR_SOURCEMOD/PointsSystem/.git
cp -rv $DIR_SOURCEMOD/PointsSystem/* $DIR_SOURCEMOD
rm -rv $DIR_SOURCEMOD/PointsSystem

View File

@ -0,0 +1,7 @@
#!/bin/bash
SRCD_URL="https://www.sourcemod.net/vbcompiler.php?file_id=130314"
echo "Installing Survivor Respawning"
wget -O $DIR_SOURCEMOD/plugins/survivor-respawning.smx "$SRCD_URL"

16
scripts/checkwine.sh Normal file
View File

@ -0,0 +1,16 @@
#!/bin/bash
if [ ! -f $HOME/.game.env ]; then
echo "Error: .game.env not found"
exit 1
fi
source $HOME/.game.env
if [ -d "$DIR_WINE" ] && [ "$(stat -c '%U' "$DIR_WINE")" = "$USER" ] && command -v wine >/dev/null 2>&1; then
wine --version
echo "Wine seems installed correctly"
else
echo "Wine is not installed correctly"
exit 1
fi

9
scripts/cleantools.sh Normal file
View File

@ -0,0 +1,9 @@
#!/bin/bash
mkdir $DIR_SOURCEMOD/plugins
mv -v $DIR_SCRIPTING/compiled/*.smx $DIR_SOURCEMOD/plugins
rm -v addons/sourcemod/scripting/spcomp \
addons/sourcemod/scripting/spcomp64 \
addons/sourcemod/scripting/compile.sh
cp -rv $DIR_SOURCEMOD "$WORKSPACE/app/left4dead2/addons"
rm -rfv $DIR_WORKDIR

14
scripts/getbuildtools.sh Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
SOURCEMOD_DOWNLOAD_URL="https://sm.alliedmods.net/smdrop/1.12/sourcemod-1.12.0-git7210-linux.tar.gz"
SOURCEMOD_FILENAME="sourcemod.tar.gz"
wget -q -O $DIR_WORKDIR/$SOURCEMOD_FILENAME $SOURCEMOD_DOWNLOAD_URL
tar -zxvf $DIR_WORKDIR/$SOURCEMOD_FILENAME \
addons/sourcemod/scripting/include \
addons/sourcemod/scripting/spcomp \
addons/sourcemod/scripting/spcomp64 \
addons/sourcemod/scripting/compile.sh
mv -v addons $DIR_WORKDIR

21
scripts/getgame.sh Normal file
View File

@ -0,0 +1,21 @@
#!/bin/bash
source $HOME/.game.env
PM_APP_NAME="l4d2server"
if [ ! -f $DIR_STEAMCMD/steamcmd.exe ]; then
mkdir -p $DIR_STEAMCMD || true
cd $DIR_STEAMCMD
wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip
unzip steamcmd.zip
rm steamcmd.zip
fi
if [ ! -d $DIR_SERVER ]; then
mkdir -p $DIR_SERVER
fi
pm2 delete all
wine $DIR_STEAMCMD/steamcmd.exe +force_install_dir C:\\l4d2server +login anonymous +app_update 222860 validate +quit