mirror of
https://github.com/ENSL/ensl_hlds.git
synced 2024-12-12 21:42:03 +00:00
Add log rotation
Also fix Makefile
This commit is contained in:
parent
fddd481c78
commit
b7116f85dc
4 changed files with 27 additions and 7 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
cfg/*.*
|
||||
logs
|
||||
|
|
|
@ -2,7 +2,7 @@ FROM ubuntu
|
|||
|
||||
RUN dpkg --add-architecture i386 && \
|
||||
apt-get update && \
|
||||
apt-get -y install wget lib32gcc1 lib32stdc++6 libcurl3 unzip
|
||||
apt-get -y install wget lib32gcc1 lib32stdc++6 libcurl3 unzip liblz4-tool
|
||||
|
||||
RUN printf "\n2\n"|apt-get install -y steamcmd
|
||||
|
||||
|
@ -40,15 +40,17 @@ RUN echo 70 > ns/steam_appid.txt
|
|||
RUN mv ns/dlls/ns_i386.so ns/dlls/ns.so
|
||||
|
||||
# Copy own configs including bans
|
||||
ADD cfg/ /home/steam/hlds/ns/
|
||||
ADD --chown=steam cfg/ /home/steam/hlds/ns/
|
||||
|
||||
# Use seperate server.cfg because autoexec.cfg is unreliable
|
||||
RUN touch /home/steam/hlds/ns/server.cfg
|
||||
|
||||
COPY entry.sh /home/steam/hlds
|
||||
|
||||
# VAC, HLDS, RCON, HLTV
|
||||
EXPOSE 26900
|
||||
EXPOSE 27015/udp
|
||||
EXPOSE 27015
|
||||
EXPOSE 27020
|
||||
|
||||
ENTRYPOINT ["./hlds_run", "-game ns", "+maxplayers 32", "+log on", "+map ns_veil", "+exec ns/server.cfg"]
|
||||
ENTRYPOINT ["./entry.sh"]
|
||||
|
|
8
Makefile
8
Makefile
|
@ -21,10 +21,11 @@ build: Dockerfile
|
|||
docker build -t $(IMAGE) .
|
||||
|
||||
run: build
|
||||
docker run -ti $(IMAGE)
|
||||
mkdir -p logs
|
||||
docker run -v $(shell pwd)/logs:/home/steam/hlds/ns/logs -ti $(IMAGE)
|
||||
|
||||
shell: build
|
||||
docker run -u0 -ti $(IMAGE) -v $(shell pwd)/logs:/home/steam/hlds/ns/logs /bin/bash
|
||||
shell:
|
||||
docker exec -u0 -ti $(IMAGE) -v /bin/bash
|
||||
|
||||
pull:
|
||||
docker pull $(IMAGE) || true
|
||||
|
@ -33,6 +34,5 @@ push:
|
|||
docker push $(IMAGE)
|
||||
|
||||
clean:
|
||||
rm -f $(shell pwd)/logs/*
|
||||
docker ps -a | awk '{ print $$1,$$2 }' | grep $(IMAGE) |awk '{print $$1 }' |xargs -I {} docker rm {}
|
||||
docker images -a |grep $(IMAGE) |awk '{print $$3}' |xargs -I {} docker rmi {}
|
||||
|
|
17
entry.sh
Executable file
17
entry.sh
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/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
|
Loading…
Reference in a new issue