20 Commits

Author SHA1 Message Date
evanpelle 5499bc350d update max cookie size to 32k 2026-04-01 12:44:31 -07:00
Josh Harris 05af154b58 feat(server): add health api endpoint for increased observability (#3264)
## Description:

Adds an additional API endpoint to the server for health, using the
master lobby service as the health metric. The master lobby service is
considered healthy if the lobby service has started (i.e. it had enough
ready workers to start), and the current amount of ready workers is more
than half of the desired number.

This means that we won't show as healthy until all the workers start,
and then we will continue to show as healthy even if a few workers
crash, as long as at least more than half are still running. Any less
than that, and the service becomes unhealthy.

This also is set to "no cache" in the nginx config. This is to ensure
that any checks of the server health show the true value, and cannot
show false/stale data served by nginx, cloudflare, or anything else.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

jish
2026-02-21 16:52:47 -06:00
Evan 294a1b4784 move lobby websockets to worker (#2974)
## Description:

Currently only the master process sends public lobby updates to clients.
This is not scalable since it could overload the master process.

In this PR, the master uses IPC to send public lobby info to all
workers. Then clients connect to a random worker to get public lobby
updates via websocket. This way clients never connect directly to the
master websocket.

The flow looks like this:

Every 100ms:
1. Master schedules a public game on a random worker if new games are
needed
2. Master broadcasts public lobby info to all workers (all public games
& num clients connected to each game)
3. Each worker responds to that update with the number of clients
connected to its own public games
4. Master then updates its public lobby state so it knows how many
clients are connected to each public game

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

evan
2026-02-03 18:26:38 -08:00
Ryan 247c78151c Discord(et al.) embedded URLs (#2740)
## Description:

Changes URL embeds within other platforms, e.g. Discord, WhatsApp & X.

Updates game URLs to `/game/<code>` instead of `/#join=<code>` (required
for embedded URLs). An added benefit of this is that you would be able
to change a url from `openfront.io/game/RQDUy8nP?replay` to
`api.openfront.io/game/RQDUy8nP?replay` (add api. In front) and be in
the right place for the API data.

Updates URLs when joining/leaving private lobbies

Appends a random string to the end of the URL when inside a private
lobby and options change - this is to force discord to update the
embedded details.

Updates URL in different game states to ?lobby / ?live and ?replay.
These do nothing other than being used as a _cache-busting_ solution.


-----------------------------------------------
### **Lobby Info**

Discord:
<img width="556" height="487" alt="image"
src="https://github.com/user-attachments/assets/efd4a06d-506c-4036-9403-ee7c9a669e21"
/>

WhatsApp:
<img width="353" height="339" alt="image"
src="https://github.com/user-attachments/assets/3b2d0c69-988c-424f-9dee-f4e6a6868f6b"
/>


x.com:
<img width="588" height="325" alt="image"
src="https://github.com/user-attachments/assets/d9e78169-20be-4a3e-8df4-8ad41d08a750"
/>


-------------------------
### **Game Win Details**
Discord:
<img width="506" height="468" alt="image"
src="https://github.com/user-attachments/assets/69947774-c943-4a50-b470-5634ed3bf3d7"
/>

WhatsApp:
<img width="770" height="132" alt="image"
src="https://github.com/user-attachments/assets/eec28bf8-bf64-4ab8-954e-03dfdd1aae40"
/>

x.com
<img width="584" height="350" alt="image"
src="https://github.com/user-attachments/assets/168063e2-b707-422b-b7a1-0025f3ebeb92"
/>


## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

w.o.n
2026-01-13 19:48:00 -08:00
evanpelle 44920f030b Bugfix: Kick player in private lobby not working
Nginx was stripping query params when routing requests to workers, so the creatorClientID param was stripped when creating a private game. This caused the game server to not know who the lobby owner was, so it rejected the kick requests.
2025-11-21 14:06:31 -08:00
evanpelle d522c33ba3 cache /commit.txt for only 5 seconds to prevent stale git commits 2025-09-12 09:00:49 -07:00
evanpelle 005f0ddd03 have nginx support up to 40 workers 2025-05-14 15:47:27 -07:00
Juan Broullon d4ddffe1eb fix: nginx not caching static resources (#254)
The current nginx config isn't caching any images given they're not
being served under the `/static/` path.
2025-03-21 10:06:09 -07:00
Evan 952c747c51 still allow nginx to cache root for 1 second 2025-03-18 10:12:42 -07:00
Evan 388aafbbf5 add more aggressive headers to prevent caching the root. 2025-03-18 09:57:28 -07:00
evanpelle 8b5d402d96 fix nginx.conf (#226) 2025-03-12 12:29:08 -07:00
evanpelle ea628570b2 have nginx cache index for 1s. (#224)
This is required for A B deployments, the browser wasn't updating due to
conditional caches
2025-03-12 11:03:28 -07:00
Evan e97fe402ef update config back to 1 second shortest cache allowed 2025-03-06 19:10:04 -08:00
Evan e27f889318 reduce public_lobbies cache to 500ms 2025-03-06 18:47:46 -08:00
Evan 152ffb8dc1 update to /api/public lobbies nginx config 2025-03-06 10:41:20 -08:00
Evan c42b53a536 update nginx to cache public_lobbies and /api/env 2025-03-06 10:21:04 -08:00
Evan dacd9607e4 update ttl, use file based hashing to prevent stale data. 2025-03-05 20:14:49 -08:00
Evan be5157a25c have nginx cache static assets 2025-03-05 08:04:12 -08:00
Evan f540d0302c configure nginx to run in container 2025-02-27 19:21:18 -08:00
Evan 3494c54906 use node cluster to shard server 2025-02-27 10:45:30 -08:00