feat: use postgres
This commit is contained in:
+32
-14
@@ -6,10 +6,14 @@ and timestamps with values that match the deployment under inspection.
|
||||
## Example `.env`
|
||||
|
||||
A minimum-viable `LOBBY_*` set for a local run against a single Redis
|
||||
container. The full list with defaults lives in `../README.md` §Configuration.
|
||||
container plus a PostgreSQL container with the `lobby` schema and the
|
||||
`lobbyservice` role provisioned. The full list with defaults lives in
|
||||
`../README.md` §Configuration.
|
||||
|
||||
```bash
|
||||
LOBBY_REDIS_ADDR=127.0.0.1:6379
|
||||
LOBBY_REDIS_MASTER_ADDR=127.0.0.1:6379
|
||||
LOBBY_REDIS_PASSWORD=local
|
||||
LOBBY_POSTGRES_PRIMARY_DSN=postgres://lobbyservice:lobbyservice@127.0.0.1:5432/galaxy?search_path=lobby&sslmode=disable
|
||||
LOBBY_USER_SERVICE_BASE_URL=http://127.0.0.1:8083
|
||||
LOBBY_GM_BASE_URL=http://127.0.0.1:8096
|
||||
|
||||
@@ -19,7 +23,7 @@ LOBBY_INTERNAL_HTTP_ADDR=:8095
|
||||
LOBBY_LOG_LEVEL=info
|
||||
LOBBY_SHUTDOWN_TIMEOUT=30s
|
||||
|
||||
LOBBY_RACE_NAME_DIRECTORY_BACKEND=redis
|
||||
LOBBY_RACE_NAME_DIRECTORY_BACKEND=postgres
|
||||
LOBBY_ENROLLMENT_AUTOMATION_INTERVAL=30s
|
||||
LOBBY_RACE_NAME_EXPIRATION_INTERVAL=1h
|
||||
|
||||
@@ -115,16 +119,36 @@ curl -s http://localhost:8095/api/v1/internal/games/game-01HZ...
|
||||
curl -s http://localhost:8095/api/v1/internal/games/game-01HZ.../memberships
|
||||
```
|
||||
|
||||
## Redis Examples
|
||||
## Storage Inspection Examples
|
||||
|
||||
### Inspect a game record
|
||||
### Inspect a game record (PostgreSQL)
|
||||
|
||||
```bash
|
||||
redis-cli GET lobby:games:game-01HZ...
|
||||
psql "$LOBBY_POSTGRES_PRIMARY_DSN" -c \
|
||||
"SELECT * FROM lobby.games WHERE game_id = 'game-01HZ...'"
|
||||
```
|
||||
|
||||
The value is a strict JSON blob with the fields documented in
|
||||
`../README.md` §Game Record Model.
|
||||
The columns mirror the fields documented in `../README.md` §Game Record Model.
|
||||
|
||||
### Inspect open enrollment games (sorted by created_at)
|
||||
|
||||
```bash
|
||||
psql "$LOBBY_POSTGRES_PRIMARY_DSN" -c \
|
||||
"SELECT game_id, game_name, created_at FROM lobby.games
|
||||
WHERE status = 'enrollment_open'
|
||||
ORDER BY created_at DESC"
|
||||
```
|
||||
|
||||
### Inspect a Race Name Directory binding
|
||||
|
||||
```bash
|
||||
psql "$LOBBY_POSTGRES_PRIMARY_DSN" -c \
|
||||
"SELECT canonical_key, game_id, holder_user_id, race_name, binding_kind,
|
||||
source_game_id, eligible_until_ms, registered_at_ms
|
||||
FROM lobby.race_names WHERE race_name = 'Aurora'"
|
||||
```
|
||||
|
||||
## Redis Examples
|
||||
|
||||
### Publish a runtime job result (Runtime Manager simulation)
|
||||
|
||||
@@ -162,12 +186,6 @@ redis-cli XADD gm:lobby_events '*' \
|
||||
finished_at_ms 1714123456789
|
||||
```
|
||||
|
||||
### Inspect open enrollment games (sorted by created_at)
|
||||
|
||||
```bash
|
||||
redis-cli ZRANGE lobby:games_by_status:enrollment_open 0 -1 WITHSCORES
|
||||
```
|
||||
|
||||
## Notification Intent Format
|
||||
|
||||
Lobby produces every notification through `pkg/notificationintent` and
|
||||
|
||||
Reference in New Issue
Block a user