⚙️ 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)

HandlerGameStatus
battleships_matchBattleships✅ Live
connect4_matchConnect 4✅ Live
racing_matchRacing✅ Live
bomberman_matchBombergang✅ Live
card_battleBattle Cards✅ Live
generic_matchScaffold✅ Live
… and 21 more

Critical Health Endpoints

  • Liveness: httpGet: / on port 7350 (30s delay, 10s period)
  • Readiness: httpGet: /healthcheck on port 7350 (5s delay, 5s period)
  • Metrics: Prometheus on port 9100

Database Configuration

PostgreSQL Namespace

  • Database: nakama (not funday!)
  • 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

1 item under this folder.