Files
element_matrix_chat/docs/livekit-deployment.md
T
2025-11-11 00:54:43 +00:00

53 lines
3.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Element Call + LiveKit Deployment Notes
Resumen rápido de los pasos que seguimos para que Element Web use LiveKit como backend:
1. **Synapse listo para MatrixRTC**
- Listener HTTP con `resources: [client, federation, openid]`.
- Flags `experimental_features` (MSC3266/4222/4354), `max_event_delay_duration`, `rc_message` y `rc_delayed_event_mgmt` activados.
- Reinicio de `synapse` tras editar `synapse_data/homeserver.yaml`.
2. **Stack base en Docker**
- `docker-compose.yml` levanta Synapse, Element Web, Synapse Admin y el proxy `wellknown` (Nginx).
- El proxy sirve `/.well-known/...` y ahora también enruta `/livekit/jwt` y `/livekit/sfu`.
3. **Servicios LiveKit**
- `docker-compose.livekit.yml` inicia `livekit` y `livekit-jwt`.
- `configs/livekit/livekit.yaml` define puertos, región y las claves `LIVEKIT_API_KEY/SECRET`.
- `extra_hosts` para que `livekit` y `livekit-jwt` resuelvan `matrix-af2f3d...` y `matrix-rtc-320bd4...` al Traefik interno (`10.10.10.6`).
4. **Traefik / Coolify**
- Routers para:
- `element-a05ae4...` → contenedor Element Web.
- `matrix-af2f3d...` → Synapse + `/.well-known`.
- `matrix-rtc-320bd4...` → Nginx (`wellknown`) que reenvía a `livekit-jwt` y `livekit`.
- `call-681f3d...` → frontend Element Call (`element-call-web`).
- Middleware de redirección HTTPS y CORS (solo se permite `https://element-a05ae4...`).
5. **Element Call frontend**
- En `element-call/`: configuramos `config/config.organic-machine.json`, copiamos a `public/config.json` y ejecutamos `yarn install`, `yarn build`.
- El servicio `element-call-web` (Nginx) sirve `element-call/dist` y se expone como `https://call-681f3d.organic-machine.com`.
6. **Element Web**
- `element-config.json` habilita los labs (`feature_group_calls`, `feature_element_call_video_rooms`, etc.) y define `element_call.url``https://call-681f3d...`.
- Reiniciamos el contenedor para que sirviera el nuevo `config.json`.
7. **CORS y salud**
- Nginx responde 204 a los preflight y añade las cabeceras `Access-Control-Allow-*`.
- Traefik refuerza CORS para que solo el origen de Element Web pueda usar `/livekit/jwt` y `/livekit/sfu`.
- `livekit-jwt` valida tokens OpenID contra Synapse y crea salas vía Twirp en LiveKit.
8. **Dominios implicados**
- `matrix-af2f3d.organic-machine.com` Synapse y `.well-known`.
- `element-a05ae4.organic-machine.com` Element Web.
- `admin-0cc4d3.organic-machine.com` Synapse Admin.
- `call-681f3d.organic-machine.com` Element Call frontend.
- `matrix-rtc-320bd4.organic-machine.com` LiveKit JWT + SFU.
9. **Diagnóstico rápido**
- `sudo docker compose -f docker-compose.livekit.yml logs -f livekit-jwt livekit` tokens y salas.
- `sudo docker compose logs synapse | grep openid` emisión de OpenID.
- DevTools → Network → `livekit/jwt/sfu/get` debe responder 200 con CORS correcto.
Con todo esto, Element Web usa Element Call (widget) y LiveKit como backend SFU.