MiroTalk LK production deployment
On a fresh Ubuntu server, Self-hosting does all of this with one script (Docker, Nginx and Let's Encrypt), and has update and uninstall scripts too.
- Point two DNS records at your server, e.g.
meet.example.comandlivekit.example.com. - Generate LiveKit keys:
Bash
docker run --rm livekit/livekit-server:v1.13.11 generate-keys - Configure
.env:ININODE_ENV=production TRUST_PROXY=true LIVEKIT_URL=wss://livekit.example.com LIVEKIT_API_KEY=<generated key> LIVEKIT_API_SECRET=<generated secret> LIVEKIT_NODE_IP=<server public IP> - Start the app and LiveKit:
Bash
docker compose up -d --build - Put HTTPS in front (required for camera/mic/screen access). See Caddyfile.example for an automatic-TLS reverse proxy.
- Open firewall ports:
80/tcp,443/tcp,7881/tcp(ICE/TCP) and7882/udp(WebRTC media). Keep3030,6379and7880closed to the internet (Caddy proxies them).docker-compose.ymlpublishes the app on127.0.0.1only (APP_BIND_ADDRESS), since ports Docker publishes bypass host firewalls such as ufw. - Optional: set
HOST_USERSand/or single sign-on (OIDC_*) so only your hosts can start meetings (see Host sign-in).
To enable recording, see Recording; for live streaming, see Live streaming; for live captions, see Live captions; to notify other systems, see Webhooks.
Production checklist
NODE_ENV=production, a generatedLIVEKIT_API_SECRET(≥ 32 chars),TRUST_PROXY=truebehind the proxy, HTTPS for both domains.- The app must only be reachable through the proxy: with
TRUST_PROXY=true, a client reaching it directly could setX-Forwarded-Forto dodge the per-IP rate limits. To be safe even then, list the proxy's addresses instead, e.g.TRUST_PROXY=loopback, uniquelocal(a proxy on the same machine or Docker network). HOST_USERSor single sign-on (OIDC_*) set on public servers (otherwise anyone with the URL can start meetings and recordings).- Image versions are pinned in the compose files; upgrade them deliberately (read the LiveKit release notes first).
- Fix any warning the app logs at startup (e.g.
TRUST_PROXYoff, or streaming withoutSTREAMING_ALLOWED_HOSTS). - Logs are JSON lines on stdout/stderr (
docker compose logs app), one line per API request plus errors; ship them to your log stack if you have one. Each API request has an id (requestId, sent back in theX-Request-Idheader, or taken from your proxy's), also in500answers, so a user's report can be found in the logs. - Privacy: request log lines include the client's IP address (for rate limits and abuse). If your privacy policy needs it, keep logs only briefly, or set
LOG_LEVEL=warnto log only failed requests. Error reports never include IPs, cookies or request bodies. GET /healthzis used by the Docker healthcheck; point your uptime monitor at it too. Load balancers should useGET /readyz(see Monitoring).- One app instance by default. Rate limits, per-room locks, the waiting room and in-browser recording uploads in progress are kept in memory (and uploads on local disk); this is ideal for one VPS. A restart drops the waiting room (guests ask again) and saves uploads in progress as they are. To run several instances behind a load balancer, set
SCALING_MODE=distributedso they share this state in Redis (see Scaling). - Host passwords in
HOST_USERScan be stored hashed (docker compose run --rm app node src/cli/hash-password.ts, see Host sign-in). - Set
OG_URL(link previews) and, with single sign-on,OIDC_REDIRECT_URLto your publichttps://address, so neither is built from the request'sHostheader.
Monitoring
| Endpoint | Use |
|---|---|
GET /healthz |
Liveness: the app process is up. Used by the Docker healthcheck; never depends on LiveKit. |
GET /readyz |
Readiness: 200 when LiveKit's server API (and Redis, when distributed) also answers, 503 otherwise |
GET /metrics |
Prometheus metrics, when METRICS_ENABLED=true. Protect it with METRICS_TOKEN or block it publicly. |
The app asks LiveKit at most every 5 seconds (shared by /readyz and /metrics), so frequent checks don't add load. Metrics:
| Metric | Type | Description |
|---|---|---|
mirotalk_livekit_up |
gauge | 1 if the LiveKit server API is reachable, 0 if not |
mirotalk_rooms |
gauge | Meetings currently open (omitted while LiveKit is unreachable) |
mirotalk_participants |
gauge | Participants across all meetings, as counted by LiveKit |
mirotalk_egress_jobs{status} |
gauge | Recording and live streaming jobs by status (starting, active, ending); only with recording or streaming on |
mirotalk_live_streams |
gauge | Meetings being streamed live; only with recording or streaming on |
process_*, nodejs_* |
– | Standard Node.js process metrics (CPU, memory, event loop lag, GC, handles) |
Example Prometheus scrape config (scraping the app directly on the Docker network or host, not through Caddy):
scrape_configs:
- job_name: mirotalk-lk
authorization:
credentials: <METRICS_TOKEN>
static_configs:
- targets: ['app:3030']
LiveKit can expose its own, more detailed Prometheus metrics too (add prometheus_port to livekit.yaml).
Error tracking
Server errors can be sent to any service that accepts the Sentry SDK: Sentry (cloud or self-hosted), Better Stack Errors or GlitchTip. Create a project, copy its DSN and set it:
SENTRY_DSN=https://<key>@<host>/<project-id>
Only the DSN changes between services. Every error the server logs is reported (LiveKit API failures, failed recordings or webhooks, unexpected 500s and crashes) with its stack trace, tagged with the logger scope and the release (mirotalk-lk@<version>). Before a crash restarts the container, pending reports are flushed for up to 2 seconds.
Reports never include cookies, request bodies, query strings, Authorization headers or client IPs, and outgoing request breadcrumbs keep only the target's origin. Performance tracing is not enabled. With SENTRY_DSN empty, the SDK is not loaded at all.
Analytics
For visitor statistics, point the app at a Umami instance (self-hosted or Umami Cloud) or any tracker that takes the same data-website-id attribute:
STATS_ENABLED=true
STATS_SRC=https://stats.example.com/script.js
STATS_ID=<website id from Umami>
The script is added to every page and its origin is allowed in the Content-Security-Policy (script-src and connect-src). Query strings and hashes are excluded (data-exclude-search, data-exclude-hash), so room names are never sent to the analytics server.
Link previews
Shared meeting links show a preview card (title, description and image) in chat apps and social networks, from Open Graph and Twitter Card tags added to the page. They are on by default with the MiroTalk LK texts and public/images/og-image.jpg. To rebrand a self-hosted instance:
OG_URL=https://meet.example.com
OG_SITE_NAME=Acme Meet
OG_TITLE=Acme Meet
OG_DESCRIPTION=Video meetings for the Acme team.
OG_IMAGE=https://cdn.example.com/acme-og.jpg
OG_IMAGE_ALT=Acme Meet
OG_TWITTER_SITE=@acme
OG_IMAGE can also be a path on this server, e.g. /images/acme-og.jpg (mount it into public/images/).
Crawlers need absolute URLs: without OG_URL they're built from the address the page was requested on (set TRUST_PROXY=true behind a reverse proxy so it's https://). The preview always points to the home page, so room names in shared links are never included. Use an image of about 1200×630 (or 2:1). Set OG_ENABLED=false to leave the tags out.
The name and icon of the installable app come from public/manifest.webmanifest and the PNG icons in public/images/brand (192×192 and 512×512, a 512×512 maskable one with the logo inside the centre 80%, and a 180×180 apple-touch-icon.png for iOS). To rebrand them, mount your own files over those (and change apple-mobile-web-app-title in public/index.html).
Embedding in other apps
By default only this site can show the app in an <iframe>. To put meetings into another web app, allow that app's origin (exact scheme://host[:port], comma-separated, https:// in production):
EMBED_ALLOWED_ORIGINS=https://app.example.com,https://crm.example.com
The origins are added to the Content-Security-Policy's frame-ancestors. X-Frame-Options is left out because it can't list origins. In the other app, let the iframe use the camera, microphone and screen sharing:
<iframe
src="https://meet.example.com/?room=team-sync"
allow="camera; microphone; display-capture; fullscreen; autoplay; clipboard-write"
style="width: 100%; height: 720px; border: 0"
></iframe>
Guests can join as usual. Host sign-in (HOST_USERS / OIDC) uses a SameSite=Lax cookie, which browsers don't send inside an iframe on another site, and most sign-in providers can't be shown in an iframe. So meetings that need a signed-in host should be started outside the iframe.
Restrictive networks (TURN/TLS, optional)
WebRTC media normally uses UDP 7882 and falls back to TCP 7881, which covers almost everyone. Networks that only allow HTTPS (some corporate firewalls) need TURN over TLS on port 443. LiveKit always advertises it as turns:<TURN_DOMAIN>:443, so it needs its own domain and has to share port 443 with the app.
docker-compose.turn.yml does this using LiveKit's single-server layout: a Layer-4 Caddy owns ports 80/443, routes each domain (app, LiveKit, TURN) and gets the certificates automatically, while all services use host networking. It replaces Caddyfile.example, so stop any other web server on 80/443 first.
- Add a DNS record for the TURN domain (e.g.
turn.example.com) pointing at the same server. - In
.envsetAPP_DOMAIN,LIVEKIT_DOMAIN,TURN_DOMAIN(plus the usualLIVEKIT_URL=wss://<LIVEKIT_DOMAIN>,LIVEKIT_NODE_IP,TRUST_PROXY=true). - Start it (add
--profile recordingfor recording or live streaming,--profile captionsand--profile whisperfor captions):Bashdocker compose -f docker-compose.yml -f docker-compose.turn.yml up -d --build - Firewall: open
80/tcp,443/tcp,7881/tcp,7882/udpand3478/udp(TURN/UDP); keep3030,5349,6379,7880,8000,8080and8081closed.
Requires a Linux host (host networking) and Docker Compose 2.24+. For multi-node deployments see Scaling.
To see what a network allows, open the lobby there and click Test your connection: it shows whether media goes direct over UDP, over TCP or through the TURN relay and, when nothing else gets through, whether TURN is set up and reachable.