@babylonjs-toolkit/server 0.0.0-stage → 9.35.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. package/CUSTOM.md +1690 -0
  2. package/DEPLOY.md +2012 -0
  3. package/README.md +1081 -2
  4. package/lib/AbuseLimits.d.ts +64 -0
  5. package/lib/AbuseLimits.js +121 -0
  6. package/lib/Authentication.d.ts +86 -0
  7. package/lib/Authentication.js +272 -0
  8. package/lib/BootSessionOwner.d.ts +86 -0
  9. package/lib/BootSessionOwner.js +116 -0
  10. package/lib/ColyseusLoggerAdapter.d.ts +32 -0
  11. package/lib/ColyseusLoggerAdapter.js +73 -0
  12. package/lib/DedicatedSceneRegistry.d.ts +52 -0
  13. package/lib/DedicatedSceneRegistry.js +74 -0
  14. package/lib/DedicatedSession.d.ts +152 -0
  15. package/lib/DedicatedSession.js +173 -0
  16. package/lib/DualTransport.d.ts +112 -0
  17. package/lib/DualTransport.js +197 -0
  18. package/lib/GameServer.d.ts +64 -0
  19. package/lib/GameServer.js +647 -0
  20. package/lib/GameServerConfig.d.ts +387 -0
  21. package/lib/GameServerConfig.js +1059 -0
  22. package/lib/GameServerLobbyRoom.d.ts +33 -0
  23. package/lib/GameServerLobbyRoom.js +56 -0
  24. package/lib/GameServerLogger.d.ts +111 -0
  25. package/lib/GameServerLogger.js +190 -0
  26. package/lib/GameServerMetrics.d.ts +158 -0
  27. package/lib/GameServerMetrics.js +276 -0
  28. package/lib/GameServerState.d.ts +164 -0
  29. package/lib/GameServerState.js +26 -0
  30. package/lib/HeadlessRuntime.d.ts +316 -0
  31. package/lib/HeadlessRuntime.js +380 -0
  32. package/lib/JoinGate.d.ts +34 -0
  33. package/lib/JoinGate.js +221 -0
  34. package/lib/NetworkAddresses.d.ts +33 -0
  35. package/lib/NetworkAddresses.js +90 -0
  36. package/lib/PlayerTokens.d.ts +17 -0
  37. package/lib/PlayerTokens.js +24 -0
  38. package/lib/RoomServerTransport.d.ts +73 -0
  39. package/lib/RoomServerTransport.js +90 -0
  40. package/lib/ServerEndpoints.d.ts +133 -0
  41. package/lib/ServerEndpoints.js +247 -0
  42. package/lib/ServerInit.d.ts +28 -0
  43. package/lib/ServerInit.js +113 -0
  44. package/lib/SessionRoom.d.ts +391 -0
  45. package/lib/SessionRoom.js +930 -0
  46. package/lib/TlsCertificates.d.ts +35 -0
  47. package/lib/TlsCertificates.js +130 -0
  48. package/lib/admin/AccountRoutes.d.ts +8 -0
  49. package/lib/admin/AccountRoutes.js +502 -0
  50. package/lib/admin/AdminAccounts.d.ts +329 -0
  51. package/lib/admin/AdminAccounts.js +607 -0
  52. package/lib/admin/AdminApiRouter.d.ts +202 -0
  53. package/lib/admin/AdminApiRouter.js +465 -0
  54. package/lib/admin/AdminApiTypes.d.ts +1782 -0
  55. package/lib/admin/AdminApiTypes.js +4 -0
  56. package/lib/admin/AdminAudit.d.ts +113 -0
  57. package/lib/admin/AdminAudit.js +266 -0
  58. package/lib/admin/AdminCli.d.ts +7 -0
  59. package/lib/admin/AdminCli.js +351 -0
  60. package/lib/admin/AdminClock.d.ts +51 -0
  61. package/lib/admin/AdminClock.js +10 -0
  62. package/lib/admin/AdminConsole.d.ts +39 -0
  63. package/lib/admin/AdminConsole.js +325 -0
  64. package/lib/admin/AdminConstants.d.ts +147 -0
  65. package/lib/admin/AdminConstants.js +167 -0
  66. package/lib/admin/AdminCrypto.d.ts +19 -0
  67. package/lib/admin/AdminCrypto.js +29 -0
  68. package/lib/admin/AdminExtensionsHost.d.ts +176 -0
  69. package/lib/admin/AdminExtensionsHost.js +307 -0
  70. package/lib/admin/AdminPasswords.d.ts +33 -0
  71. package/lib/admin/AdminPasswords.js +92 -0
  72. package/lib/admin/AdminPermissions.d.ts +28 -0
  73. package/lib/admin/AdminPermissions.js +74 -0
  74. package/lib/admin/AdminRecords.d.ts +196 -0
  75. package/lib/admin/AdminRecords.js +3 -0
  76. package/lib/admin/AdminRequestBodies.d.ts +47 -0
  77. package/lib/admin/AdminRequestBodies.js +84 -0
  78. package/lib/admin/AdminRequestGate.d.ts +38 -0
  79. package/lib/admin/AdminRequestGate.js +59 -0
  80. package/lib/admin/AdminResponses.d.ts +103 -0
  81. package/lib/admin/AdminResponses.js +164 -0
  82. package/lib/admin/AdminServices.d.ts +99 -0
  83. package/lib/admin/AdminServices.js +4 -0
  84. package/lib/admin/AdminStaticFiles.d.ts +29 -0
  85. package/lib/admin/AdminStaticFiles.js +97 -0
  86. package/lib/admin/AdminStore.d.ts +152 -0
  87. package/lib/admin/AdminStore.js +46 -0
  88. package/lib/admin/AlertChannels.d.ts +43 -0
  89. package/lib/admin/AlertChannels.js +120 -0
  90. package/lib/admin/AlertEngine.d.ts +231 -0
  91. package/lib/admin/AlertEngine.js +681 -0
  92. package/lib/admin/AlertRoutes.d.ts +8 -0
  93. package/lib/admin/AlertRoutes.js +180 -0
  94. package/lib/admin/ApiKeyRoutes.d.ts +8 -0
  95. package/lib/admin/ApiKeyRoutes.js +53 -0
  96. package/lib/admin/ApiKeys.d.ts +63 -0
  97. package/lib/admin/ApiKeys.js +167 -0
  98. package/lib/admin/AuditRoutes.d.ts +8 -0
  99. package/lib/admin/AuditRoutes.js +106 -0
  100. package/lib/admin/AuthToolRoutes.d.ts +13 -0
  101. package/lib/admin/AuthToolRoutes.js +164 -0
  102. package/lib/admin/BanList.d.ts +87 -0
  103. package/lib/admin/BanList.js +152 -0
  104. package/lib/admin/CborDecoder.d.ts +18 -0
  105. package/lib/admin/CborDecoder.js +201 -0
  106. package/lib/admin/ColyseusCloudClient.d.ts +313 -0
  107. package/lib/admin/ColyseusCloudClient.js +272 -0
  108. package/lib/admin/ColyseusCloudRoutes.d.ts +8 -0
  109. package/lib/admin/ColyseusCloudRoutes.js +91 -0
  110. package/lib/admin/ColyseusCloudService.d.ts +180 -0
  111. package/lib/admin/ColyseusCloudService.js +476 -0
  112. package/lib/admin/ColyseusCloudSettings.d.ts +16 -0
  113. package/lib/admin/ColyseusCloudSettings.js +29 -0
  114. package/lib/admin/ColyseusCloudViews.d.ts +105 -0
  115. package/lib/admin/ColyseusCloudViews.js +371 -0
  116. package/lib/admin/CommonPasswords.d.ts +6 -0
  117. package/lib/admin/CommonPasswords.js +19 -0
  118. package/lib/admin/ConfigOverrides.d.ts +174 -0
  119. package/lib/admin/ConfigOverrides.js +406 -0
  120. package/lib/admin/ConfigRoutes.d.ts +8 -0
  121. package/lib/admin/ConfigRoutes.js +91 -0
  122. package/lib/admin/ConsoleSessions.d.ts +112 -0
  123. package/lib/admin/ConsoleSessions.js +201 -0
  124. package/lib/admin/DedicatedRoutes.d.ts +21 -0
  125. package/lib/admin/DedicatedRoutes.js +254 -0
  126. package/lib/admin/ExtensionRoutes.d.ts +8 -0
  127. package/lib/admin/ExtensionRoutes.js +145 -0
  128. package/lib/admin/FileAdminStore.d.ts +157 -0
  129. package/lib/admin/FileAdminStore.js +349 -0
  130. package/lib/admin/FleetDirectory.d.ts +323 -0
  131. package/lib/admin/FleetDirectory.js +489 -0
  132. package/lib/admin/FleetLeader.d.ts +43 -0
  133. package/lib/admin/FleetLeader.js +89 -0
  134. package/lib/admin/FleetRoutes.d.ts +55 -0
  135. package/lib/admin/FleetRoutes.js +465 -0
  136. package/lib/admin/HealthWarnings.d.ts +10 -0
  137. package/lib/admin/HealthWarnings.js +95 -0
  138. package/lib/admin/LeaderboardRoutes.d.ts +8 -0
  139. package/lib/admin/LeaderboardRoutes.js +569 -0
  140. package/lib/admin/LogBuffer.d.ts +60 -0
  141. package/lib/admin/LogBuffer.js +92 -0
  142. package/lib/admin/LogRedaction.d.ts +15 -0
  143. package/lib/admin/LogRedaction.js +72 -0
  144. package/lib/admin/LogRoutes.d.ts +45 -0
  145. package/lib/admin/LogRoutes.js +307 -0
  146. package/lib/admin/MaintenanceMode.d.ts +41 -0
  147. package/lib/admin/MaintenanceMode.js +74 -0
  148. package/lib/admin/MaintenanceWindows.d.ts +91 -0
  149. package/lib/admin/MaintenanceWindows.js +207 -0
  150. package/lib/admin/MetricsRoutes.d.ts +8 -0
  151. package/lib/admin/MetricsRoutes.js +209 -0
  152. package/lib/admin/MetricsSampler.d.ts +124 -0
  153. package/lib/admin/MetricsSampler.js +211 -0
  154. package/lib/admin/OneTimeCodes.d.ts +60 -0
  155. package/lib/admin/OneTimeCodes.js +162 -0
  156. package/lib/admin/OpenIdConnect.d.ts +146 -0
  157. package/lib/admin/OpenIdConnect.js +335 -0
  158. package/lib/admin/Passkeys.d.ts +130 -0
  159. package/lib/admin/Passkeys.js +432 -0
  160. package/lib/admin/PlayerRoutes.d.ts +20 -0
  161. package/lib/admin/PlayerRoutes.js +676 -0
  162. package/lib/admin/RedisAdminStore.d.ts +114 -0
  163. package/lib/admin/RedisAdminStore.js +258 -0
  164. package/lib/admin/RolloutCoordinator.d.ts +99 -0
  165. package/lib/admin/RolloutCoordinator.js +321 -0
  166. package/lib/admin/ServerEvents.d.ts +57 -0
  167. package/lib/admin/ServerEvents.js +89 -0
  168. package/lib/admin/SessionRoutes.d.ts +113 -0
  169. package/lib/admin/SessionRoutes.js +386 -0
  170. package/lib/admin/UserRoutes.d.ts +8 -0
  171. package/lib/admin/UserRoutes.js +214 -0
  172. package/lib/cli.d.ts +2 -0
  173. package/lib/cli.js +221 -0
  174. package/lib/console/assets/index-CI5N7c-T.js +21 -0
  175. package/lib/console/assets/index-DPitvzLp.css +1 -0
  176. package/lib/console/favicon.svg +1 -0
  177. package/lib/console/index.html +16 -0
  178. package/lib/discord/DiscordOAuth.d.ts +57 -0
  179. package/lib/discord/DiscordOAuth.js +127 -0
  180. package/lib/discord/DiscordSessions.d.ts +79 -0
  181. package/lib/discord/DiscordSessions.js +135 -0
  182. package/lib/discord/DiscordSignInConstants.d.ts +54 -0
  183. package/lib/discord/DiscordSignInConstants.js +55 -0
  184. package/lib/discord/DiscordSignInRoutes.d.ts +51 -0
  185. package/lib/discord/DiscordSignInRoutes.js +359 -0
  186. package/lib/index.d.ts +24 -0
  187. package/lib/index.js +18 -0
  188. package/lib/leaderboards/FileLeaderboardRankStore.d.ts +293 -0
  189. package/lib/leaderboards/FileLeaderboardRankStore.js +808 -0
  190. package/lib/leaderboards/LeaderboardConstants.d.ts +63 -0
  191. package/lib/leaderboards/LeaderboardConstants.js +70 -0
  192. package/lib/leaderboards/LeaderboardError.d.ts +15 -0
  193. package/lib/leaderboards/LeaderboardError.js +20 -0
  194. package/lib/leaderboards/LeaderboardIdentity.d.ts +44 -0
  195. package/lib/leaderboards/LeaderboardIdentity.js +72 -0
  196. package/lib/leaderboards/LeaderboardPublicApi.d.ts +17 -0
  197. package/lib/leaderboards/LeaderboardPublicApi.js +389 -0
  198. package/lib/leaderboards/LeaderboardRankStore.d.ts +296 -0
  199. package/lib/leaderboards/LeaderboardRankStore.js +18 -0
  200. package/lib/leaderboards/LeaderboardRules.d.ts +122 -0
  201. package/lib/leaderboards/LeaderboardRules.js +472 -0
  202. package/lib/leaderboards/LeaderboardScheduler.d.ts +43 -0
  203. package/lib/leaderboards/LeaderboardScheduler.js +103 -0
  204. package/lib/leaderboards/LeaderboardService.d.ts +669 -0
  205. package/lib/leaderboards/LeaderboardService.js +1667 -0
  206. package/lib/leaderboards/LeaderboardTransfer.d.ts +35 -0
  207. package/lib/leaderboards/LeaderboardTransfer.js +580 -0
  208. package/lib/leaderboards/RedisLeaderboardRankStore.d.ts +282 -0
  209. package/lib/leaderboards/RedisLeaderboardRankStore.js +691 -0
  210. package/package.json +64 -4
  211. package/templates/init/Caddyfile +6 -0
  212. package/templates/init/DEPLOY.md +233 -0
  213. package/templates/init/Dockerfile +12 -0
  214. package/templates/init/app.json +21 -0
  215. package/templates/init/aws/README.md +118 -0
  216. package/templates/init/aws/ecs-fargate-alb.yml +207 -0
  217. package/templates/init/aws/ecs-fargate-nlb-quic.yml +210 -0
  218. package/templates/init/babylon-game-server.config.mjs +158 -0
  219. package/templates/init/colyseus-cloud/README.md +133 -0
  220. package/templates/init/colyseus-cloud/babylon-game-server.config.mjs +36 -0
  221. package/templates/init/colyseus-cloud/ecosystem.config.cjs +35 -0
  222. package/templates/init/colyseus-cloud/gitignore +6 -0
  223. package/templates/init/colyseus-cloud/package.json +15 -0
  224. package/templates/init/digitalocean-app.yaml +30 -0
  225. package/templates/init/docker-compose.full.yml +45 -0
  226. package/templates/init/docker-compose.websocket.yml +41 -0
  227. package/templates/init/fly.toml +56 -0
  228. package/templates/init/heroku.yml +11 -0
  229. package/templates/init/kubernetes/deployment.yaml +71 -0
  230. package/templates/init/kubernetes/redis.yaml +73 -0
  231. package/templates/init/kubernetes/service.yaml +24 -0
  232. package/templates/init/monitoring/grafana-dashboard.json +539 -0
  233. package/templates/init/monitoring/prometheus-alerts.yml +51 -0
  234. package/templates/init/monitoring/prometheus-scrape.yml +17 -0
  235. package/templates/init/railway.json +13 -0
  236. package/templates/init/render.yaml +19 -0
@@ -0,0 +1,210 @@
1
+ # TLS: server (the game server terminates TLS with a PEM certificate from Secrets Manager; the NLB passes QUIC through)
2
+ # UDP: supported (a Network Load Balancer TCP_QUIC listener carries WSS over TCP and HTTP/3 over UDP on 443)
3
+ # Auth: set GAME_SERVER_AUTH_* to enable (add them to the container Environment below, secrets through Secrets Manager)
4
+ #
5
+ # Babylon Game Server {{version}} on ECS Fargate behind a Network Load Balancer with a TCP_QUIC listener, so browsers
6
+ # can use WebTransport datagrams. Players connect with wss://<your domain>, which you point at the
7
+ # LoadBalancerDnsName output; the certificate in TlsSecretArn must cover that domain.
8
+ # TlsSecretArn is a Secrets Manager secret whose JSON has two keys, certPem (the full chain) and keyPem (the key):
9
+ # aws secretsmanager create-secret --name babylon-game-server-tls \
10
+ # --secret-string "$(jq -n --rawfile certPem fullchain.pem --rawfile keyPem privkey.pem '{certPem: $certPem, keyPem: $keyPem}')"
11
+ # Long-form intrinsics only (Ref: / Fn::GetAtt:), so any YAML parser can check the template.
12
+ # QUIC listeners do not accept security groups on the NLB, so the task security group admits 2567 TCP + UDP.
13
+ # Check the current Elastic Load Balancing QUIC requirements for your region before production (see aws/README.md).
14
+ AWSTemplateFormatVersion: "2010-09-09"
15
+ Description: Babylon Game Server {{version}} on ECS Fargate behind a Network Load Balancer TCP_QUIC listener (WSS + HTTP/3, TLS on the server)
16
+
17
+ Parameters:
18
+ VpcId:
19
+ Type: AWS::EC2::VPC::Id
20
+ Description: The VPC the load balancer and the tasks run in.
21
+ SubnetIds:
22
+ Type: List<AWS::EC2::Subnet::Id>
23
+ Description: Two or more public subnets in different availability zones.
24
+ CertificateArn:
25
+ Type: String
26
+ Default: ""
27
+ Description: Not used by this template (the server terminates TLS from TlsSecretArn); kept so both AWS recipes take the same parameters.
28
+ TlsSecretArn:
29
+ Type: String
30
+ Description: ARN of the Secrets Manager secret with the certPem and keyPem keys.
31
+ Image:
32
+ Type: String
33
+ Default: ghcr.io/mackeyk24/babylon-game-server:{{version}}
34
+ Description: The server image (or your own image built from the init Dockerfile).
35
+ DesiredCount:
36
+ Type: Number
37
+ Default: 1
38
+ Description: Number of server tasks.
39
+
40
+ Resources:
41
+ Cluster:
42
+ Type: AWS::ECS::Cluster
43
+
44
+ LogGroup:
45
+ Type: AWS::Logs::LogGroup
46
+ Properties:
47
+ RetentionInDays: 14
48
+
49
+ TaskExecutionRole:
50
+ Type: AWS::IAM::Role
51
+ Properties:
52
+ AssumeRolePolicyDocument:
53
+ Version: "2012-10-17"
54
+ Statement:
55
+ - Effect: Allow
56
+ Principal:
57
+ Service: ecs-tasks.amazonaws.com
58
+ Action: sts:AssumeRole
59
+ ManagedPolicyArns:
60
+ - arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy
61
+ Policies:
62
+ - PolicyName: read-tls-secret
63
+ PolicyDocument:
64
+ Version: "2012-10-17"
65
+ Statement:
66
+ - Effect: Allow
67
+ Action: secretsmanager:GetSecretValue
68
+ Resource:
69
+ Ref: TlsSecretArn
70
+
71
+ TaskDefinition:
72
+ Type: AWS::ECS::TaskDefinition
73
+ Properties:
74
+ Family: babylon-game-server-quic
75
+ RequiresCompatibilities:
76
+ - FARGATE
77
+ NetworkMode: awsvpc
78
+ Cpu: "512"
79
+ Memory: "1024"
80
+ ExecutionRoleArn:
81
+ Fn::GetAtt: [TaskExecutionRole, Arn]
82
+ ContainerDefinitions:
83
+ - Name: game-server
84
+ Image:
85
+ Ref: Image
86
+ Essential: true
87
+ # Longer than the 30 s drain, so running sessions finish before the task is stopped.
88
+ StopTimeout: 45
89
+ PortMappings:
90
+ - ContainerPort: 2567
91
+ Protocol: tcp
92
+ - ContainerPort: 2567
93
+ Protocol: udp
94
+ Environment:
95
+ - Name: GAME_SERVER_LOG_FORMAT
96
+ Value: json
97
+ # Admin console data (accounts, bans, audit log). Fargate task storage is lost when the task stops: add
98
+ # GAME_SERVER_REDIS_URL (ElastiCache, see aws/README.md) so the console keeps its data in Redis.
99
+ - Name: GAME_SERVER_ADMIN_DATA_DIR
100
+ Value: /data
101
+ - Name: GAME_SERVER_TLS_ENABLED
102
+ Value: "true"
103
+ - Name: GAME_SERVER_UDP_ENABLED
104
+ Value: "true"
105
+ Secrets:
106
+ - Name: GAME_SERVER_TLS_CERT_PEM
107
+ ValueFrom:
108
+ Fn::Join:
109
+ - ""
110
+ - - Ref: TlsSecretArn
111
+ - ":certPem::"
112
+ - Name: GAME_SERVER_TLS_KEY_PEM
113
+ ValueFrom:
114
+ Fn::Join:
115
+ - ""
116
+ - - Ref: TlsSecretArn
117
+ - ":keyPem::"
118
+ LogConfiguration:
119
+ LogDriver: awslogs
120
+ Options:
121
+ awslogs-group:
122
+ Ref: LogGroup
123
+ awslogs-region:
124
+ Ref: AWS::Region
125
+ awslogs-stream-prefix: game-server
126
+
127
+ ServiceSecurityGroup:
128
+ Type: AWS::EC2::SecurityGroup
129
+ Properties:
130
+ GroupDescription: Babylon Game Server tasks (2567 TCP + UDP; the NLB keeps the player's address)
131
+ VpcId:
132
+ Ref: VpcId
133
+ SecurityGroupIngress:
134
+ - IpProtocol: tcp
135
+ FromPort: 2567
136
+ ToPort: 2567
137
+ CidrIp: 0.0.0.0/0
138
+ - IpProtocol: udp
139
+ FromPort: 2567
140
+ ToPort: 2567
141
+ CidrIp: 0.0.0.0/0
142
+
143
+ LoadBalancer:
144
+ Type: AWS::ElasticLoadBalancingV2::LoadBalancer
145
+ Properties:
146
+ Type: network
147
+ Scheme: internet-facing
148
+ Subnets:
149
+ Ref: SubnetIds
150
+
151
+ TargetGroup:
152
+ Type: AWS::ElasticLoadBalancingV2::TargetGroup
153
+ Properties:
154
+ VpcId:
155
+ Ref: VpcId
156
+ Protocol: TCP_QUIC
157
+ Port: 2567
158
+ TargetType: ip
159
+ HealthCheckProtocol: HTTPS
160
+ HealthCheckPath: /game-server/ready
161
+ HealthCheckIntervalSeconds: 15
162
+ HealthyThresholdCount: 2
163
+ UnhealthyThresholdCount: 3
164
+ TargetGroupAttributes:
165
+ - Key: deregistration_delay.timeout_seconds
166
+ Value: "45"
167
+
168
+ QuicListener:
169
+ Type: AWS::ElasticLoadBalancingV2::Listener
170
+ Properties:
171
+ LoadBalancerArn:
172
+ Ref: LoadBalancer
173
+ Port: 443
174
+ Protocol: TCP_QUIC
175
+ DefaultActions:
176
+ - Type: forward
177
+ TargetGroupArn:
178
+ Ref: TargetGroup
179
+
180
+ Service:
181
+ Type: AWS::ECS::Service
182
+ DependsOn: QuicListener
183
+ Properties:
184
+ Cluster:
185
+ Ref: Cluster
186
+ LaunchType: FARGATE
187
+ DesiredCount:
188
+ Ref: DesiredCount
189
+ TaskDefinition:
190
+ Ref: TaskDefinition
191
+ HealthCheckGracePeriodSeconds: 30
192
+ NetworkConfiguration:
193
+ AwsvpcConfiguration:
194
+ # A public IP lets the task pull the image from ghcr.io without a NAT gateway.
195
+ AssignPublicIp: ENABLED
196
+ Subnets:
197
+ Ref: SubnetIds
198
+ SecurityGroups:
199
+ - Ref: ServiceSecurityGroup
200
+ LoadBalancers:
201
+ - ContainerName: game-server
202
+ ContainerPort: 2567
203
+ TargetGroupArn:
204
+ Ref: TargetGroup
205
+
206
+ Outputs:
207
+ LoadBalancerDnsName:
208
+ Description: Point your game server domain (CNAME or Route 53 alias) here.
209
+ Value:
210
+ Fn::GetAtt: [LoadBalancer, DNSName]
@@ -0,0 +1,158 @@
1
+ // Babylon Game Server {{version}} configuration.
2
+ //
3
+ // Every setting is shown at its default. Precedence: defaults < this file < GAME_SERVER_* environment variables <
4
+ // command-line flags, so a platform can override any value here with an environment variable (see .env.example).
5
+ // The server finds this file through --config <path>, GAME_SERVER_CONFIG, or babylon-game-server.config.mjs in the
6
+ // working directory. The default export may also be a function (async allowed) that returns this object.
7
+ //
8
+ // TLS, UDP and auth are all disabled. Each section below says how to turn it on and what it needs.
9
+
10
+ /** @type {import("@babylonjs-toolkit/server").DeepPartial<import("@babylonjs-toolkit/server").GameServerConfig>} */
11
+ export default {
12
+ // TCP (and UDP) port. Platforms that set PORT are honoured when GAME_SERVER_PORT is unset.
13
+ port: 2567,
14
+ // Address to bind. "0.0.0.0" accepts connections from other machines (containers need it).
15
+ host: "0.0.0.0",
16
+ // Public ws:// or wss:// URL players use, shown in the banner (null: derived from host, port and TLS).
17
+ publicUrl: null,
18
+ // host[:port] this instance advertises for seat reservations when scaled out with Redis (one per instance).
19
+ publicAddress: null,
20
+ // Trust x-forwarded-for / x-real-ip for the client address. Turn on only behind your own reverse proxy.
21
+ trustProxy: false,
22
+ // "auto" (JSON when NODE_ENV=production), "json" or "text".
23
+ logFormat: "auto",
24
+ // "error", "warn", "info" or "debug".
25
+ logLevel: "info",
26
+
27
+ // TLS on the server itself (https:// and wss://). Leave it off when a proxy or the platform edge terminates TLS.
28
+ // To enable it, set enabled: true and give it a certificate, one of:
29
+ // - certFile + keyFile: paths of PEM files (for example from certbot); they are reloaded when they change.
30
+ // - certPem + keyPem: the PEM text itself, for container secrets (GAME_SERVER_TLS_CERT_PEM / _KEY_PEM).
31
+ // - developmentCertificate: true for local testing only (needs mkcert; refused when NODE_ENV=production).
32
+ tls: {
33
+ enabled: false,
34
+ certFile: null,
35
+ keyFile: null,
36
+ certPem: null,
37
+ keyPem: null,
38
+ developmentCertificate: false
39
+ },
40
+
41
+ // HTTP/3 WebTransport (UDP datagrams for snapshots and inputs) on the same port as the WebSocket.
42
+ // To enable it, set enabled: true. It needs:
43
+ // - TLS enabled on the server (above): browsers only speak HTTP/3 over TLS.
44
+ // - The port open for UDP as well as TCP (firewall, security group, `-p 443:443/udp`).
45
+ // - A host that forwards inbound UDP to the server; most PaaS hosts do not (see DEPLOY.md).
46
+ // Players whose browser or network cannot use it fall back to the WebSocket automatically.
47
+ udp: {
48
+ enabled: false
49
+ },
50
+
51
+ // Player authentication: every join must carry a valid token (the game sets StartGameArgs.authToken).
52
+ // To enable it, set enabled: true and pick a mode with its fields:
53
+ // - "shared-secret": sharedSecret.tokens lists the accepted tokens.
54
+ // - "jwt": jwt.secret (HMAC) or jwt.jwksUrl (your identity provider), plus optional issuer / audience / algorithms.
55
+ // - "webhook": webhook.url approves each player (POST), within webhook.timeoutMs.
56
+ // - "custom": your own verifier, the hooks.verifyToken of createGameServer({ hooks }) when you start it from code.
57
+ auth: {
58
+ enabled: false,
59
+ mode: "shared-secret",
60
+ sharedSecret: { tokens: [] },
61
+ jwt: { secret: null, jwksUrl: null, issuer: null, audience: null, algorithms: [] },
62
+ webhook: { url: null, timeoutMs: 5000 }
63
+ },
64
+
65
+ // Discord sign-in for players: off by default. Set the client secret on your host's environment (GAME_SERVER_DISCORD_CLIENT_SECRET), never in this file.
66
+ // To enable it, create a Discord application, add this server's callback under OAuth2 -> Redirects, and set:
67
+ // - clientId: the application's client id.
68
+ // - redirectUri: "https://<your server>/game-server/discord/callback", exactly as registered with Discord.
69
+ // - returnOrigins: the game origins a sign-in may return to, e.g. ["https://game.example.com"].
70
+ // discordSignIn: {
71
+ // enabled: false,
72
+ // clientId: null,
73
+ // clientSecret: null,
74
+ // redirectUri: null,
75
+ // returnOrigins: [],
76
+ // sessionDays: 30
77
+ // },
78
+
79
+ // Admin console at /game-server/admin/ and the admin API. The first start logs a one-time "admin setup link" for the
80
+ // first Owner (or run `babylon-game-server admin create-owner`). The console needs HTTPS (or a loopback address).
81
+ // token: the legacy bearer token of the four original admin endpoints; prefer GAME_SERVER_ADMIN_TOKEN.
82
+ // dataDir: accounts, bans and the audit log when redis.url is not set; keep it on a volume (the image uses /data).
83
+ // allowedNetworks: addresses or CIDR ranges that may reach the console, e.g. ["10.0.0.0/8"] (empty: any).
84
+ admin: {
85
+ token: null,
86
+ console: true,
87
+ dataDir: "./babylon-game-server-data",
88
+ sessionIdleMinutes: 30,
89
+ sessionMaxHours: 12,
90
+ allowedNetworks: [],
91
+ logBufferEntries: 10000,
92
+ metricsHistoryHours: 24,
93
+ grafanaUrl: null,
94
+ instanceLabel: null,
95
+ // Single sign-on (OpenID Connect). roleMapping: ["admins=admin", "support=moderator"].
96
+ oidc: {
97
+ enabled: false,
98
+ issuer: null,
99
+ clientId: null,
100
+ clientSecret: null,
101
+ label: "Single sign-on",
102
+ roleClaim: "groups",
103
+ roleMapping: [],
104
+ allowLocalSignIn: true
105
+ },
106
+ passkeys: {
107
+ enabled: true,
108
+ rpId: null
109
+ },
110
+ // The console's Colyseus Cloud page. Set the token on your host's environment
111
+ // (GAME_SERVER_ADMIN_COLYSEUS_CLOUD_API_TOKEN), never in this file.
112
+ colyseusCloud: {
113
+ apiToken: null,
114
+ application: null,
115
+ apiUrl: "https://cloud-prod.colyseus.io/api/v1"
116
+ }
117
+ },
118
+
119
+ // Prometheus metrics on GET /metrics.
120
+ metrics: {
121
+ enabled: true,
122
+ requireAdminToken: false
123
+ },
124
+
125
+ // Abuse limits. Set allowedOrigins to your game's origins in production, e.g. ["https://game.example.com"].
126
+ limits: {
127
+ allowedOrigins: [],
128
+ allowMissingOrigin: true,
129
+ joinRequestsPerMinutePerAddress: 120,
130
+ maxSessions: 1000,
131
+ maxPlayersPerSession: 255,
132
+ maxDedicatedSessions: 4,
133
+ maxMessageBytes: 65536,
134
+ maxMessagesPerSecond: 2000,
135
+ maxSessionNameLength: 128
136
+ },
137
+
138
+ // Multi-instance scaling: every instance shares one Redis (redis://host:6379) and sets its own publicAddress.
139
+ redis: {
140
+ url: null
141
+ },
142
+
143
+ // Dedicated (Server-mode) sessions that run the exported scene on the server.
144
+ // scenes: [{ name: "arena", sceneRoot: "/app/scenes/arena/", sceneFile: "arena.gltf", projectScripts: [],
145
+ // maxPlayers: 8, onDemand: true, idleSeconds: 60 }]
146
+ // boot: [{ sessionName: "arena-1", sceneName: "arena" }]
147
+ dedicated: {
148
+ scenes: [],
149
+ boot: []
150
+ },
151
+
152
+ // JSON file of leaderboard boards created on start when missing (relative to the working directory), and whether
153
+ // only signed-in players (an auth identity with a user id) may submit scores.
154
+ leaderboards: { definitionsFile: null, signedInPlayersOnly: false },
155
+
156
+ // Seconds running sessions may continue after SIGTERM before the server exits.
157
+ drainSeconds: 30
158
+ };
@@ -0,0 +1,133 @@
1
+ # Babylon Game Server on Colyseus Cloud
2
+
3
+ This folder is a small deploy repository. It installs the published `@babylonjs-toolkit/server` package {{version}} and
4
+ tells Colyseus Cloud how to run it. There is no server code to write or build here.
5
+
6
+ | File | What it does |
7
+ |---|---|
8
+ | `package.json` | Pins the server version. |
9
+ | `ecosystem.config.cjs` | Tells Colyseus Cloud what to start: one server process per CPU. |
10
+ | `babylon-game-server.config.mjs` | Your server settings. It starts empty. |
11
+ | `.gitignore` | Keeps `node_modules/`, environment files and your deploy credentials out of the repository. |
12
+
13
+ Colyseus Cloud serves `wss://` for you, and TLS, UDP (HTTP/3 WebTransport) and player authentication are off until you
14
+ choose otherwise. On this host UDP cannot reach the server, so players use the WebSocket.
15
+
16
+ ## Before you start
17
+
18
+ - You need a Colyseus Cloud account with an application created for this server.
19
+ - Check that the application runs Node 22 or newer, which the server requires.
20
+
21
+ ## 1. Push this folder to git
22
+
23
+ Colyseus Cloud deploys only from git: it clones the branch, runs `npm install` and the `build` script, then starts the
24
+ server. Push this folder as a repository of its own, as below, or keep it as a subfolder of an existing repository
25
+ (your game's, for example) and set the application's **Root directory** to that subfolder on the panel. With a
26
+ subfolder, set the panel's watch paths to it as well, so only changes here deploy.
27
+
28
+ ```bash
29
+ npm install
30
+ git init
31
+ git add .
32
+ git commit -m "Babylon Game Server on Colyseus Cloud"
33
+ git branch -M main
34
+ git remote add origin <your repository URL>
35
+ git push -u origin main
36
+ ```
37
+
38
+ Keep the `package-lock.json` that `npm install` wrote, so every deploy installs the same packages.
39
+
40
+ ## 2. Connect it to Colyseus Cloud
41
+
42
+ Pick one of these two ways:
43
+
44
+ - **From the panel:** connect the repository to your application in the Colyseus Cloud panel. Each push to the branch
45
+ you choose then deploys.
46
+ - **From this folder:** run `npx @colyseus/cloud deploy`. It writes `.colyseus-cloud.json`, which holds your deploy
47
+ credentials. The `.gitignore` here already keeps that file out of the repository. Do not commit it. The command only
48
+ asks Colyseus Cloud to deploy the branch you already pushed, and it returns before the deploy finishes, even when
49
+ it fails. Read the result on the panel's deployments page.
50
+
51
+ ## 3. Set the panel variables
52
+
53
+ Add these to your application's environment variables on the Colyseus Cloud panel, then deploy again:
54
+
55
+ | Variable | Value |
56
+ |---|---|
57
+ | `NODE_ENV` | `production` |
58
+ | `GAME_SERVER_ALLOWED_ORIGINS` | The web address of your game, such as `https://game.example.com`. Separate several with commas. |
59
+ | `GAME_SERVER_ADMIN_TOKEN` | A long random secret. It turns on the admin endpoints. |
60
+
61
+ Every `GAME_SERVER_*` variable works here. The `.env.example` that `babylon-game-server init` wrote beside this folder
62
+ lists them all. To require player sign-in, set the `GAME_SERVER_AUTH_*` variables.
63
+
64
+ Leave `GAME_SERVER_TLS_ENABLED`, `GAME_SERVER_UDP_ENABLED` and `GAME_SERVER_PUBLIC_ADDRESS` unset. Colyseus Cloud
65
+ handles all three, so the server refuses to start with any of them turned on and says which one to change.
66
+
67
+ Optional: to see this application's status, host processes, deploys, host logs and billing on the admin console's **Colyseus Cloud**
68
+ page, create a token under **API tokens** in the Colyseus Cloud dashboard and set `GAME_SERVER_ADMIN_COLYSEUS_CLOUD_API_TOKEN`
69
+ to it. If your team has several applications, also set `GAME_SERVER_ADMIN_COLYSEUS_CLOUD_APPLICATION` to this one's slug.
70
+
71
+ ## 4. Point your game at the server
72
+
73
+ Open the application's logs on the panel. The startup banner shows the server's `wss://` address. Put that address in
74
+ your game's build settings, then rebuild the game:
75
+
76
+ ```bash
77
+ VITE_FUSION_SERVER_URL=wss://<your-application-address>
78
+ ```
79
+
80
+ Start two players from two browsers and join the same session to confirm it works.
81
+
82
+ ## The admin console
83
+
84
+ The server has a web console at `/game-server/admin/` on your application's address. To create its first Owner, open the
85
+ `admin setup link` line from the application's logs within 30 minutes of the deploy. Each process logs its own link and
86
+ any one of them works; the first Owner ends them all. There is no shell on Colyseus Cloud, so this link is the way in.
87
+
88
+ If the console answers `the console needs HTTPS`, Colyseus Cloud is not telling the server that the request was HTTPS.
89
+ See the first deploy checklist in the server's `DEPLOY.md`.
90
+
91
+ ## Dedicated sessions
92
+
93
+ A dedicated session runs your exported scene on the server. It needs no extra port or container, because it runs
94
+ inside the same server processes.
95
+
96
+ 1. Open `babylon-game-server.config.mjs` and copy the `limits` and `dedicated` example into the exported object.
97
+ 2. Keep each scene either in this repository, with a `sceneRoot` such as `./scenes/arena/`, or at an `https://`
98
+ address.
99
+ 3. Set `limits.maxDedicatedSessions`, which is the number of dedicated sessions one process may run. It defaults to 4.
100
+ Run your scene, watch the memory one process uses, and choose a number that leaves room to spare. Colyseus Cloud
101
+ restarts a process that passes its memory limit, and that ends every session on the process. It sizes that limit
102
+ from the plan's memory: about 1.1 GB per process on plans with 2 GB per CPU, but only 256 MB on the smallest 1 GB
103
+ plan. `ecosystem.config.cjs` explains how to set the limit yourself.
104
+ 4. Commit and push.
105
+
106
+ A session listed under `boot` starts once, on one process, however many processes are running. A larger plan
107
+ with more CPUs runs more processes, which is how you add dedicated capacity.
108
+
109
+ ## Leaderboards
110
+
111
+ The server ranks the scores your game sends at key stages (a match or level finish), with seasons, trust levels and a
112
+ **Leaderboards** page on the admin console. They are on by default. To create your boards on deploy:
113
+
114
+ 1. Write a `leaderboards.json` definitions file in this folder (the format is in the server's README, "The definitions
115
+ file"). The server creates the boards that are missing at start and keeps the console's edits to existing ones.
116
+ 2. Open `babylon-game-server.config.mjs` and copy its `leaderboards: { definitionsFile: "./leaderboards.json", signedInPlayersOnly: true }`
117
+ line into the exported object (drop `signedInPlayersOnly` to let players who are not signed in post scores too).
118
+ 3. Commit both files and push.
119
+
120
+ The scores live in the same place as the console's data. For production, set `REDIS_URI` on the panel to an external
121
+ Redis that persists its data (a managed Redis with snapshots or an append-only file). Without it, the scores sit in the
122
+ machine's local Redis or in files, which a deploy or restart may lose. The console's Leaderboards page warns when the
123
+ storage is not durable, and its Settings tab exports a backup.
124
+
125
+ ## Deploying an update
126
+
127
+ To move to a newer server, change the `@babylonjs-toolkit/server` version in `package.json`, run `npm install`, then
128
+ commit and push. Running sessions get up to 10 minutes to finish before the old processes stop, so a race in progress
129
+ is not cut off. New sessions go to the new processes only. To change that time, set `GAME_SERVER_DRAIN_SECONDS`
130
+ (keep it under 30 minutes, the `kill_timeout` in `ecosystem.config.cjs`).
131
+
132
+ A deploy whose new processes do not start listening within two minutes fails, and the old version keeps serving. The
133
+ very first deploy is not checked that way, so read its logs for the startup banner.
@@ -0,0 +1,36 @@
1
+ // Babylon Game Server {{version}} configuration for Colyseus Cloud.
2
+ //
3
+ // The server picks its Colyseus Cloud settings by itself (public URL, client address, Redis, drain time and admin
4
+ // data folder), so this file starts empty. Anything set here, or as a GAME_SERVER_* variable on the Colyseus Cloud
5
+ // panel, wins over those settings. The panel is the better place for secrets, because this file lives in the repository.
6
+ //
7
+ // TLS, UDP and publicAddress stay unset: Colyseus Cloud handles them, and the server refuses to start with them.
8
+ //
9
+ // Dedicated sessions run the exported scene on the server, and they are configured only in this file. The scene is
10
+ // either in this repository or at an https:// address. This example shows both:
11
+ //
12
+ // limits: {
13
+ // // Dedicated sessions one process runs. Size it by measuring your scene: see README.md.
14
+ // maxDedicatedSessions: 4
15
+ // },
16
+ // dedicated: {
17
+ // scenes: [
18
+ // // A scene exported into this repository, in the folder ./scenes/arena/
19
+ // { name: "arena", sceneRoot: "./scenes/arena/", sceneFile: "arena.gltf", projectScripts: [], maxPlayers: 8, onDemand: true, idleSeconds: 60 },
20
+ // // A scene hosted on your own storage
21
+ // { name: "harbor", sceneRoot: "https://assets.example.com/scenes/harbor/", sceneFile: "harbor.gltf", projectScripts: [], maxPlayers: 8, onDemand: true, idleSeconds: 60 }
22
+ // ],
23
+ // // Sessions started with the server. They start once, on one process.
24
+ // boot: [
25
+ // { sessionName: "arena-1", sceneName: "arena" }
26
+ // ]
27
+ // }
28
+ //
29
+ // Leaderboards are on by default. To create your boards from a definitions file committed beside this one, copy this
30
+ // line into the exported object (see README.md, "Leaderboards"). signedInPlayersOnly: true accepts scores only from
31
+ // signed-in players (an auth identity with a user id, such as Discord sign-in); drop it to let guests post too:
32
+ //
33
+ // leaderboards: { definitionsFile: "./leaderboards.json", signedInPlayersOnly: true },
34
+
35
+ /** @type {import("@babylonjs-toolkit/server").DeepPartial<import("@babylonjs-toolkit/server").GameServerConfig>} */
36
+ export default {};
@@ -0,0 +1,35 @@
1
+ // TLS: edge (Colyseus Cloud serves wss:// through NGINX)
2
+ // UDP: not supported on this host
3
+ // Auth: set GAME_SERVER_AUTH_* to enable
4
+ //
5
+ // Babylon Game Server {{version}} on Colyseus Cloud. See README.md for the deploy steps.
6
+ // One process runs on one thread, so one process per CPU gives every core to sessions. The processes share Redis,
7
+ // which the server finds by itself on Colyseus Cloud.
8
+ //
9
+ // kill_timeout and listen_timeout are set here, not left to Colyseus Cloud's deploy agent, so they also hold on the
10
+ // fallback path that runs PM2 with its own defaults (a 1.6 s kill timeout, which would cut a drain off). A stopping
11
+ // process drains for GAME_SERVER_DRAIN_SECONDS (600 s on Colyseus Cloud) and then exits by itself.
12
+ // max_memory_restart stays unset: Colyseus Cloud sizes it from the machine's memory. To set it yourself, add for
13
+ // example max_memory_restart: "700M", and keep the total below the plan's memory, because a deploy briefly runs
14
+ // half as many processes again and the machine has no swap.
15
+ const os = require("node:os");
16
+
17
+ /** Milliseconds a stopping process may drain before PM2 kills it: 30 minutes, Colyseus Cloud's own default. */
18
+ const KILL_TIMEOUT_MS = 30 * 60 * 1000;
19
+ /** Milliseconds a new process has to listen before the deploy counts it as failed (loading Havok and scenes). */
20
+ const LISTEN_TIMEOUT_MS = 120 * 1000;
21
+
22
+ module.exports = {
23
+ apps: [{
24
+ name: "babylon-game-server",
25
+ script: "node_modules/@babylonjs-toolkit/server/lib/cli.js",
26
+ args: "start",
27
+ exec_mode: "fork",
28
+ instances: os.cpus().length,
29
+ wait_ready: true,
30
+ kill_timeout: KILL_TIMEOUT_MS,
31
+ listen_timeout: LISTEN_TIMEOUT_MS,
32
+ watch: false,
33
+ time: true
34
+ }]
35
+ };
@@ -0,0 +1,6 @@
1
+ node_modules/
2
+ # Written by `npx @colyseus/cloud deploy`. It holds deploy credentials.
3
+ .colyseus-cloud.json
4
+ .env*
5
+ # The list of every GAME_SERVER_* variable, with no values: safe to commit.
6
+ !.env.example
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "babylon-game-server-cloud",
3
+ "version": "1.0.0",
4
+ "description": "Deploy repository of a Babylon Game Server on Colyseus Cloud",
5
+ "private": true,
6
+ "engines": {
7
+ "node": ">=22"
8
+ },
9
+ "scripts": {
10
+ "build": "node -e \"console.log('The Babylon Game Server ships compiled, so there is nothing to build.')\""
11
+ },
12
+ "dependencies": {
13
+ "@babylonjs-toolkit/server": "{{version}}"
14
+ }
15
+ }
@@ -0,0 +1,30 @@
1
+ # TLS: edge (App Platform terminates TLS for the app's ondigitalocean.app domain and your custom domains)
2
+ # UDP: not supported on this host (App Platform routes inbound HTTP only: https://docs.digitalocean.com/products/app-platform/details/limits/)
3
+ # Auth: set GAME_SERVER_AUTH_* to enable (add them under envs, secrets with type: SECRET)
4
+ #
5
+ # Babylon Game Server {{version}} on DigitalOcean App Platform, WebSocket only. Commit this folder to a GitHub
6
+ # repository, set github.repo below, then:
7
+ # doctl apps create --spec digitalocean-app.yaml
8
+ # Players use wss://<app>.ondigitalocean.app.
9
+ name: babylon-game-server
10
+ services:
11
+ - name: game-server
12
+ github:
13
+ repo: your-account/your-game-server
14
+ branch: main
15
+ deploy_on_push: true
16
+ source_dir: /
17
+ dockerfile_path: Dockerfile
18
+ http_port: 2567
19
+ instance_count: 1
20
+ instance_size_slug: apps-s-1vcpu-1gb
21
+ health_check:
22
+ http_path: /game-server/ready
23
+ initial_delay_seconds: 20
24
+ period_seconds: 15
25
+ envs:
26
+ - key: GAME_SERVER_PORT
27
+ value: "2567"
28
+ # App Platform's proxy sends the player's address in x-forwarded-for.
29
+ - key: GAME_SERVER_TRUST_PROXY
30
+ value: "true"
@@ -0,0 +1,45 @@
1
+ # Babylon Game Server {{version}}, full setup: TLS on the server, WebSocket + HTTP/3 WebTransport on 443, and Redis.
2
+ # TLS: server (certbot writes ./certs/fullchain.pem and ./certs/privkey.pem; they are reloaded when renewed)
3
+ # UDP: supported (443/udp is published; the host and firewall must allow inbound UDP 443)
4
+ # Auth: off until set; set GAME_SERVER_AUTH_* to enable
5
+ #
6
+ # docker compose -f docker-compose.full.yml up -d
7
+ # The server runs as user "node": make privkey.pem readable to it (for example copy the renewed files into ./certs
8
+ # with mode 0644 from a certbot deploy hook). Players use wss://<your domain>; browsers that can use HTTP/3 switch to
9
+ # WebTransport automatically.
10
+ services:
11
+ game-server:
12
+ image: ${GAME_SERVER_IMAGE:-ghcr.io/mackeyk24/babylon-game-server:{{version}}}
13
+ restart: unless-stopped
14
+ depends_on:
15
+ - redis
16
+ environment:
17
+ GAME_SERVER_CONFIG: /app/config/babylon-game-server.config.mjs
18
+ GAME_SERVER_TLS_ENABLED: "true"
19
+ GAME_SERVER_TLS_CERT_FILE: /certs/fullchain.pem
20
+ GAME_SERVER_TLS_KEY_FILE: /certs/privkey.pem
21
+ GAME_SERVER_UDP_ENABLED: "true"
22
+ GAME_SERVER_PORT: "443"
23
+ # With Redis set, the admin console keeps its data (accounts, bans, audit log) in Redis; the /data volume holds
24
+ # it only if you remove GAME_SERVER_REDIS_URL.
25
+ GAME_SERVER_REDIS_URL: redis://redis:6379
26
+ GAME_SERVER_ADMIN_DATA_DIR: /data
27
+ ports:
28
+ - "443:443/tcp"
29
+ - "443:443/udp"
30
+ volumes:
31
+ - ./babylon-game-server.config.mjs:/app/config/babylon-game-server.config.mjs:ro
32
+ - ./certs:/certs:ro
33
+ - game-server-data:/data
34
+
35
+ redis:
36
+ image: redis:7
37
+ restart: unless-stopped
38
+ # Append-only persistence on the redis-data volume, so admin accounts, bans and the audit log survive a restart.
39
+ command: ["redis-server", "--appendonly", "yes"]
40
+ volumes:
41
+ - redis-data:/data
42
+
43
+ volumes:
44
+ game-server-data:
45
+ redis-data: