File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# Use an official Node runtime as the base image
22FROM node:24-slim
3+ ENV GAME_ENV=Dev
34
45# 1) Installer Git pour que build-prod (webpack) puisse faire git rev-parse
56RUN apt-get update \
@@ -14,7 +15,7 @@ RUN npm ci
1415
1516# 3) Copier le code et builder le front
1617COPY . .
17- RUN npm run build-prod
18+ RUN npm run build-dev
1819
1920# 4) Ouvrir le port exposé par Fly
2021EXPOSE 3000
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ primary_region = "cdg"
77
88[env ]
99 PORT = " 3000"
10- NODE_ENV = " production "
10+ NODE_ENV = " development "
1111
1212[[services ]]
1313 internal_port = 3000
Original file line number Diff line number Diff line change @@ -172,7 +172,7 @@ app.post(
172172
173173 try {
174174 const response = await fetch (
175- `http://0.0.0.0 :${ config . workerPort ( gameID ) } /api/kick_player/${ gameID } /${ clientID } ` ,
175+ `http://localhost :${ config . workerPort ( gameID ) } /api/kick_player/${ gameID } /${ clientID } ` ,
176176 {
177177 method : "POST" ,
178178 headers : {
@@ -200,7 +200,7 @@ async function fetchLobbies(): Promise<number> {
200200 const controller = new AbortController ( ) ;
201201 setTimeout ( ( ) => controller . abort ( ) , 5000 ) ; // 5 second timeout
202202 const port = config . workerPort ( gameID ) ;
203- const promise = fetch ( `http://0.0.0.0 :${ port } /api/game/${ gameID } ` , {
203+ const promise = fetch ( `http://localhost :${ port } /api/game/${ gameID } ` , {
204204 headers : { [ config . adminHeader ( ) ] : config . adminToken ( ) } ,
205205 signal : controller . signal ,
206206 } )
@@ -275,7 +275,7 @@ async function schedulePublicGame(playlist: MapPlaylist) {
275275 // Send request to the worker to start the game
276276 try {
277277 const response = await fetch (
278- `http://0.0.0.0 :${ config . workerPort ( gameID ) } /api/create_game/${ gameID } ` ,
278+ `http://localhost :${ config . workerPort ( gameID ) } /api/create_game/${ gameID } ` ,
279279 {
280280 method : "POST" ,
281281 headers : {
Original file line number Diff line number Diff line change @@ -5,15 +5,15 @@ import { getServerConfigFromServer } from "../core/configuration/ConfigLoader";
55import { Cloudflare , TunnelConfig } from "./Cloudflare" ;
66import { startMaster } from "./Master" ;
77import { startWorker } from "./Worker" ;
8-
9- const config = getServerConfigFromServer ( ) ;
10-
118dotenv . config ( ) ;
9+ const config = getServerConfigFromServer ( ) ;
10+ const isFly = Boolean ( process . env . FLY_ALLOC_ID ) ;
11+ const test = false ;
1212
1313// Main entry point of the application
1414async function main ( ) {
1515 // Check if this is the primary (master) process
16- if ( cluster . isPrimary ) {
16+ if ( test && cluster . isPrimary ) {
1717 if ( config . env ( ) !== GameEnv . Dev ) {
1818 await setupTunnels ( ) ;
1919 }
Original file line number Diff line number Diff line change @@ -380,8 +380,10 @@ export function startWorker() {
380380 } ) ;
381381
382382 // The load balancer will handle routing to this server based on path
383- const PORT = config . workerPortByIndex ( workerId ) ;
383+ //const PORT = config.workerPortByIndex(workerId);
384+ const PORT = parseInt ( process . env . PORT || "" ) || 3000 ;
384385 const HOST = "0.0.0.0" ;
386+ console . log ( "PORT + HOST" , PORT , HOST ) ;
385387 server . listen ( PORT , HOST , ( ) => {
386388 log . info ( `running on http://${ HOST } :${ PORT } ` ) ;
387389 log . info ( `Handling requests with path prefix /w${ workerId } /` ) ;
You can’t perform that action at this time.
0 commit comments