forked from wilson212/bf2stats
-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
205 lines (195 loc) · 6.88 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
version: '2.2'
services:
# Battlefield 2 1.5 server with the bf2stats python scripts
bf2:
image: startersclan/docker-bf2:v1.5.3153.0
volumes:
- ./config/bf2/mods/bf2/ai/aidefault-custom.ai:/server/bf2/mods/bf2/ai/aidefault.ai:ro # Customize bots
- ./config/bf2/mods/bf2/settings/serversettings-custom.con:/server/bf2/mods/bf2/settings/serversettings.con:ro # Server config
- ./config/bf2/mods/bf2/settings/maplist-custom-coop.con:/server/bf2/mods/bf2/settings/maplist.con:ro # Maplist (coop)
# - ./config/bf2/mods/bf2/settings/maplist-custom-cq.con:/server/bf2/mods/bf2/settings/maplist.con:ro # Maplist (cq)
- ./src/python:/server/bf2/python # Mount the python files
- ./config/bf2/python/bf2/BF2StatisticsConfig-custom.py:/server/bf2/python/bf2/BF2StatisticsConfig.py:ro # bf2stats python config
ports:
- 16567:16567/udp
- 29900:29900/udp
networks:
- bf2-network
- gamespy-network
depends_on:
- asp
tty: true
stdin_open: true
# The Gamespy master server
prmasterserver:
image: startersclan/prmasterserver:v0.1.0
volumes:
- prmasterserver-volume:/data
ports:
- 29900:29900/tcp # Login server
- 29901:29901/tcp # Login server
- 28910:28910/tcp # Master server
- 27900:27900/udp # Master server
- 29910:29910/udp # CD key server
networks:
# Spoof all gamespy DNS for the BF2 server connected to this network
gamespy-network:
aliases:
- battlefield2.available.gamespy.com
- battlefield2.master.gamespy.com
- battlefield2.ms14.gamespy.com
- master.gamespy.com
- motd.gamespy.com
- gpsp.gamespy.com
- gpcm.gamespy.com
- gamespy.com
# The reverse proxy for our web containers
# This is needed only for the BF2 client BFHQ to work properly (i.e. access the ASP via http://bf2web.gamespy.com)
traefik:
image: traefik:v2.7
volumes:
# Allow traefik to listen to the Docker events
- /var/run/docker.sock:/var/run/docker.sock:ro
ports:
- 80:80
networks:
- traefik-public-network
- traefik-network
restart: unless-stopped
command:
- --global.checknewversion=false
- --global.sendanonymoususage=false
# - --log.level=DEBUG
- --providers.docker=true
- --providers.docker.exposedbydefault=false
- --entrypoints.web.address=:80
init-container:
image: alpine:latest
volumes:
- ./src:/src
- db-volume:/var/lib/mysql
entrypoint:
- /bin/sh
command:
- -c
- |
set -eu
echo "Granting db write permissions"
chown -R 999:999 /var/lib/mysql
asp:
build:
dockerfile: Dockerfile.asp
context: .
target: dev
labels:
- "traefik.enable=true"
- "traefik.docker.network=${COMPOSE_PROJECT_NAME?err}_traefik-network"
# traefik v2
# http
- "traefik.http.routers.${COMPOSE_PROJECT_NAME?err}-asp-gamespy-http.entrypoints=web"
- "traefik.http.routers.${COMPOSE_PROJECT_NAME?err}-asp-gamespy-http.rule=Host(`bf2web.gamespy.com`)" # Note: `bf2web.gamespy.com` doesn't need https. The BF2 client BFHQ makes a HTTP requests to `bf2web.gamespy.com` with `Host: bf2web.gamespy.com`.
environment:
# - XDEBUG_MODE=off # Uncomment to disable xdebug
# See ./src/ASP/system/config/config.php for all supported env vars. Use comma-delimited value for array
- DB_HOST=db
- DB_PORT=3306
- DB_NAME=bf2stats
- DB_USER=admin
- DB_PASS=admin
- ADMIN_HOSTS=127.0.0.1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16 # Limit admins to private IPs
- GAME_HOSTS=127.0.0.1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16 # Limit gameservers to private IPs
# - BFHQ_HIDE_BOTS=false
# - BFHQ_HIDE_COUNTRY=false
# - BFHQ_HIDE_HIDDEN_PLAYERS=false
# - BFHQ_HIDE_PIDS_START=1
# - BFHQ_HIDE_PIDS_END=999999999
# - BFHQ_PIDS_AS_NAMES=false
- DEBUG_LVL=2
volumes:
- ./src/ASP:/src/ASP
- backups-volume:/src/ASP/system/database/backups # This volume is effectively unused since ASP doesn't allow DB backups for a remote DB, but mount it anyway to avoid errors.
- config-volume:/src/ASP/system/config # For a stateful config file
- logs-volume:/src/ASP/system/logs
- snapshots-volume:/src/ASP/system/snapshots
ports:
- 8081:80
- 9000
networks:
traefik-network:
bf2-network:
aliases:
- bf2web.gamespy.com # Spoof gamespy DNS for the BF2 server connected to this network
extra_hosts:
# For xdebug to reach the host via `host.docker.internal`. See: https://github.com/moby/moby/pull/40007#issuecomment-578729356 and https://stackoverflow.com/questions/49907308/installing-xdebug-in-docker
# If xdebug does not work, you may need to add an iptables rule to the INPUT chain: iptables -A INPUT -i br+ -j ACCEPT
- host.docker.internal:host-gateway
bf2sclone:
build:
dockerfile: Dockerfile.bf2sclone
context: .
target: dev
volumes:
- ./src/bf2sclone:/src/bf2sclone
- bf2sclone-cache-volume:/src/bf2sclone/cache
environment:
# - XDEBUG_MODE=off # Uncomment to disable xdebug
# See ./src/bf2sclone/config.inc.php for all supported env vars
- DBIP=db
- DBNAME=bf2stats
- DBLOGIN=admin
- DBPASSWORD=admin
# - TITLE=BF2S Clone
# - FOOTER_PAGELOADSPEED_ENABLE=false
- RANKING_REFRESH_TIME=0
# - RANKING_HIDE_BOTS=false
# - RANKING_HIDE_COUNTRY=false
# - RANKING_HIDE_HIDDEN_PLAYERS=false
# - RANKING_HIDE_PIDS_START=1
# - RANKING_HIDE_PIDS_END=999999999
# - LEADERBOARD_COUNT=25
ports:
- 8082:80
- 9000
networks:
- traefik-network
- bf2-network
extra_hosts:
# For xdebug to reach the host via `host.docker.internal`. See: https://github.com/moby/moby/pull/40007#issuecomment-578729356 and https://stackoverflow.com/questions/49907308/installing-xdebug-in-docker
# If xdebug does not work, you may need to add an iptables rule to the INPUT chain: iptables -A INPUT -i br+ -j ACCEPT
- host.docker.internal:host-gateway
db:
image: mariadb:10.8
environment:
- MARIADB_ROOT_PASSWORD=admin
- MARIADB_USER=admin
- MARIADB_PASSWORD=admin
- MARIADB_DATABASE=bf2stats
volumes:
- ./config/db/my.cnf:/etc/my.cnf:ro
- db-volume:/var/lib/mysql
networks:
- bf2-network
depends_on:
- init-container
phpmyadmin:
image: phpmyadmin:5.2
environment:
- PMA_HOST=db
ports:
- 8083:80
networks:
- bf2-network
networks:
gamespy-network:
bf2-network:
traefik-public-network:
traefik-network:
internal: true
volumes:
prmasterserver-volume:
backups-volume:
config-volume:
logs-volume:
snapshots-volume:
bf2sclone-cache-volume:
db-volume: