forked from ReviveNetwork/ASP
-
Notifications
You must be signed in to change notification settings - Fork 5
/
docker-compose.yml
230 lines (220 loc) · 8.99 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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
version: '2.2'
services:
# Battlefield 2 1.5 server with bf2stats 3 python scripts
bf2:
image: startersclan/docker-bf2:v1.5.3153.0-bf2stats-3.3.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/python/bf2/BF2StatisticsConfig-custom.py:/server/bf2/python/bf2/BF2StatisticsConfig.py:ro # bf2stats python config
ports:
- 16567:16567/udp
- 29900:29900/udp
networks:
- gamespy-network
- bf2-network
depends_on:
- asp
restart: unless-stopped
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
restart: unless-stopped
# A DNS server to spoof gamespy's DNS records for BF2 clients or servers
# Tips:
# Clients should only use trusted DNS servers. This should only be used in a private network.
# If there is a port conflict, the OS might already have a DNS server running on localhost, e.g. systemd-resolved or docker dns
# To get around that, bind to your external interface's IP. For example:
# ports:
# - 192.168.1.100:53:53/udp
# Test DNS records to ensure coredns responds with your machine's external IP address. For example:
# nslookup bf2web.gamespy.com 192.168.1.100
# Response should be:
# Server: 192.168.1.100
# Address: 192.168.1.100#53
#
# Name: bf2web.gamespy.com
# Address: 192.168.1.100
# Then configure BF2 client machines to use this machine's external IP as their primary DNS server.
coredns:
image: coredns/coredns:1.9.3
ports:
- 53:53/udp
volumes:
- ./config/coredns/Corefile:/Corefile:ro
- ./config/coredns/hosts:/hosts:ro
networks:
- bf2-network
restart: unless-stopped
entrypoint:
- /coredns
- -conf
- /Corefile
# The reverse proxy for our web containers
# See https://github.com/traefik/traefik/tree/v2.7/docs/content/user-guides/docker-compose for some examples for enabling HTTPS using ACME
# You will need a domain name. E.g. 'example.com'
traefik:
image: traefik:v2.7
volumes:
# Allow traefik to listen to the Docker events
- /var/run/docker.sock:/var/run/docker.sock:ro
- traefik-acme-volume:/letsencrypt
ports:
- 80:80
- 443:443
# - 8080:8080 # Uncomment to view traefik dashboard on port 8080
networks:
- traefik-public-network
- traefik-network
restart: unless-stopped
command:
- --global.checknewversion=false
- --global.sendanonymoususage=false
# - --api.insecure # Uncomment to view traefik dashboard on port 8080
# - --log.level=DEBUG
- --providers.docker=true
- --providers.docker.exposedbydefault=false
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
- --certificatesresolvers.myresolver.acme.dnschallenge=true
- --certificatesresolvers.myresolver.acme.dnschallenge.provider=ovh
# - --certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory
- --certificatesresolvers.myresolver.acme.email=postmaster@example.com
- --certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json
# The init container that sets up permissions
init-container:
image: alpine:latest
volumes:
- db-volume:/var/lib/mysql
entrypoint:
- /bin/sh
command:
- -c
- |
set -eu
echo "Granting db write permissions"
chown -R 999:999 /var/lib/mysql
# The gamespy ASP. The dashboard is available at https://asp.example.com/ASP
asp:
image: startersclan/asp:3.3.0
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, and the BF2 server python files, make a HTTP requests to `bf2web.gamespy.com` with `Host: bf2web.gamespy.com`.
# http
- "traefik.http.routers.${COMPOSE_PROJECT_NAME?err}-asp-http.entrypoints=web"
- "traefik.http.routers.${COMPOSE_PROJECT_NAME?err}-asp-http.rule=Host(`asp.example.com`)"
- "traefik.http.routers.${COMPOSE_PROJECT_NAME?err}-asp-http.middlewares=${COMPOSE_PROJECT_NAME?err}-asp-http-myRedirectScheme" # Redirect http to https
- "traefik.http.middlewares.${COMPOSE_PROJECT_NAME?err}-asp-http-myRedirectScheme.redirectScheme.scheme=https" # Redirect http to https
# https
- "traefik.http.routers.${COMPOSE_PROJECT_NAME?err}-asp.entrypoints=websecure"
- "traefik.http.routers.${COMPOSE_PROJECT_NAME?err}-asp.tls="
- "traefik.http.routers.${COMPOSE_PROJECT_NAME?err}-asp.rule=Host(`asp.example.com`)"
- "traefik.http.services.${COMPOSE_PROJECT_NAME?err}-asp.loadbalancer.server.port=80"
environment:
# 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=root
- DB_PASS=ascent
- 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
- DEBUG_LVL=4
# ports:
# - 8081:80
volumes:
- backups-volume:/src/ASP/system/backups # This volume is effectively unused since ASP doesn't allow DB backups for a remote DB, but mount it anyway to avoid errors.
- cache-volume:/src/ASP/system/cache
- config-volume:/src/ASP/system/config # For a stateful config file
- logs-volume:/src/ASP/system/logs
- snapshots-volume:/src/ASP/system/snapshots
networks:
traefik-network:
bf2-network:
aliases:
- bf2web.gamespy.com # Spoof gamespy DNS for the BF2 server connected to this network
restart: unless-stopped
# The DB container
db:
image: mariadb:10.8
environment:
- MARIADB_ROOT_PASSWORD=ascent
- MARIADB_USER=admin
- MARIADB_PASSWORD=admin
- MARIADB_DATABASE=bf2stats
volumes:
- ./config/db/my.cnf:/etc/my.cnf:ro # Config file. Customize as needed
- db-volume:/var/lib/mysql
networks:
- bf2-network
depends_on:
- init-container
restart: unless-stopped
# The phpmyadmin interface for administrating the DB. It is available at https://phpmyadmin.example.com
phpmyadmin:
image: phpmyadmin:5.2
labels:
- "traefik.enable=true"
- "traefik.docker.network=${COMPOSE_PROJECT_NAME?err}_traefik-network"
# traefik v2
# http
- "traefik.http.routers.${COMPOSE_PROJECT_NAME?err}-phpmyadmin-http.entrypoints=web"
- "traefik.http.routers.${COMPOSE_PROJECT_NAME?err}-phpmyadmin-http.rule=Host(`phpmyadmin.example.com`)"
- "traefik.http.routers.${COMPOSE_PROJECT_NAME?err}-phpmyadmin-http.middlewares=${COMPOSE_PROJECT_NAME?err}-phpmyadmin-http-myRedirectScheme" # Redirect http to https
- "traefik.http.middlewares.${COMPOSE_PROJECT_NAME?err}-phpmyadmin-http-myRedirectScheme.redirectScheme.scheme=https" # Redirect http to https
# https
- "traefik.http.routers.${COMPOSE_PROJECT_NAME?err}-phpmyadmin.entrypoints=websecure"
- "traefik.http.routers.${COMPOSE_PROJECT_NAME?err}-phpmyadmin.tls="
- "traefik.http.routers.${COMPOSE_PROJECT_NAME?err}-phpmyadmin.rule=Host(`phpmyadmin.example.com`)"
- "traefik.http.services.${COMPOSE_PROJECT_NAME?err}-phpmyadmin.loadbalancer.server.port=80"
environment:
- PMA_ABSOLUTE_URI=https://phpmyadmin.example.com # Enable this if behind a reverse proxy
- PMA_HOST=db
# ports:
# - 8083:80
networks:
- traefik-network
- bf2-network
restart: unless-stopped
networks:
gamespy-network:
bf2-network:
traefik-public-network:
traefik-network:
internal: true
volumes:
prmasterserver-volume:
traefik-acme-volume:
backups-volume:
cache-volume:
config-volume:
logs-volume:
snapshots-volume:
bf2sclone-cache-volume:
db-volume: