⚙️ Infrastructure
Services Overview
|| Service | Type | Port | Access | Purpose |
||:--------|:-----|:-----|:-------|:--------|
|| Nginx | Reverse proxy | 443 | Public | TLS termination, routing |
|| SvelteKit | Frontend | 3000 | Via Nginx | Web UI, lobby, matchmaking |
|| Hugo Docs | Documentation | 1313 | / | Internal documentation |
|| Traefik | K8s ingress | 32443 | Internal | Service routing, WebSocket |
|| Nakama | Game backend | — | Via Traefik | Auth, matchmaking, game state |
|| PostgreSQL | Database | 5432 | K8s cluster | User data, game state |
|| Redis | Cache | 6379 | K8s cluster | Sessions, pub/sub |
|| Grafana | Monitoring | — | /grafana/ | Dashboards, alerts |
|| Prometheus | Metrics | — | /prometheus/ | Time-series data |
||| Hermes Gateway | Discord bot | — | systemd service | AI agent bridge |
||| Terminal Bridge | Web terminal | 7681 | /terminal-ws/ → /dev/terminal | wterm.dev browser bash (node-pty) |
Nakama Game Backend
Deployment Architecture
Host Path: /home/usr/funday/nakama-modules
↓
K8s Volume Mount: /nakama/data/modules
↓
Runtime: heroiclabs/nakama:3.32.0
Module Structure
nakama-modules/
├── index.ts # Main entry, all RPC handlers
├── config/ # Game configuration
├── matches/ # Match handler implementations
├── schemas/ # Data schemas
└── utils/ # Shared utilities
Match Handlers (27 Active)
| Handler | Game | Status |
|---|---|---|
battleships_match | Battleships | ✅ Live |
connect4_match | Connect 4 | ✅ Live |
racing_match | Racing | ✅ Live |
bomberman_match | Bombergang | ✅ Live |
card_battle | Battle Cards | ✅ Live |
generic_match | Scaffold | ✅ Live |
| … and 21 more |
Critical Health Endpoints
- Liveness:
httpGet: /on port 7350 (30s delay, 10s period) - Readiness:
httpGet: /healthcheckon port 7350 (5s delay, 5s period) - Metrics: Prometheus on port 9100
Database Configuration
PostgreSQL Namespace
- Database:
nakama(notfunday!) - User:
nakama - Connection:
postgres.postgresql.svc.cluster.local:5432 - User Count: 19k+ real users
Redis Cache
- Namespace:
funday-platform - Purpose: Session storage, match presence
- Connection:
redis.funday-platform.svc.cluster.local:6379
Key Config Files
/etc/nginx/sites-enabled/funday → Main Nginx config
/etc/nginx/snippets/funday-traefik-subpaths.conf → Traefik proxy rules
/etc/systemd/system/hermes-gateway.service → Hermes Discord bot
/etc/systemd/system/hugo-docs.service → Hugo docs server
/etc/systemd/system/funday-terminal.service → wterm terminal bridge
/home/usr/funday/server/terminal-bridge.mjs → PTY WebSocket bridge (port 7681)
/home/usr/funday/nakama-modules/index.ts → Nakama runtime modules
/home/usr/funday/gitops/apps/nakama-config.yaml → Nakama K8s deployment