Skip to content

Commit 951ea86

Browse files
committed
chore(docker): 移除硬编码环境变量并添加多个游戏服务实例
移除 social-1 和 social-2 服务中硬编码的 game 服务环境变量,以及 game-1 和 game-2 服务中硬编码的 social 服务环境变量。同时,新增 game-3 到 game-10 共八个游戏服务实例,以支持横向扩展。所有新增实例配置了递增的端口和服务器ID,并依赖 social-1 和 social-2 服务。
1 parent e9c6eba commit 951ea86

1 file changed

Lines changed: 240 additions & 20 deletions

File tree

docker-compose.multi.yml

Lines changed: 240 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@ services:
3535
- "--IsEnableHttp=true"
3636
- "--DataBaseUrl=mongodb://mongo:27017/?authSource=admin"
3737
- "--DataBaseName=gameframex_multi"
38-
environment:
39-
services__game__tcp__0: "tcp://game-1:29100"
40-
services__game__tcp__1: "tcp://game-2:29101"
41-
services__game__http__0: "http://game-1:28080"
42-
services__game__http__1: "http://game-2:28082"
4338
ports:
4439
- "49400:29400"
4540
- "48081:28081"
@@ -66,11 +61,6 @@ services:
6661
- "--IsEnableHttp=true"
6762
- "--DataBaseUrl=mongodb://mongo:27017/?authSource=admin"
6863
- "--DataBaseName=gameframex_multi"
69-
environment:
70-
services__game__tcp__0: "tcp://game-1:29100"
71-
services__game__tcp__1: "tcp://game-2:29101"
72-
services__game__http__0: "http://game-1:28080"
73-
services__game__http__1: "http://game-2:28082"
7464
ports:
7565
- "49401:29401"
7666
- "48083:28083"
@@ -101,11 +91,6 @@ services:
10191
- "--IsEnableHttp=true"
10292
- "--DataBaseUrl=mongodb://mongo:27017/?authSource=admin"
10393
- "--DataBaseName=gameframex_multi"
104-
environment:
105-
services__social__tcp__0: "tcp://social-1:29400"
106-
services__social__tcp__1: "tcp://social-2:29401"
107-
services__social__http__0: "http://social-1:28081"
108-
services__social__http__1: "http://social-2:28083"
10994
ports:
11095
- "49100:29100"
11196
- "48080:28080"
@@ -136,11 +121,6 @@ services:
136121
- "--IsEnableHttp=true"
137122
- "--DataBaseUrl=mongodb://mongo:27017/?authSource=admin"
138123
- "--DataBaseName=gameframex_multi"
139-
environment:
140-
services__social__tcp__0: "tcp://social-1:29400"
141-
services__social__tcp__1: "tcp://social-2:29401"
142-
services__social__http__0: "http://social-1:28081"
143-
services__social__http__1: "http://social-2:28083"
144124
ports:
145125
- "49101:29101"
146126
- "48082:28082"
@@ -150,6 +130,246 @@ services:
150130
networks:
151131
- gameframex-multi
152132

133+
game-3:
134+
image: gameframex/server.launcher:local
135+
depends_on:
136+
mongo:
137+
condition: service_healthy
138+
social-1:
139+
condition: service_started
140+
social-2:
141+
condition: service_started
142+
command:
143+
- "--ServerType=Game"
144+
- "--ServerId=1003"
145+
- "--ServerInstanceId=1003"
146+
- "--InnerHost=0.0.0.0"
147+
- "--InnerPort=29102"
148+
- "--OuterHost=0.0.0.0"
149+
- "--OuterPort=29102"
150+
- "--HttpPort=28084"
151+
- "--IsEnableHttp=true"
152+
- "--DataBaseUrl=mongodb://mongo:27017/?authSource=admin"
153+
- "--DataBaseName=gameframex_multi"
154+
ports:
155+
- "49102:29102"
156+
- "48084:28084"
157+
volumes:
158+
- "./running-multi/game-3/logs:/app/data/logs"
159+
- "./GameFrameX.Config/json:/app/Configs:ro"
160+
networks:
161+
- gameframex-multi
162+
163+
game-4:
164+
image: gameframex/server.launcher:local
165+
depends_on:
166+
mongo:
167+
condition: service_healthy
168+
social-1:
169+
condition: service_started
170+
social-2:
171+
condition: service_started
172+
command:
173+
- "--ServerType=Game"
174+
- "--ServerId=1004"
175+
- "--ServerInstanceId=1004"
176+
- "--InnerHost=0.0.0.0"
177+
- "--InnerPort=29103"
178+
- "--OuterHost=0.0.0.0"
179+
- "--OuterPort=29103"
180+
- "--HttpPort=28086"
181+
- "--IsEnableHttp=true"
182+
- "--DataBaseUrl=mongodb://mongo:27017/?authSource=admin"
183+
- "--DataBaseName=gameframex_multi"
184+
ports:
185+
- "49103:29103"
186+
- "48086:28086"
187+
volumes:
188+
- "./running-multi/game-4/logs:/app/data/logs"
189+
- "./GameFrameX.Config/json:/app/Configs:ro"
190+
networks:
191+
- gameframex-multi
192+
193+
game-5:
194+
image: gameframex/server.launcher:local
195+
depends_on:
196+
mongo:
197+
condition: service_healthy
198+
social-1:
199+
condition: service_started
200+
social-2:
201+
condition: service_started
202+
command:
203+
- "--ServerType=Game"
204+
- "--ServerId=1005"
205+
- "--ServerInstanceId=1005"
206+
- "--InnerHost=0.0.0.0"
207+
- "--InnerPort=29104"
208+
- "--OuterHost=0.0.0.0"
209+
- "--OuterPort=29104"
210+
- "--HttpPort=28088"
211+
- "--IsEnableHttp=true"
212+
- "--DataBaseUrl=mongodb://mongo:27017/?authSource=admin"
213+
- "--DataBaseName=gameframex_multi"
214+
ports:
215+
- "49104:29104"
216+
- "48088:28088"
217+
volumes:
218+
- "./running-multi/game-5/logs:/app/data/logs"
219+
- "./GameFrameX.Config/json:/app/Configs:ro"
220+
networks:
221+
- gameframex-multi
222+
223+
game-6:
224+
image: gameframex/server.launcher:local
225+
depends_on:
226+
mongo:
227+
condition: service_healthy
228+
social-1:
229+
condition: service_started
230+
social-2:
231+
condition: service_started
232+
command:
233+
- "--ServerType=Game"
234+
- "--ServerId=1006"
235+
- "--ServerInstanceId=1006"
236+
- "--InnerHost=0.0.0.0"
237+
- "--InnerPort=29105"
238+
- "--OuterHost=0.0.0.0"
239+
- "--OuterPort=29105"
240+
- "--HttpPort=28090"
241+
- "--IsEnableHttp=true"
242+
- "--DataBaseUrl=mongodb://mongo:27017/?authSource=admin"
243+
- "--DataBaseName=gameframex_multi"
244+
ports:
245+
- "49105:29105"
246+
- "48090:28090"
247+
volumes:
248+
- "./running-multi/game-6/logs:/app/data/logs"
249+
- "./GameFrameX.Config/json:/app/Configs:ro"
250+
networks:
251+
- gameframex-multi
252+
253+
game-7:
254+
image: gameframex/server.launcher:local
255+
depends_on:
256+
mongo:
257+
condition: service_healthy
258+
social-1:
259+
condition: service_started
260+
social-2:
261+
condition: service_started
262+
command:
263+
- "--ServerType=Game"
264+
- "--ServerId=1007"
265+
- "--ServerInstanceId=1007"
266+
- "--InnerHost=0.0.0.0"
267+
- "--InnerPort=29106"
268+
- "--OuterHost=0.0.0.0"
269+
- "--OuterPort=29106"
270+
- "--HttpPort=28092"
271+
- "--IsEnableHttp=true"
272+
- "--DataBaseUrl=mongodb://mongo:27017/?authSource=admin"
273+
- "--DataBaseName=gameframex_multi"
274+
ports:
275+
- "49106:29106"
276+
- "48092:28092"
277+
volumes:
278+
- "./running-multi/game-7/logs:/app/data/logs"
279+
- "./GameFrameX.Config/json:/app/Configs:ro"
280+
networks:
281+
- gameframex-multi
282+
283+
game-8:
284+
image: gameframex/server.launcher:local
285+
depends_on:
286+
mongo:
287+
condition: service_healthy
288+
social-1:
289+
condition: service_started
290+
social-2:
291+
condition: service_started
292+
command:
293+
- "--ServerType=Game"
294+
- "--ServerId=1008"
295+
- "--ServerInstanceId=1008"
296+
- "--InnerHost=0.0.0.0"
297+
- "--InnerPort=29107"
298+
- "--OuterHost=0.0.0.0"
299+
- "--OuterPort=29107"
300+
- "--HttpPort=28094"
301+
- "--IsEnableHttp=true"
302+
- "--DataBaseUrl=mongodb://mongo:27017/?authSource=admin"
303+
- "--DataBaseName=gameframex_multi"
304+
ports:
305+
- "49107:29107"
306+
- "48094:28094"
307+
volumes:
308+
- "./running-multi/game-8/logs:/app/data/logs"
309+
- "./GameFrameX.Config/json:/app/Configs:ro"
310+
networks:
311+
- gameframex-multi
312+
313+
game-9:
314+
image: gameframex/server.launcher:local
315+
depends_on:
316+
mongo:
317+
condition: service_healthy
318+
social-1:
319+
condition: service_started
320+
social-2:
321+
condition: service_started
322+
command:
323+
- "--ServerType=Game"
324+
- "--ServerId=1009"
325+
- "--ServerInstanceId=1009"
326+
- "--InnerHost=0.0.0.0"
327+
- "--InnerPort=29108"
328+
- "--OuterHost=0.0.0.0"
329+
- "--OuterPort=29108"
330+
- "--HttpPort=28096"
331+
- "--IsEnableHttp=true"
332+
- "--DataBaseUrl=mongodb://mongo:27017/?authSource=admin"
333+
- "--DataBaseName=gameframex_multi"
334+
ports:
335+
- "49108:29108"
336+
- "48096:28096"
337+
volumes:
338+
- "./running-multi/game-9/logs:/app/data/logs"
339+
- "./GameFrameX.Config/json:/app/Configs:ro"
340+
networks:
341+
- gameframex-multi
342+
343+
game-10:
344+
image: gameframex/server.launcher:local
345+
depends_on:
346+
mongo:
347+
condition: service_healthy
348+
social-1:
349+
condition: service_started
350+
social-2:
351+
condition: service_started
352+
command:
353+
- "--ServerType=Game"
354+
- "--ServerId=1010"
355+
- "--ServerInstanceId=1010"
356+
- "--InnerHost=0.0.0.0"
357+
- "--InnerPort=29109"
358+
- "--OuterHost=0.0.0.0"
359+
- "--OuterPort=29109"
360+
- "--HttpPort=28098"
361+
- "--IsEnableHttp=true"
362+
- "--DataBaseUrl=mongodb://mongo:27017/?authSource=admin"
363+
- "--DataBaseName=gameframex_multi"
364+
ports:
365+
- "49109:29109"
366+
- "48098:28098"
367+
volumes:
368+
- "./running-multi/game-10/logs:/app/data/logs"
369+
- "./GameFrameX.Config/json:/app/Configs:ro"
370+
networks:
371+
- gameframex-multi
372+
153373
networks:
154374
gameframex-multi:
155375
driver: bridge

0 commit comments

Comments
 (0)