mancala/apps/compose.yaml
Halit Aksoy f5dcf930fa feat(frontend): log in with Keycloak, as a guest or with an account
- First visit logs in as a new guest through Keycloak without a form;
  the session, including an offline refresh token, is kept in local storage
- Account menu on the home page: guests can log in or sign up, users can
  log out (which starts a new guest session)
- The WebSocket client in core authenticates with the access token after
  connecting, reports "connected" once the server accepts it, and re-sends
  renewed tokens on the open connection
- Game page shows player names; guests appear as "Guest 4F2A"
- Auth channels, AuthUser and player names in UserConnectionInfo move to
  core and the backend uses them from there
- Mobile keeps using userKey login for now
2026-10-14 02:22:13 +03:00

60 lines
2.1 KiB
YAML

services:
backend:
image: jhalitaksoy/mancala-backend:latest
build:
context: ..
dockerfile: apps/backend/Dockerfile
environment:
# Must match the iss claim, i.e. the public Keycloak URL; https://auth.playmancala.app/realms/mancala in production
KEYCLOAK_ISSUER: ${KEYCLOAK_HOSTNAME:-http://localhost:8080}/realms/mancala
# Fetch keys over the compose network instead of the public URL
KEYCLOAK_JWKS_URL: http://keycloak:8080/realms/mancala/protocol/openid-connect/certs
KEYCLOAK_CLIENT_IDS: mancala-web
LEGACY_USERKEY_AUTH: ${LEGACY_USERKEY_AUTH:-true}
ports:
- "5000:6000"
frontend:
image: jhalitaksoy/mancala-frontend:latest
build:
context: ..
dockerfile: apps/frontend/Dockerfile
args:
KEYCLOAK_URL: ${KEYCLOAK_HOSTNAME:-http://localhost:8080}
ports:
- "3000:3000"
keycloak-db:
image: postgres:17.6
environment:
POSTGRES_DB: keycloak
POSTGRES_USER: keycloak
POSTGRES_PASSWORD: ${KEYCLOAK_DB_PASSWORD:?set KEYCLOAK_DB_PASSWORD in apps/.env}
volumes:
- keycloak-db:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U keycloak -d keycloak"]
interval: 5s
timeout: 5s
retries: 10
keycloak:
image: jhalitaksoy/mancala-keycloak:latest
build: ./keycloak
environment:
KC_DB_URL: jdbc:postgresql://keycloak-db:5432/keycloak
KC_DB_USERNAME: keycloak
KC_DB_PASSWORD: ${KEYCLOAK_DB_PASSWORD}
# Public URL of Keycloak; https://auth.playmancala.app in production
KC_HOSTNAME: ${KEYCLOAK_HOSTNAME:-http://localhost:8080}
KC_HTTP_ENABLED: "true"
KC_PROXY_HEADERS: xforwarded
# Only used to create the master admin on the very first start
KC_BOOTSTRAP_ADMIN_USERNAME: ${KEYCLOAK_ADMIN_USERNAME:-admin}
KC_BOOTSTRAP_ADMIN_PASSWORD: ${KEYCLOAK_ADMIN_PASSWORD:?set KEYCLOAK_ADMIN_PASSWORD in apps/.env}
ports:
- "127.0.0.1:8080:8080"
depends_on:
keycloak-db:
condition: service_healthy
volumes:
keycloak-db: