five-on-it / apps/server/src/supervisor
apps/server/src/supervisor
Several game processes on one host (FOI_PROCESSES=<n>, index.ts): one Node process uses one core, so a host of four cores runs four. The supervisor forks the server that many times on consecutive ports from PORT (each a process of its own, FOI_PROCESSES=1, its {port} filled in the fleet's settings, its own slice of the data channel's UDP ports FOI_RTC_PORTS when the channel is on: rtc-settings.ts), starts again one that stops (after 1 s, then twice as long each time up to 30 s, the count forgotten once it has run a minute), and on SIGTERM passes it on to every process (each drains its rooms) and stops once they all have.