-
Notifications
You must be signed in to change notification settings - Fork 3
/
docker-compose.yml
84 lines (77 loc) · 2.75 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# 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
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 +rcon_password password +log on +logaddress_add "$$( 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/hlstatsx-community-edition
daemon:
image: startersclan/hlstatsx-community-edition:1.11.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: