docs: Write up how to set up LiveKit calling #1354
No reviewers
Labels
No labels
Blocked
Bug
Cherry-picking
Database
Dependencies
Dependencies/Renovate
Difficulty
Easy
Difficulty
Hard
Difficulty
Medium
Documentation
Enhancement
Good first issue
Help wanted
Inherited
Matrix/Administration
Matrix/Appservices
Matrix/Auth
Matrix/Client
Matrix/Core
Matrix/Federation
Matrix/Hydra
Matrix/MSC
Matrix/Media
Meta
Meta/CI
Meta/Packaging
Priority
Blocking
Priority
High
Priority
Low
Security
Status
Confirmed
Status
Duplicate
Status
Invalid
Status
Needs Investigation
Support
To-Merge
Wont fix
old/ci/cd
old/rust
No project
No assignees
6 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
continuwuation/continuwuity!1354
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "jade/liveit-guide"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Any modification welcome
@ -0,0 +52,4 @@# - "50100-50200:50100-50200/udp"```Next, we need to configure LiveKit. In the same directory, create `livekit.yaml` with the following content - rememvering to replace `LK_MATRIX_KEY` and `LK_MATRIX_SECRET` with the values you generated!@ -0,0 +72,4 @@You will need to allow ports `7881/tcp` and `50100:50200/udp` through your firewall. If you use UFW, the commands are: `ufw allow 7881/tcp` and `ufw allow 50100:50200/udp`.Why is there an extra line here? There are a lot of extra lines throughout this, curious if intentional?
Mostly because I like spacing, so I add lots of new lines pretty much instictually while writing lol
Hmm, theres randomly two line breaks rather than one in a lot of places though.
If I was to actually write a style guide, I would probably put double line breaks before headings as one rule. However, effort.
@ -0,0 +79,4 @@Unfortunately Continuwuity doesn't yet provide an easy way to do this (We're working on it). You'll need to serve this file using your web server.Check the existing contents, and add the following (remembering to replace the URL with your one!)Meant to hit request changes ^^
@ -0,0 +15,4 @@:::warningElement X is known to not be able to do calls on Continwuity. [Track this bug to get updated when the issue is fixed](https://forgejo.ellis.link/continuwuation/continuwuity/issues/1306)this warning has newlines around the edges but the info in the other file does not
@ -0,0 +10,4 @@LiveKit should live on its own domain or subdomain. In this guide we use `livekit.example.com` - this should be replaced with a domain you control.Make sure the DNS record for the (dub)domain you plan to use is pointed to your server.@ -0,0 +112,4 @@- `/sfu/get`- `/healthz`- `/get_token`extra line
forgejos ui is confusing i keep hitting approve ^^
Thins maybe missing: explaining the practical differences, listed working clients, example reverse proxy configs, more detailed explainer about how the foci well-known works.
Can all be added later though
Last thing by me.
@ -0,0 +154,4 @@Livekit includes a built in TURN server which can be used in place of an external option. This TURN server will only work with Livekit, so you can't use it for legacy Matrix calling - or anything else.Extra line
@Jade wrote in #1354 (comment):
Yeah, example reverse proxy is definitely a good idea. I don't think more explanations about the well-known are needed personally.
BTW, do you want docker only here or should i add docs for nix too? (can do separately anyways)
@ -0,0 +14,4 @@### 2. ServicesUsing LiveKit with matrix requires two services - Livekit itself, and a service that grants Matrix users permission to connect to it."and a service called lk-jwt-service" for clarity i hope
Yeah, although that's not the only one - github.com/JadedBlueEyes/jwt-service-rs exists, ideally I want this integrated in the software at some point
@ -0,0 +16,4 @@Using LiveKit with matrix requires two services - Livekit itself, and a service that grants Matrix users permission to connect to it.You must generate a key and secret to allow the Matrix service to authenticate with LiveKit. `LK_MATRIX_KEY` should be around 20 random characters, and `LK_MATRIX_SECRET` should be around 64. Remember to replace these with the actual values!maybe use
docker run --rm livekit/livekit-server:latest generate-keysfor this step@ -0,0 +120,4 @@## Additional Configuration### TURN Integrationwould you wanna add a section to doc the builtin livekit TURN too? From my minimal setup, it's basically this:
and this
seems convenient for discorders to just need one software
Nix docks might belong in the nix deploying guide? This one relies on docker compose. Depends on the contents of the Nix guide and if it includes 'ignore everything prior' lol
@ -0,0 +2,4 @@Matrix supports two types of calls:- Element Call powered by MatrixRTC"MatrixRTC (most commonly Element Call)" is probably more technically correct
I don’t know, people are doing like whiteboards and stuff with MatrixRTC
Yeah I would say Jade is correct here.
I suggest "powered by MatrixRTC and Livekit" with links to both specs
@ -0,0 +10,4 @@For either one to work correctly, you have to do some additional setup.- For legacy calls to work, you need to set up a TURN/STUN server. [Read the TURN guide for tips on how to set up coturn](./calls/turn.mdx)- For MatrixRTC to work, you have to set up the LiveKit backend (foci). LiveKit also uses TURN/STUN to increase reliability, so you might want to configure your TURN server first. [Read the LiveKit guide](./calls/livekit.mdx)Might be worth mentioning that while LiveKit has its own TURN/STUN server, it will only work with LiveKit, so can't be re-used for legacy calls
@ -0,0 +35,4 @@- LIVEKIT_URL=wss://livekit.example.com- LIVEKIT_KEY=LK_MATRIX_KEY- LIVEKIT_SECRET=LK_MATRIX_SECRET- LIVEKIT_FULL_ACCESS_HOMESERVERS=yourdomain.comyourdomain.com->your.server.nameor something like that@ -0,0 +80,4 @@To tell clients where to find LiveKit, we need to modify the file served at `https://example.com/.well-known/matrix/client` (for example https://continuwuity.org/.well-known/matrix/client).Unfortunately Continuwuity doesn't yet provide an easy way to do this (We're working on it). You'll need to serve this file using your web server.Seems unnecessary
@ -0,0 +110,4 @@```### 4. Configure your Reverse ProxyThis section feels very rushed, akin to "then you just draw the rest of the owl". Perhaps some example configurations for caddy/nginx/traefik would be a good idea
FWIW:
@ -0,0 +181,4 @@- "50300-50400:50300-50400/udp"```### Related DocumentationShould probably link to the MatrixRTC proposal and the Element Call stuff
@ -0,0 +19,4 @@:::tip Generating a secure secretA common way to generate a suitable alphanumeric secret key is by using:```bashpwgen -s 64 1or
openssl rand -hex 64, which is usually installed by default on most systems@ -0,0 +72,4 @@### Security RecommendationsFor security best practices, see Synapse's [Coturn documentation](https://element-hq.github.io/synapse/latest/turn-howto.html), which includes important firewall and access control recommendations.Can't we just mirror that here? It's not like we're paying per word
@ -0,0 +120,4 @@```:::warningStatic credentials are less secure than shared secrets because they don't expire and must be configured in coturn separately. Use shared secret authentication.@ -0,0 +132,4 @@```:::cautionThis is not recommended as it allows unauthenticated users to access your TURN server, potentially enabling abuse by bots. All major Matrix clients support authenticated TURN access.@ -0,0 +112,4 @@### 4. Configure your Reverse ProxyReverse proxies can be configured in many different ways - so we can't provide a step by step for this.FWIW here's my minimal Caddyfile, working and tested live with Joop (Caddy on host)
It follows
LIVEKIT_URL=wss://livekit.example.comand serves everything from root dirKinda OT: maybe TURNS/:443 and other stuff (performance tuning, DNS tuning) could be in a separate Advanced section in the future
@ -0,0 +14,4 @@### 2. ServicesUsing LiveKit with matrix requires two services - Livekit itself, and a service (`lk-jwt-service`) that grants Matrix users permission to connect to it.s/matrix/Matrix
@ -0,0 +82,4 @@Unfortunately Continuwuity doesn't yet provide an easy way to do this (We're working on it). You'll need to serve this file using your web server.Check the existing content and add the following lines, remembering to replace the URL with your own matrix-rtc-jwt deployment:s/matrix-rtc-jwt/lk-jwt-service (?)
for consistency with current docs until new solutions arrive
I think this can be shortened to two paragraphs with code snippets inbetween. Example:
To tell clients where to find LiveKit, we need to modify the file served at https://example.com/.well-known/matrix/client (for example https://continuwuity.org/.well-known/matrix/client) to add the following fields
Unfortunately Continuwuity doesn't yet provide an easy way to do this (we're working on it!). So you'll need to serve a file like this using your web server:
(Maybe add Caddy configs here)
I think this should be possible now that #1356 has been done. The option as an environment variable should be:
CONTINUWUITY_RTC_FOCUS_SERVER_URLS = '[{ type = "livekit", livekit_service_url = "https://livekit.example.com" }]'but I haven't tested that.@ -0,0 +182,4 @@```### Related DocumentationImo this can be included, albeit they serve both services on subpaths
And the community's previous guides too
@ -0,0 +184,4 @@### Related Documentation- [LiveKit GitHub](https://github.com/livekit/livekit)- [LiveKit Connection Tester](https://livekit.io/connection-test) - use with the token returned by `/sfu/get` or `/get_token`This may be in a separate Testing section.
Furthermore, can you write steps (e.g. curl commands) to fetch such a token?
Alternatively, I've found this command to also provide a fitting token to test with this website
As noted elsewhere, !1370 and !1356 mean this needs a little bit of an update
642ed742aaee6bcc95ae@ -0,0 +12,4 @@- For legacy calls to work, you need to set up a TURN/STUN server. [Read the TURN guide for tips on how to set up coturn](./calls/turn.mdx)- For MatrixRTC to work, you have to set up the LiveKit backend (foci). LiveKit also uses TURN/STUN to increase reliability, so you might want to configure your TURN server first. [Read the LiveKit guide](./calls/livekit.mdx):::warningNo longer applicable now that !1370 is merged.
7d7c1b90c2cacd8681d1