Some settings

This commit is contained in:
Frank
2026-01-03 13:16:58 +01:00
parent 0d6628e7c9
commit af61a3b920
23 changed files with 616 additions and 23 deletions

View File

@@ -1,6 +1,6 @@
# EscapePage — Online Escape Room
This repository contains a Symfony 7.3 (PHP >= 8.2) application for a collaborative online escape room experience.
This repository contains a Symfony 7.3 (PHP >= 8.5.1) application for a collaborative online escape room experience.
- Start here: doc/FILES.md — quick file index.
- Development standards and workflows: doc/CONTRIBUTING.md
@@ -76,3 +76,44 @@ Notes:
- Built files are ignored by git except for `public/build/.gitignore` to keep the directory.
See doc/CONTRIBUTING.md for code style and more details.
## Realtime updates with Mercure
We use a Mercure hub (Docker service) to push server updates to browsers via ServerSent Events (SSE).
Quick start (dev):
1. Start Docker stack from `docker/`:
```
docker compose up -d
```
This starts `mercure` at http://localhost:8090 and the app at http://localhost:8080.
2. Install PHP deps inside the PHP container if you haven't yet:
```
docker compose exec php bash
composer install
```
3. Open the Game Hub page in your browser: http://localhost:8080/game
- The page subscribes to a demo topic and logs messages in the console.
4. Publish a test update (in the PHP container):
```
php bin/console app:mercure:publish
```
You should see a console log like `[Mercure] Update received: { ... }` on the Game Hub page.
Configuration:
- Env vars (defined in `.env`, override in `.env.local` as needed):
- `MERCURE_URL=http://mercure/.well-known/mercure` (internal URL from PHP to the hub)
- `MERCURE_PUBLIC_URL=http://localhost:8090/.well-known/mercure` (browser URL)
- `MERCURE_JWT_SECRET=!ChangeThisMercureJWT!` (dev secret; do not use in prod)
- `MERCURE_TOPIC_BASE=https://escapepage.dev` (base topic URL)
- Docker service `mercure` is based on `dunglas/mercure` and allows anonymous subscribers in dev.
Topics:
- Topics must be URLs. We use `MERCURE_TOPIC_BASE` to control the domain per environment.
- Dev: `.env` sets `https://escapepage.dev`
- Prod: set `MERCURE_TOPIC_BASE=https://escapepage.com`
- The Game Hub demo topic is `${MERCURE_TOPIC_BASE}/game/hub`.
Production notes:
- Disable anonymous subscribers and require JWTs for subscriptions (configure the Mercure container accordingly).
- Use a strong, rotated `MERCURE_JWT_SECRET` and keep it out of VCS (use real env/secrets).
- Serve Mercure over HTTPS and set proper CORS/allowed origins for your production domain(s).