Adds tavolo.active_users and tavolo.ongoing_games gauges, process/CPython metrics via opentelemetry-instrumentation-system-metrics and OTLP log export. The game store tracks ongoing matches (Redis sorted set, in-memory set) and the session stores expose live counts for the gauges; a poller refreshes them since metric callbacks cannot await the stores.
83 lines
3.5 KiB
Bash
83 lines
3.5 KiB
Bash
# Database (match statistics). The app assembles the DSN from these
|
|
# parts; DATABASE_PORT may be left unset to use the driver default
|
|
# (5432 for Postgres). DATABASE_OPTIONS is a raw query string appended
|
|
# to the URL (e.g. ssl=require); leave empty for none.
|
|
DATABASE_ENGINE=postgres
|
|
DATABASE_HOST=localhost
|
|
DATABASE_PORT=5432
|
|
DATABASE_NAME=tavolo
|
|
DATABASE_USER=tavolo
|
|
DATABASE_PASSWORD=password
|
|
DATABASE_OPTIONS=
|
|
# Full-DSN override: when set, the parts above are ignored. Used by the
|
|
# test suite (sqlite://:memory:) and handy for managed-DB URLs.
|
|
#DATABASE_URL=postgres://tavolo:password@localhost:5432/tavolo
|
|
|
|
# OIDC (mock-oauth2-server in dev; it does not validate clients, so any
|
|
# client id/secret works. For a real IdP like Keycloak, use its values here.)
|
|
OIDC_ISSUER=http://localhost:8180/tavolo
|
|
OIDC_CLIENT_ID=tavolo
|
|
OIDC_CLIENT_SECRET=dev-secret
|
|
OIDC_REDIRECT_URI=http://localhost:8080/auth/callback
|
|
|
|
# Redis (session and live-game storage). Unset to fall back to in-memory
|
|
# stores (only sensible for local development with a single worker).
|
|
REDIS_URL=redis://localhost:6379/0
|
|
|
|
# How long a live game survives in Redis without activity.
|
|
GAME_TTL_SECONDS=86400
|
|
|
|
# Seconds the between-hands scoring summary waits for acknowledgements
|
|
# before dealing the next hand anyway.
|
|
HAND_ACK_TIMEOUT_SECONDS=30
|
|
|
|
# Seconds a player has to play before the server plays a random legal card
|
|
# for them (covers disconnects and idle players).
|
|
TURN_TIMEOUT_SECONDS=30
|
|
|
|
# Path to a YAML logging configuration file (logging.config.dictConfig
|
|
# schema). Unset logs DEBUG to the console.
|
|
#LOGGING_CONFIG=/path/to/logging.yaml
|
|
|
|
# CORS (via kaya-cors' CorsMixin; same semantics as Starlette's
|
|
# CORSMiddleware). Disabled unless CORS_ALLOW_ORIGINS or
|
|
# CORS_ALLOW_ORIGIN_REGEX is set — the app serves the SPA and the API from
|
|
# the same origin, so no CORS headers are needed by default.
|
|
# Comma-separated list of origins allowed to make cross-origin requests,
|
|
# or "*" for any origin:
|
|
#CORS_ALLOW_ORIGINS=https://example.com,https://app.example.com
|
|
# Optional regex (fullmatch) allowed origins are additionally checked
|
|
# against — handy for dynamic preview URLs:
|
|
#CORS_ALLOW_ORIGIN_REGEX=https://tavolo-[a-z0-9-]+\.vercel\.app
|
|
# Comma-separated allowed methods, or "*" for all (default GET):
|
|
#CORS_ALLOW_METHODS=GET,POST
|
|
# Comma-separated allowed request headers, or "*" to mirror back whatever
|
|
# the browser requests (default: only the CORS-safelisted headers):
|
|
#CORS_ALLOW_HEADERS=Authorization,Content-Type
|
|
# Allow cookies/credentials on cross-origin requests (1/true/yes/on):
|
|
#CORS_ALLOW_CREDENTIALS=false
|
|
# Comma-separated response headers exposed to the browser:
|
|
#CORS_EXPOSE_HEADERS=
|
|
# Seconds browsers may cache the preflight response (default 600):
|
|
#CORS_MAX_AGE=600
|
|
|
|
# OpenTelemetry (via kaya-otel + the contrib system-metrics package). Off
|
|
# unless OTEL_ENABLED is truthy; exports traces, HTTP/app/process metrics
|
|
# and logs over OTLP/HTTP (requires the tavolo-app "otel" extra, bundled
|
|
# in the Docker image). The endpoint defaults to the standard
|
|
# OTEL_EXPORTER_OTLP_ENDPOINT (localhost:4318) when unset.
|
|
#OTEL_ENABLED=true
|
|
#OTEL_SERVICE_NAME=tavolo
|
|
#OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318
|
|
#OTEL_EXPORTER_OTLP_HEADERS=Authorization=Bearer token,X-Tenant=one
|
|
# Paths excluded from tracing and metrics (default /api/health).
|
|
#OTEL_EXCLUDED_PATHS=/api/health
|
|
# Metric export interval (ms, default 60000) and session/game count poll
|
|
# interval (seconds, default 15).
|
|
#OTEL_METRIC_EXPORT_INTERVAL_MILLIS=60000
|
|
#OTEL_METRICS_POLL_INTERVAL_SECONDS=15
|
|
|
|
# App server
|
|
APP_HOST=0.0.0.0
|
|
APP_PORT=8080
|