mirror of
https://github.com/ENSL/ensl_hlds.git
synced 2024-11-10 07:11:38 +00:00
Update for docker-compose
Add latest ENSL plugin. Add docker-compose file. Update dockerfile to support 3.2.1b. ADd entry script that works on all docker images. Add seperate log rotation scripts
This commit is contained in:
parent
5c35b8a155
commit
5d59382be8
8 changed files with 106 additions and 26 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -1,4 +1,7 @@
|
|||
overlay/*
|
||||
!overlay/.placeholder
|
||||
logs
|
||||
logs/
|
||||
!logs/.placeholder
|
||||
demos/
|
||||
!logs/.placeholder
|
||||
scripts/data*
|
||||
|
|
21
Dockerfile
21
Dockerfile
|
@ -2,7 +2,7 @@ FROM ubuntu
|
|||
|
||||
RUN dpkg --add-architecture i386 && \
|
||||
apt-get update && \
|
||||
apt-get -y install wget lib32gcc1 lib32stdc++6 libcurl3 unzip liblz4-tool libcurl3:i386 gcc-multilib g++-multilib
|
||||
apt-get -y install wget lib32gcc1 lib32stdc++6 libcurl3:i386 unzip liblz4-tool gcc-multilib g++-multilib
|
||||
|
||||
# Accept ToS
|
||||
RUN printf "\n2\n"|apt-get install -y steamcmd
|
||||
|
@ -30,6 +30,9 @@ RUN mkdir -p ~/.steam/sdk32 && ln -s ~/.steam/steamcmd/linux32/steamclient.so ~/
|
|||
|
||||
WORKDIR /home/steam/hlds
|
||||
|
||||
# NS bug workaround. Since NS links to a GCC which is not included in the steam-provided libstdc++:i386
|
||||
RUN mv libstdc++* /home/steam/
|
||||
|
||||
# Install NS
|
||||
RUN wget 'https://www.ensl.org/files/server/ns_dedicated_server_v32.zip'
|
||||
COPY --chown=steam files/ns.sha /home/steam/hlds
|
||||
|
@ -42,9 +45,13 @@ WORKDIR /home/steam/hlds/ns
|
|||
RUN echo 70 > steam_appid.txt
|
||||
RUN mv dlls/ns_i386.so dlls/ns.so
|
||||
|
||||
# Patch NS
|
||||
RUN wget 'https://github.com/ENSL/NS/releases/download/v3.2.1b/ns_v321a_patch.zip' && unzip -o ns_v321a_patch.zip
|
||||
|
||||
# ENSL package
|
||||
RUN cp liblist.gam liblist.bak
|
||||
RUN wget https://github.com/ENSL/ensl-plugin/releases/download/v1.4/ensl_srvpkg-v1.4.zip -O srv.zip
|
||||
# RUN wget https://github.com/ENSL/ensl-plugin/releases/download/v1.4/ensl_srvpkg-v1.4.zip -O srv.zip
|
||||
RUN echo && wget https://github.com/ENSL/ensl-plugin/releases/download/1.4-extra/ENSL_SrvPkg-1.4-extra.zip -O srv.zip
|
||||
RUN unzip -o srv.zip
|
||||
|
||||
# Use seperate server.cfg because autoexec.cfg is unreliable
|
||||
|
@ -52,12 +59,13 @@ RUN touch /home/steam/hlds/ns/server.cfg
|
|||
|
||||
# Copy own configs including bans
|
||||
ADD overlay /home/steam/hlds/ns/
|
||||
COPY entry.sh /home/steam/hlds
|
||||
COPY scripts/*.sh /home/steam/hlds/
|
||||
|
||||
USER root
|
||||
RUN chown -R steam:steam /home/steam
|
||||
|
||||
RUN chown -R steam /home/steam/hlds
|
||||
RUN apt-get install -y libstdc++6:i386
|
||||
USER steam
|
||||
|
||||
WORKDIR /home/steam/hlds
|
||||
|
||||
# VAC, HLDS, RCON, HLTV
|
||||
|
@ -66,4 +74,5 @@ EXPOSE 27016/udp
|
|||
EXPOSE 27016
|
||||
EXPOSE 27020
|
||||
|
||||
ENTRYPOINT ["./entry.sh"]
|
||||
#ENTRYPOINT ["/bin/bash"]
|
||||
ENTRYPOINT ["/home/steam/hlds/entry.sh"]
|
||||
|
|
25
docker-compose.yml
Normal file
25
docker-compose.yml
Normal file
|
@ -0,0 +1,25 @@
|
|||
version: "3"
|
||||
|
||||
services:
|
||||
hlds:
|
||||
image: ensl/ensl_hlds:latest
|
||||
volumes:
|
||||
- "./logs:/home/steam/hlds/ns/logs"
|
||||
network_mode: "host"
|
||||
environment:
|
||||
- HLDS=1
|
||||
hltv:
|
||||
image: ensl/ensl_hlds:latest
|
||||
volumes:
|
||||
- "./demos:/home/steam/hlds/ns/demos"
|
||||
network_mode: "host"
|
||||
environment:
|
||||
- HLTV=1
|
||||
cleaner:
|
||||
image: ensl/ensl_hlds:latest
|
||||
volumes:
|
||||
- "./demos:/home/steam/hlds/ns/demos"
|
||||
- "./logs:/home/steam/hlds/ns/logs"
|
||||
environment:
|
||||
- HLDS_ROTATE=1
|
||||
- HLTV_ROTATE=1
|
18
entry.sh
18
entry.sh
|
@ -1,18 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
function rotateLogs() {
|
||||
while true; do
|
||||
cd /home/steam/hlds/ns/logs || exit 1
|
||||
find . -iname '*.log' -mmin +60 -printf 'Rotated: %p\n' -exec lz4 -z -9 -q "{}" "{}.lz" \;
|
||||
sleep 300
|
||||
done
|
||||
}
|
||||
|
||||
if [ -z $ROTATE_LOGS ]; then
|
||||
which lz4 &>/dev/null || echo "LZ4 not found."
|
||||
rotateLogs >> /home/steam/hlds/ns/logs/rotate_logs.log &
|
||||
echo "Rotating logs."
|
||||
fi
|
||||
|
||||
./hlds_run -game ns +maxplayers 32 +log on +map ns_veil +exec ns/server.cfg
|
||||
bash
|
29
scripts/entry.sh
Executable file
29
scripts/entry.sh
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/bin/bash
|
||||
|
||||
cd /home/steam/hlds
|
||||
|
||||
echo "in entry_steam.sh"
|
||||
env|grep HL
|
||||
|
||||
if [[ "$HLDS_ROTATE" = "1" ]]; then
|
||||
which lz4 &>/dev/null || echo "LZ4 not found."
|
||||
./rotate_logs.sh >> /home/steam/hlds/ns/logs/rotate.log &
|
||||
echo "Rotating logs in background."
|
||||
fi
|
||||
if [[ "$HLTV_ROTATE" = "1" ]]; then
|
||||
which lz4 &>/dev/null || echo "LZ4 not found."
|
||||
./rotate_demos.sh >> /home/steam/hlds/ns/demos/rotate.log
|
||||
echo "Rotating demos in background."
|
||||
fi
|
||||
|
||||
if [[ "$HLTV" = "1" ]]; then
|
||||
echo "Starting HLTV"
|
||||
export LD_LIBRARY_PATH=.
|
||||
./hltv +serverpassword europe +connect localhost:27015 +record demos/gathers >> /home/steam/hlds/ns/demos/hltv-`date +%F-%h:%m`.log
|
||||
elif [[ "$HLDS" = "1" ]]; then
|
||||
echo "Starting HLDS"
|
||||
export LD_LIBRARY_PATH=.
|
||||
./hlds_run -game ns +maxplayers 32 +log on +map ns_veil +exec ns/server.cfg -pingboost 3 +sys_ticrate 1000
|
||||
fi
|
||||
|
||||
bash
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
sudo taskset -a -p -c 1 `pgrep hlds_linux`
|
||||
sudo renice -19 `pgrep hlds_linux`
|
||||
sudo renice -20 `pgrep hlds_linux`
|
||||
|
|
16
scripts/rotate_demos.sh
Executable file
16
scripts/rotate_demos.sh
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
rotateFiles() {
|
||||
file="$0".zip
|
||||
if test -f "$file";
|
||||
then rm "$0" && echo "Removed: $0"
|
||||
else
|
||||
zip -9 --quiet -r "$0.zip" "$0" && rm "$0" && echo "Rotated: $0"
|
||||
fi
|
||||
}
|
||||
|
||||
while true; do
|
||||
export -f rotateFiles
|
||||
find . -maxdepth 1 -iname '*.dem' -mmin +30 -exec bash -c 'rotateFiles "$0"' {} \;
|
||||
sleep 300
|
||||
done
|
16
scripts/rotate_logs.sh
Executable file
16
scripts/rotate_logs.sh
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
rotateFiles() {
|
||||
file="$0".lz4
|
||||
if test -f "$file";
|
||||
then rm "$0" && echo "Removed: $0"
|
||||
else
|
||||
lz4 -9 -z -q "$0.lz4" "$0" && rm "$0" && echo "Rotated: $0"
|
||||
fi
|
||||
}
|
||||
|
||||
while true; do
|
||||
export -f rotateFiles
|
||||
find . -maxdepth 1 -iname '*.log' -mmin +30 -exec bash -c 'rotateFiles "$0"' {} \;
|
||||
sleep 300
|
||||
done
|
Loading…
Reference in a new issue