-
Notifications
You must be signed in to change notification settings - Fork 3
/
docker-compose.yml
85 lines (79 loc) · 2.8 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
84
85
# In this example, you will see that Half-Life 2 Multiplayer 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 Source games (https://developer.valvesoftware.com/wiki/Source), such as Counter-Strike Global Offensive and Left 4 Dead 2
version: '2.2'
services:
# 1. Half-Life 2 Multiplayer gameserver sends UDP logs to source-udp-forwarder
# See: https://github.com/startersclan/docker-sourceservers
hl2mp:
image: sourceservers/hl2mp:latest
volumes:
- dns-volume:/dns:ro
ports:
- 27015:27015/tcp
- 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
# srcds cannot log to 127.0.0.1 for some reason, but 0.0.0.0 works
exec srcds_linux -game hl2mp -port 27015 +map dm_lockdown +sv_lan 0 +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: