Skip to content

Commit 640ba8b

Browse files
authored
Merge pull request #2719 from element-hq/fkwp/docker_compose_non_hostnetwork
docker compose non hostnetwork setup
2 parents 938becc + 34abca0 commit 640ba8b

12 files changed

+346
-93
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ dist-ssr
66
*.local
77
.idea/
88
public/config.json
9+
backend/synapse_tmp/*
910
/coverage
1011
yarn-error.log

README.md

Lines changed: 100 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,24 @@
33
[![Chat](https://img.shields.io/matrix/webrtc:matrix.org)](https://matrix.to/#/#webrtc:matrix.org)
44
[![Localazy](https://img.shields.io/endpoint?url=https%3A%2F%2Fconnect.localazy.com%2Fstatus%2Felement-call%2Fdata%3Fcontent%3Dall%26title%3Dlocalazy%26logo%3Dtrue)](https://localazy.com/p/element-call)
55

6-
Group calls with WebRTC that leverage [Matrix](https://matrix.org) and an open-source WebRTC toolkit from [LiveKit](https://livekit.io/).
6+
Group calls with WebRTC that leverage [Matrix](https://matrix.org) and an
7+
open-source WebRTC toolkit from [LiveKit](https://livekit.io/).
78

8-
For prior version of the Element Call that relied solely on full-mesh logic, check [`full-mesh`](https://github.com/element-hq/element-call/tree/full-mesh) branch.
9+
For prior version of the Element Call that relied solely on full-mesh logic,
10+
check [`full-mesh`](https://github.com/element-hq/element-call/tree/full-mesh)
11+
branch.
912

1013
![A demo of Element Call with six people](demo.jpg)
1114

12-
To try it out, visit our hosted version at [call.element.io](https://call.element.io). You can also find the latest development version continuously deployed to [call.element.dev](https://call.element.dev/).
15+
To try it out, visit our hosted version at
16+
[call.element.io](https://call.element.io). You can also find the latest
17+
development version continuously deployed to
18+
[call.element.dev](https://call.element.dev/).
1319

1420
## Host it yourself
1521

16-
Until prebuilt tarballs are available, you'll need to build Element Call from source. First, clone and install the package:
22+
Until prebuilt tarballs are available, you'll need to build Element Call from
23+
source. First, clone and install the package:
1724

1825
```
1926
git clone https://github.com/element-hq/element-call.git
@@ -22,17 +29,23 @@ yarn
2229
yarn build
2330
```
2431

25-
If all went well, you can now find the build output under `dist` as a series of static files. These can be hosted using any web server that can be configured with custom routes (see below).
32+
If all went well, you can now find the build output under `dist` as a series of
33+
static files. These can be hosted using any web server that can be configured
34+
with custom routes (see below).
2635

27-
You may also wish to add a configuration file (Element Call uses the domain it's hosted on as a Homeserver URL by default,
28-
but you can change this in the config file). This goes in `public/config.json` - you can use the sample as a starting point:
36+
You may also wish to add a configuration file (Element Call uses the domain it's
37+
hosted on as a Homeserver URL by default, but you can change this in the config
38+
file). This goes in `public/config.json` - you can use the sample as a starting
39+
point:
2940

3041
```
3142
cp config/config.sample.json public/config.json
3243
# edit public/config.json
3344
```
3445

35-
Because Element Call uses client-side routing, your server must be able to route any requests to non-existing paths back to `/index.html`. For example, in Nginx you can achieve this with the `try_files` directive:
46+
Because Element Call uses client-side routing, your server must be able to route
47+
any requests to non-existing paths back to `/index.html`. For example, in Nginx
48+
you can achieve this with the `try_files` directive:
3649

3750
```
3851
server {
@@ -44,28 +57,63 @@ server {
4457
}
4558
```
4659

47-
By default, the app expects you to have a Matrix homeserver (such as [Synapse](https://element-hq.github.io/synapse/latest/setup/installation.html)) installed locally and running on port 8008. If you wish to use a homeserver on a different URL or one that is hosted on a different server, you can add a config file as above, and include the homeserver URL that you'd like to use.
60+
By default, the app expects you to have a Matrix homeserver (such as
61+
[Synapse](https://element-hq.github.io/synapse/latest/setup/installation.html))
62+
installed locally and running on port 8008. If you wish to use a homeserver on a
63+
different URL or one that is hosted on a different server, you can add a config
64+
file as above, and include the homeserver URL that you'd like to use.
4865

49-
Element Call requires a homeserver with registration enabled without any 3pid or token requirements, if you want it to be used by unregistered users. Furthermore, it is not recommended to use it with an existing homeserver where user accounts have joined normal rooms, as it may not be able to handle those yet and it may behave unreliably.
66+
Element Call requires a homeserver with registration enabled without any 3pid or
67+
token requirements, if you want it to be used by unregistered users.
68+
Furthermore, it is not recommended to use it with an existing homeserver where
69+
user accounts have joined normal rooms, as it may not be able to handle those
70+
yet and it may behave unreliably.
5071

51-
Therefore, to use a self-hosted homeserver, this is recommended to be a new server where any user account created has not joined any normal rooms anywhere in the Matrix federated network. The homeserver used can be setup to disable federation, so as to prevent spam registrations (if you keep registrations open) and to ensure Element Call continues to work in case any user decides to log in to their Element Call account using the standard Element app and joins normal rooms that Element Call cannot handle.
72+
Therefore, to use a self-hosted homeserver, this is recommended to be a new
73+
server where any user account created has not joined any normal rooms anywhere
74+
in the Matrix federated network. The homeserver used can be setup to disable
75+
federation, so as to prevent spam registrations (if you keep registrations open)
76+
and to ensure Element Call continues to work in case any user decides to log in
77+
to their Element Call account using the standard Element app and joins normal
78+
rooms that Element Call cannot handle.
5279

5380
## Configuration
5481

55-
There are currently two different config files. `.env` holds variables that are used at build time, while `public/config.json` holds variables that are used at runtime. Documentation and default values for `public/config.json` can be found in [ConfigOptions.ts](src/config/ConfigOptions.ts).
82+
There are currently two different config files. `.env` holds variables that are
83+
used at build time, while `public/config.json` holds variables that are used at
84+
runtime. Documentation and default values for `public/config.json` can be found
85+
in [ConfigOptions.ts](src/config/ConfigOptions.ts).
5686

57-
If you're using [Synapse](https://github.com/element-hq/synapse/), you'll need to additionally add the following to `homeserver.yaml` or Element Call won't work:
87+
If you're using [Synapse](https://github.com/element-hq/synapse/), you'll need
88+
to additionally add the following to `homeserver.yaml` or Element Call won't
89+
work:
5890

5991
```
6092
experimental_features:
93+
# MSC3266: Room summary API. Used for knocking over federation
6194
msc3266_enabled: true
95+
96+
# The maximum allowed duration by which sent events can be delayed, as
97+
# per MSC4140.
98+
max_event_delay_duration: 24h
99+
100+
rc_message:
101+
# This needs to match at least the heart-beat frequency plus a bit of headroom
102+
# Currently the heart-beat is every 5 seconds which translates into a rate of 0.2s
103+
per_second: 0.5
104+
burst_count: 30
62105
```
63106

64-
MSC3266 allows to request a room summary of rooms you are not joined.
65-
The summary contains the room join rules. We need that to decide if the user gets prompted with the option to knock ("ask to join"), a cannot join error or the join view.
107+
MSC3266 allows to request a room summary of rooms you are not joined. The
108+
summary contains the room join rules. We need that to decide if the user gets
109+
prompted with the option to knock ("ask to join"), a cannot join error or the
110+
join view.
66111

67-
Element Call requires a Livekit SFU behind a Livekit jwt service to work. The url to the Livekit jwt service can either be configured in the config of Element Call (fallback/legacy configuration) or be configured by your homeserver via the `.well-known`.
68-
This is the recommended method.
112+
Element Call requires a Livekit SFU alongside a [Livekit JWT
113+
service](https://github.com/element-hq/lk-jwt-service) to work. The url to the
114+
Livekit JWT service can either be configured in the config of Element Call
115+
(fallback/legacy configuration) or be configured by your homeserver via the
116+
`.well-known/matrix/client`. This is the recommended method.
69117

70118
The configuration is a list of Foci configs:
71119

@@ -88,13 +136,18 @@ The configuration is a list of Foci configs:
88136

89137
## Translation
90138

91-
If you'd like to help translate Element Call, head over to [Localazy](https://localazy.com/p/element-call). You're also encouraged to join the [Element Translators](https://matrix.to/#/#translators:element.io) space to discuss and coordinate translation efforts.
139+
If you'd like to help translate Element Call, head over to
140+
[Localazy](https://localazy.com/p/element-call). You're also encouraged to join
141+
the [Element Translators](https://matrix.to/#/#translators:element.io) space to
142+
discuss and coordinate translation efforts.
92143

93144
## Development
94145

95146
### Frontend
96147

97-
Element Call is built against [matrix-js-sdk](https://github.com/matrix-org/matrix-js-sdk/pull/2553). To get started, clone, install, and link the package:
148+
Element Call is built against
149+
[matrix-js-sdk](https://github.com/matrix-org/matrix-js-sdk/pull/2553). To get
150+
started, clone, install, and link the package:
98151

99152
```
100153
git clone https://github.com/matrix-org/matrix-js-sdk.git
@@ -112,6 +165,15 @@ yarn
112165
yarn link matrix-js-sdk
113166
```
114167

168+
To use it, create a local config by, e.g., `cp ./config/config.devenv.json
169+
./public/config.json` and adapt it if necessary. The `config.devenv.json` config
170+
should work with the backend development environment as outlined in the next
171+
section out of box.
172+
173+
(Be aware, that this `config.devenv.json` is exposing a deprecated fallback
174+
LiveKit config key. If the homeserver advertises SFU backend via
175+
`.well-known/matrix/client` this has precedence.)
176+
115177
You're now ready to launch the development server:
116178

117179
```
@@ -120,25 +182,25 @@ yarn dev
120182

121183
### Backend
122184

123-
A docker compose file is provided to start a LiveKit server and auth
124-
service for development. These use a test 'secret' published in this
125-
repository, so this must be used only for local development and
126-
**_never be exposed to the public Internet._**
185+
A docker compose file `dev-backend-docker-compose.yml` is provided to start the
186+
whole stack of components which is required for a local development environment:
127187

128-
To use it, add a SFU parameter in your local config `./public/config.json`:
129-
(Be aware, that this is only the fallback Livekit SFU. If the homeserver
130-
advertises one in the client well-known, this will not be used.)
188+
- Minimum Synapse Setup (servername: synapse.localhost)
189+
- LiveKit JWT Service (Note requires Federation API and hence a TLS reverse proxy)
190+
- Minimum TLS reverse proxy (servername: synapse.localhost) Note certificates
191+
are valid for at least 10 years from now
192+
- Minimum LiveKit SFU Setup using dev defaults for config
193+
- Redis db for completness
131194

132-
```json
133-
"livekit": {
134-
"livekit_service_url": "http://localhost:7881"
135-
},
136-
```
195+
These use a test 'secret' published in this repository, so this must be used
196+
only for local development and **_never be exposed to the public Internet._**
137197

138198
Run backend components:
139199

140200
```
141201
yarn backend
202+
# or for podman-compose
203+
# podman-compose -f dev-backend-docker-compose.yml up
142204
```
143205

144206
### Test Coverage
@@ -150,22 +212,25 @@ yarn backend
150212
To add a new translation key you can do these steps:
151213

152214
1. Add the new key entry to the code where the new key is used: `t("some_new_key")`
153-
1. Run `yarn i18n` to extract the new key and update the translation files. This will add a skeleton entry to the `public/locales/en-GB/app.json` file:
215+
1. Run `yarn i18n` to extract the new key and update the translation files. This
216+
will add a skeleton entry to the `public/locales/en-GB/app.json` file:
154217
```jsonc
155218
{
156219
...
157220
"some_new_key": "",
158221
...
159222
}
160223
```
161-
1. Update the skeleton entry in the `public/locales/en-GB/app.json` file with the English translation:
162-
```jsonc
224+
1. Update the skeleton entry in the `public/locales/en-GB/app.json` file with
225+
the English translation:
226+
227+
```jsonc
163228
{
164229
...
165230
"some_new_key": "Some new key",
166231
...
167232
}
168-
```
233+
```
169234

170235
## Documentation
171236

backend-docker-compose.yml

Lines changed: 0 additions & 52 deletions
This file was deleted.

backend/dev_homeserver.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
server_name: "synapse.localhost"
2+
public_baseurl: http://synapse.localhost:8008/
3+
4+
pid_file: /data/homeserver.pid
5+
6+
listeners:
7+
- port: 8008
8+
tls: false
9+
type: http
10+
x_forwarded: true
11+
resources:
12+
- names: [client, federation, openid]
13+
compress: false
14+
15+
database:
16+
name: sqlite3
17+
args:
18+
database: /data/homeserver.db
19+
20+
media_store_path: /data/media_store
21+
signing_key_path: "/data/SERVERNAME.signing.key"
22+
trusted_key_servers:
23+
- server_name: "matrix.org"
24+
25+
experimental_features:
26+
# MSC3266: Room summary API. Used for knocking over federation
27+
msc3266_enabled: true
28+
29+
# The maximum allowed duration by which sent events can be delayed, as
30+
# per MSC4140. Must be a positive value if set. Defaults to no
31+
# duration (null), which disallows sending delayed events.
32+
max_event_delay_duration: 24h
33+
34+
# Ratelimiting settings for client actions (registration, login, messaging).
35+
#
36+
# Each ratelimiting configuration is made of two parameters:
37+
# - per_second: number of requests a client can send per second.
38+
# - burst_count: number of requests a client can send before being throttled.
39+
40+
rc_message:
41+
# This needs to match at least the heart-beat frequency plus a bit of headroom
42+
# Currently the heart-beat is every 5 seconds which translates into a rate of 0.2s
43+
per_second: 0.5
44+
burst_count: 30
45+
46+
# Required for Element Call in Single Page Mode due to on-the-fly user registration
47+
enable_registration: true
48+
enable_registration_without_verification: true
49+
50+
report_stats: false
51+
serve_server_wellknown: true
File renamed without changes.

backend/tls_localhost_cert.pem

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIIDtzCCAp+gAwIBAgIUCmJjl3HAeLmrPwRg+/OzikW6peQwDQYJKoZIhvcNAQEL
3+
BQAwazELMAkGA1UEBhMCR0IxDz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O5SnhhgTWNoVZk93qXuuWEN0yacw7c3Fr1IvFYYYWufbXTk70dbZihPDK
20+
VD141o8tpp6FerSKHNYDqkVFDyTz3DVOhQQJ59zfMre7bFr+PpTTl4vIuGzXEY+E
21+
HPjUSlOzwkCoh5fu7Fs3qG55rJt8akhTEoKpiBTaLucgAjVWNHeci1+Yxg==
22+
-----END CERTIFICATE-----

backend/tls_localhost_key.pem

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
-----BEGIN PRIVATE KEY-----
2+
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCzfrwTEtK50/yW
3+
42hjlR9o+oFJUlQ9gGL4kbJ3fq3I3vmnk4jvFJ8dO21DG4PgqsTEEU8LyYCETV6h
4+
k8FUE5kngVhYEl8xpCcKN6pT6Vo/fq13rmRIlhtRiUpgfVanESkJ2DHBY4qQ/+Q9
5+
flhdtio4PH1oEleChPfIAlbsCeIigv54sWdL1ejzpM+oIMFMlT2hzAqA8gMuEO/r
6+
TvbiuFlPWRsansQKpGi+d2gNNCO7CzYPfI0x9D7iutAY9ccaY/k9xpHRHu654H7o
7+
A/ILswlu6FvHGD/4MUetGLeUmyDDG6HaGL/69bDzOAqWBgjAcUD1fSVxfRSVB0Q0
8+
wfduBwYjAgMBAAECggEACTqdSExxzJ+LX5ARFaWyOBSWly2GKqSyR14+aInOklhx
9+
9QgkmfOxJrCf3TvJ8RWhXloW0Aqr8qGDxG0Ixgjn7rG7gskXCey1xn8MNppLS0kj
10+
ztaG+NB3AR89ABm8XdoHsSY45geh3/Ni9I0i1VardGQafUJhgNLTZqjwIodzkBtJ
11+
S/bi4uFk1lGNfuvWQvWqzGXUvd1l1YupV6iA4GfhXlUvrSBZwftLBD6xEvQaSqsA
12+
pHvBxTfMXG4RMAkNPDIElkuQ8++CGi1gIRkJfmrv4OgbbitteMnxqqqGYV0zSNCg
13+
R/5FG6umIV7lDLBHZCSCk7wmf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