-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from startersclan/enhancement/add-http-server-…
…to-forward-srcds-cs2-logs-to-daemon Enhancement: Add HTTP server to forward `srcds/cs2` logs to daemon
- Loading branch information
Showing
9 changed files
with
461 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,85 @@ | ||
# In this example, you will see that the Counterstrike 1.6 gameserver sends its UDP logs to `source-udp-forwarder` which then proxies (forwards) logs to the HLStatsX:CE perl daemon. | ||
# In this example, you will see that Counterstrike 1.6 server sends its UDP logs to `source-udp-forwarder` which then proxies (forwards) logs to the HLStatsX:CE perl daemon | ||
# This will work for all GoldSource games (https://developer.valvesoftware.com/wiki/GoldSrc), such as Half-Life and Condition Zero | ||
version: '2.2' | ||
services: | ||
# 1. Counter-Strike 1.6 gameserver sends UDP logs to source-udp-forwarder | ||
# See: https://github.com/startersclan/docker-sourceservers | ||
cstrike: | ||
image: goldsourceservers/cstrike:latest | ||
network_mode: host | ||
volumes: | ||
- dns-volume:/dns:ro | ||
ports: | ||
- 27015:27015/udp | ||
networks: | ||
- default | ||
stdin_open: true | ||
tty: true | ||
stop_signal: SIGKILL | ||
depends_on: | ||
- source-udp-forwarder | ||
entrypoint: | ||
- /bin/bash | ||
command: | ||
- -c | ||
- | | ||
set -eu | ||
exec hlds_linux -console -noipx -secure -game cstrike +map de_dust2 +maxplayers 32 +sv_lan 0 +ip 0.0.0.0 +port 27015 +log on +logaddress_add 127.0.0.1 26999 | ||
exec hlds_linux -console -noipx -secure -game cstrike +map de_dust2 +maxplayers 32 +sv_lan 0 +ip 0.0.0.0 +port 27015 +rcon_password password +log on +logaddress_add "$$( cat /dns/source-udp-forwarder )" 26999 | ||
# 2. The proxy forwards gameserver logs to the daemon | ||
# source-udp-forwarder: https://github.com/startersclan/source-udp-forwarder | ||
# 2. source-udp-forwarder proxy forwards gameserver logs to the daemon | ||
# See: https://github.com/startersclan/source-udp-forwarder | ||
source-udp-forwarder: | ||
image: startersclan/source-udp-forwarder:latest | ||
environment: | ||
- UDP_LISTEN_ADDR=:26999 | ||
- UDP_FORWARD_ADDR=127.0.0.1:27500 | ||
- LISTEN_ADDR=:26999 | ||
- UDP_FORWARD_ADDR=daemon:27500 | ||
- FORWARD_PROXY_KEY=somedaemonsecret # The daemon's proxy_key secret | ||
- FORWARD_GAMESERVER_IP=192.168.1.100 # The gameserver's IP as registered in the HLStatsX:CE database | ||
- FORWARD_GAMESERVER_PORT=27015 # The gameserver's IP as registered in the HLStatsX:CE database | ||
- LOG_LEVEL=DEBUG | ||
- LOG_FORMAT=txt | ||
network_mode: host | ||
volumes: | ||
- dns-volume:/dns | ||
networks: | ||
- default | ||
depends_on: | ||
- daemon | ||
entrypoint: | ||
- /bin/sh | ||
command: | ||
- -c | ||
- | | ||
set -eu | ||
echo "Outputting my IP address" | ||
ip addr show eth0 | grep 'inet ' | awk '{print $$2}' | cut -d '/' -f1 | tee /dns/source-udp-forwarder | ||
exec /source-udp-forwarder | ||
# 3. HLStatsX:CE perl daemon accepts the gameserver logs. Gameserver Logs are parsed and stats are recorded | ||
# The daemon's proxy_key secret can only be setup in the HLStatsX:CE Web Admin Panel and not via env vars | ||
# HLStatsX:CE perl daemon: https://github.com/startersclan/docker-hlstatsxce-daemon | ||
# NOTE: Currently, as of v1.6.19, the daemon crashes upon startup. You will need to fix perl errors and rebuild the image. | ||
# See: https://github.com/startersclan/docker-hlstatsxce-daemon | ||
daemon: | ||
image: startersclan/docker-hlstatsxce-daemon:v1.6.19-geoip-alpine-3.8 | ||
environment: | ||
- LOG_LEVEL=1 | ||
- DB_HOST=127.0.0.1:3306 | ||
- DB_NAME=hlstatsxce | ||
- DB_USER=hlstatsxce | ||
- DB_PASSWORD=hlstatsxce | ||
- DNS_RESOLVE_IP=false | ||
- LISTEN_IP=127.0.0.1 | ||
- LISTEN_PORT=27500 | ||
- RCON=true | ||
network_mode: host | ||
|
||
# 4. The DB for HLStatsX:CE | ||
db: | ||
image: mysql:5.7 | ||
environment: | ||
- MYSQL_ROOT_PASSWORD=someverystrongpassword | ||
- MYSQL_USER=hlstatsxce | ||
- MYSQL_PASSWORD=hlstatsxce | ||
- MYSQL_DATABASE=hlstatsxce | ||
volumes: | ||
- db-volume:/var/lib/mysql | ||
network_mode: host | ||
image: startersclan/hlstatsx-community-edition:1.9.0-daemon | ||
ports: | ||
- 27500:27500/udp # For external servers to send logs to the daemon | ||
networks: | ||
- default | ||
command: | ||
- --ip=0.0.0.0 | ||
- --port=27500 | ||
- --db-host=db:3306 | ||
- --db-name=hlstatsxce | ||
- --db-username=hlstatsxce | ||
- --db-password=hlstatsxce | ||
- --nodns-resolveip | ||
- --debug | ||
# - --debug | ||
# - --help | ||
|
||
# 5. HLStatsX:CE web UI: https://github.com/NomisCZ/hlstatsx-community-edition/ | ||
# Currently, as of the time of writing, there is no docker image. The HLStatsX:CE web frontend must be setup by you. | ||
networks: | ||
default: | ||
|
||
volumes: | ||
dns-volume: | ||
db-volume: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# In this example, you will see that Counter-Strike 2 server sends its HTTP logs to `source-udp-forwarder` which then proxies (forwards) logs to the HLStatsX:CE perl daemon. | ||
version: '2.2' | ||
services: | ||
# 1. Counter-Strike 2 gameserver sends UDP logs to source-udp-forwarder | ||
# See: https://github.com/startersclan/docker-sourceservers | ||
cs2: | ||
image: sourceservers/cs2:latest | ||
volumes: | ||
- dns-volume:/dns:ro | ||
ports: | ||
- 27015:27015/tcp | ||
- 27015:27015/udp | ||
networks: | ||
- default | ||
stdin_open: true | ||
tty: true | ||
stop_signal: SIGKILL | ||
entrypoint: | ||
- /bin/bash | ||
command: | ||
- -c | ||
- | | ||
set -eu | ||
exec game/bin/linuxsteamrt64/cs2 -dedicated -game cs2 -port 27015 +game_type 0 +game_mode 1 +mapgroup mg_active +map de_dust2 +log on +logaddress_add_http "http://$$( cat /dns/source-udp-forwarder ):26999" | ||
# 2. source-udp-forwarder proxy forwards gameserver logs to the daemon | ||
# See: https://github.com/startersclan/source-udp-forwarder | ||
source-udp-forwarder: | ||
image: startersclan/source-udp-forwarder:latest | ||
environment: | ||
- LISTEN_ADDR=:26999 | ||
- UDP_FORWARD_ADDR=daemon:27500 | ||
- FORWARD_PROXY_KEY=somedaemonsecret # The daemon's proxy_key secret | ||
- FORWARD_GAMESERVER_IP=192.168.1.100 # The gameserver's IP as registered in the HLStatsX:CE database | ||
- FORWARD_GAMESERVER_PORT=27015 # The gameserver's IP as registered in the HLStatsX:CE database | ||
- LOG_LEVEL=DEBUG | ||
- LOG_FORMAT=txt | ||
volumes: | ||
- dns-volume:/dns | ||
networks: | ||
- default | ||
depends_on: | ||
- daemon | ||
entrypoint: | ||
- /bin/sh | ||
command: | ||
- -c | ||
- | | ||
set -eu | ||
echo "Outputting my IP address" | ||
ip addr show eth0 | grep 'inet ' | awk '{print $$2}' | cut -d '/' -f1 | tee /dns/source-udp-forwarder | ||
exec /source-udp-forwarder | ||
# 3. HLStatsX:CE perl daemon accepts the gameserver logs. Gameserver Logs are parsed and stats are recorded | ||
# The daemon's proxy_key secret can only be setup in the HLStatsX:CE Web Admin Panel and not via env vars | ||
# See: https://github.com/startersclan/docker-hlstatsxce-daemon | ||
daemon: | ||
image: startersclan/hlstatsx-community-edition:1.9.0-daemon | ||
ports: | ||
- 27500:27500/udp # For external servers to send logs to the daemon | ||
networks: | ||
- default | ||
command: | ||
- --ip=0.0.0.0 | ||
- --port=27500 | ||
- --db-host=db:3306 | ||
- --db-name=hlstatsxce | ||
- --db-username=hlstatsxce | ||
- --db-password=hlstatsxce | ||
- --nodns-resolveip | ||
- --debug | ||
# - --debug | ||
# - --help | ||
|
||
networks: | ||
default: | ||
|
||
volumes: | ||
dns-volume: | ||
db-volume: |
Oops, something went wrong.