forked from ReviveNetwork/ASP
-
Notifications
You must be signed in to change notification settings - Fork 5
/
docker-compose.yml
168 lines (159 loc) · 5.82 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
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:
- 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
# 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
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=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
volumes:
- ./src/ASP:/src/ASP
- 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
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
db:
image: mariadb:10.8
environment:
- MARIADB_ROOT_PASSWORD=ascent
# - MARIADB_USER=admin # Uncomment this if you want to create a regular user
# - MARIADB_PASSWORD=admin # Uncomment this if you want to create a regular user
- MARIADB_DATABASE=bf2stats
volumes:
- ./src/ASP/system/sql/schema.sql:/docker-entrypoint-initdb.d/01-schema.sql:ro # Seed the DB the first time
- ./src/ASP/system/sql/data.sql:/docker-entrypoint-initdb.d/02-data.sql:ro # Seed the DB the first time
- ./config/db/setup.sql:/docker-entrypoint-initdb.d/03-setup.sql:ro # Setup the DB the first time
- ./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:
cache-volume:
config-volume:
logs-volume:
snapshots-volume:
db-volume: