mirror of
https://github.com/ENSL/ensl_hlds.git
synced 2024-12-13 22:10:42 +00:00
Update Dockerfile
Update Dockerfile to work again. Add updated FPS script. Add overlay placeholde directory.
This commit is contained in:
parent
655e7fbcd6
commit
4dfd8a3a44
7 changed files with 101 additions and 35 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,2 +1,4 @@
|
||||||
cfg/*.*
|
overlay/*
|
||||||
|
!overlay/.placeholder
|
||||||
logs
|
logs
|
||||||
|
scripts/data*
|
||||||
|
|
28
Dockerfile
28
Dockerfile
|
@ -2,8 +2,9 @@ FROM ubuntu
|
||||||
|
|
||||||
RUN dpkg --add-architecture i386 && \
|
RUN dpkg --add-architecture i386 && \
|
||||||
apt-get update && \
|
apt-get update && \
|
||||||
apt-get -y install wget lib32gcc1 lib32stdc++6 libcurl3 unzip liblz4-tool
|
apt-get -y install wget lib32gcc1 lib32stdc++6 libcurl3 unzip liblz4-tool libcurl3:i386 gcc-multilib g++-multilib
|
||||||
|
|
||||||
|
# Accept ToS
|
||||||
RUN printf "\n2\n"|apt-get install -y steamcmd
|
RUN printf "\n2\n"|apt-get install -y steamcmd
|
||||||
|
|
||||||
RUN useradd -m steam
|
RUN useradd -m steam
|
||||||
|
@ -29,31 +30,32 @@ RUN mkdir -p ~/.steam/sdk32 && ln -s ~/.steam/steamcmd/linux32/steamclient.so ~/
|
||||||
|
|
||||||
WORKDIR /home/steam/hlds
|
WORKDIR /home/steam/hlds
|
||||||
|
|
||||||
|
# Install NS
|
||||||
RUN wget 'https://www.ensl.org/files/server/ns_dedicated_server_v32.zip'
|
RUN wget 'https://www.ensl.org/files/server/ns_dedicated_server_v32.zip'
|
||||||
COPY --chown=steam files/ns.sha /home/steam/hlds
|
COPY --chown=steam files/ns.sha /home/steam/hlds
|
||||||
# RUN sha256sum -c ns.sha
|
# RUN sha256sum -c ns.sha
|
||||||
|
|
||||||
RUN unzip ns_dedicated_server_v32.zip
|
RUN unzip ns_dedicated_server_v32.zip
|
||||||
|
|
||||||
# NS workaround
|
WORKDIR /home/steam/hlds/ns
|
||||||
RUN echo 70 > ns/steam_appid.txt
|
|
||||||
RUN mv ns/dlls/ns_i386.so ns/dlls/ns.so
|
|
||||||
|
|
||||||
# Copy own configs including bans
|
# NS workarounds
|
||||||
ADD --chown=steam cfg/ /home/steam/hlds/ns/
|
RUN echo 70 > steam_appid.txt
|
||||||
|
RUN mv dlls/ns_i386.so dlls/ns.so
|
||||||
|
|
||||||
|
# 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 unzip -o srv.zip
|
||||||
|
|
||||||
# Use seperate server.cfg because autoexec.cfg is unreliable
|
# Use seperate server.cfg because autoexec.cfg is unreliable
|
||||||
RUN touch /home/steam/hlds/ns/server.cfg
|
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 entry.sh /home/steam/hlds
|
||||||
|
RUN chown -R steam:steam /home/steam
|
||||||
USER root
|
|
||||||
RUN apt-get update && apt-get install -y libcurl3 libcurl3:i386 gcc-multilib g++-multilib
|
|
||||||
USER steam
|
|
||||||
|
|
||||||
WORKDIR /home/steam/hlds
|
WORKDIR /home/steam/hlds
|
||||||
RUN wget https://github.com/ENSL/ensl-plugin/releases/download/v1.3/ensl_srvpkg-v1.3.zip -O srv.zip
|
|
||||||
RUN unzip srv.zip
|
|
||||||
|
|
||||||
# VAC, HLDS, RCON, HLTV
|
# VAC, HLDS, RCON, HLTV
|
||||||
EXPOSE 26900
|
EXPOSE 26900
|
||||||
|
|
15
README.md
15
README.md
|
@ -1 +1,14 @@
|
||||||
# ensl_hlds
|
# ENSL HLDS Dockerfile.
|
||||||
|
|
||||||
|
How to use:
|
||||||
|
* `make build` to build Docker image
|
||||||
|
* `make run` to start NS1 server at default port on localhost
|
||||||
|
* `make stop` to stop the NS1 server
|
||||||
|
* `make clean` to clean containers and images
|
||||||
|
|
||||||
|
Add any custom configs you want to to overlay directory.
|
||||||
|
|
||||||
|
Features:
|
||||||
|
* Basically installs HLDS + NS1 server + ENSL Plugin.
|
||||||
|
* Also adds log compression with LZ4.
|
||||||
|
* Optional argument to enable HLTV.
|
||||||
|
|
1
entry.sh
1
entry.sh
|
@ -15,3 +15,4 @@ if [ -z $ROTATE_LOGS ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
./hlds_run -game ns +maxplayers 32 +log on +map ns_veil +exec ns/server.cfg
|
./hlds_run -game ns +maxplayers 32 +log on +map ns_veil +exec ns/server.cfg
|
||||||
|
bash
|
||||||
|
|
0
overlay/.placeholder
Normal file
0
overlay/.placeholder
Normal file
68
scripts/fps.py
Executable file
68
scripts/fps.py
Executable file
|
@ -0,0 +1,68 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
import rHLDS, yaml, re, time, os, argparse
|
||||||
|
from bokeh.plotting import figure, output_file, show
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
def write_data(filename):
|
||||||
|
# Default port 27015
|
||||||
|
srv = rHLDS.Console(host=os.environ['RCON_HOST'], port=os.environ['RCON_PORT'], password=os.environ['RCON_PASSWORD'])
|
||||||
|
srv.connect()
|
||||||
|
|
||||||
|
timestamp = time.time()
|
||||||
|
file1 = open(filename, "a+")
|
||||||
|
|
||||||
|
try:
|
||||||
|
while True:
|
||||||
|
data = srv.execute("stats")
|
||||||
|
fps = re.search('(\d+.?\d*)(\d+.?\d*\s*)(\d+.?\d*\s*)(\d+.?\d*\s*)(\d+.?\d*\s*)(\d+.?\d*\s*)(\d+.?\d*\s*)', data).group(7)
|
||||||
|
if fps:
|
||||||
|
file1.write("%d,%s\n" % (time.time(), fps))
|
||||||
|
print(fps + " ", end='')
|
||||||
|
time.sleep(5)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
file1.close()
|
||||||
|
srv.disconnect()
|
||||||
|
|
||||||
|
# Read data
|
||||||
|
def read_data(filename):
|
||||||
|
file1 = open(filename, "r")
|
||||||
|
fps_time = []
|
||||||
|
fps_data = []
|
||||||
|
|
||||||
|
while True:
|
||||||
|
line = file1.readline()
|
||||||
|
if not line: break
|
||||||
|
time = re.search('(\d+),(\d+).(\d*)', line).group(1)
|
||||||
|
fps = re.search('(\d+),(\d+)', line).group(2)
|
||||||
|
if fps and time:
|
||||||
|
print('time: ' + time)
|
||||||
|
print('fps: ' + fps)
|
||||||
|
fps_time.append(datetime.fromtimestamp(int(time)/1000))
|
||||||
|
fps_data.append(fps)
|
||||||
|
|
||||||
|
# output to static HTML file
|
||||||
|
output_file("%s.html" % filename)
|
||||||
|
|
||||||
|
# create a new plot with a title and axis labels
|
||||||
|
p = figure(title="hlds_linux stats", x_axis_label='time', y_axis_label='FPS')
|
||||||
|
|
||||||
|
# add a line renderer with legend and line thickness
|
||||||
|
p.line(fps_time, fps_data, legend="FPS", line_width=2)
|
||||||
|
|
||||||
|
# show the results
|
||||||
|
show(p)
|
||||||
|
|
||||||
|
filename = "data.%d" % time.time()
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument("--file", help="Use the given file")
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
if not args.file:
|
||||||
|
write_data(filename)
|
||||||
|
else:
|
||||||
|
filename = args.file
|
||||||
|
|
||||||
|
read_data(filename)
|
|
@ -1,20 +0,0 @@
|
||||||
import rHLDS, yaml, re, time, os
|
|
||||||
|
|
||||||
# Default port 27015
|
|
||||||
srv = rHLDS.Console(host=os.environ['RCON_HOST'], port=os.environ['RCON_PORT'], password=os.environ['RCON_PASSWORD'])
|
|
||||||
|
|
||||||
# Connect to server
|
|
||||||
srv.connect()
|
|
||||||
|
|
||||||
file1 = open("data.txt", "a+")
|
|
||||||
|
|
||||||
while True:
|
|
||||||
data = srv.execute("stats")
|
|
||||||
fps = re.search('(\d+.?\d*)(\d+.?\d*\s*)(\d+.?\d*\s*)(\d+.?\d*\s*)(\d+.?\d*\s*)(\d+.?\d*\s*)(\d+.?\d*\s*)', data).group(7)
|
|
||||||
if fps:
|
|
||||||
file1.write("%d,%s\n" % (time.time(), fps))
|
|
||||||
time.sleep(10)
|
|
||||||
|
|
||||||
file1.close()
|
|
||||||
srv.disconnect()
|
|
||||||
|
|
Loading…
Reference in a new issue