Skip to content

Commit 481701d

Browse files
committed
Merge remote-tracking branch 'rexbron/podman-docs'
2 parents ea8961a + 026cb69 commit 481701d

File tree

10 files changed

+211
-7
lines changed

10 files changed

+211
-7
lines changed

docs/SUMMARY.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@
33
- [Introduction](introduction.md)
44
- [Configuration](configuration.md)
55
- [Examples](configuration/examples.md)
6+
- [OpenID Connect](configuration/openid-connect.md)
67
- [Deploying](deploying.md)
78
- [Generic](deploying/generic.md)
89
- [Reverse Proxy - Caddy](deploying/reverse-proxy-caddy.md)
910
- [Reverse Proxy - Nginx](deploying/reverse-proxy-nginx.md)
1011
- [Reverse Proxy - Traefik](deploying/reverse-proxy-traefik.md)
1112
- [Example: root domain delegation](deploying/root-domain-delegation.md)
1213
- [NixOS](deploying/nixos.md)
13-
- [Docker](deploying/docker.md)
14+
- [Containers](deploying/containers.md)
15+
- [Docker](deploying/docker.md)
16+
- [Podman](deploying/podman-systemd.md)
1417
- [Kubernetes](deploying/kubernetes.md)
1518
- [Arch Linux](deploying/arch-linux.md)
1619
- [Debian](deploying/debian.md)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# OpenID Connect / OIDC
2+
3+
## Keycloak
4+
5+
Keycloak is a self-hostable OpenID Connect provider.
6+
7+
> Ensure your matrix .well-known values are being served correctly before beginning. Such as with [matrixtest](../troubleshooting.md#matrixrtc-testing-tools)
8+
9+
### Keycloak configuration
10+
11+
1. Create client on your keycloak server:
12+
- Ensure `Client Authentication` is toggled `on`
13+
- Root Url = `https://<your.matrix.example.com>`
14+
- Valid Redirect Urls = `https://<your.matrix.tld.example.com>/_matrix/client/unstable/login/sso/callback/<client_id>`
15+
- Web Origins = `https://<your.matrix.example.com>`
16+
2. Navigate to the Client Credentials tab, note the value of `client secret`
17+
3. Note the `realm` you are creating the client in.
18+
19+
### Tuwunel configuration
20+
21+
Add the following identity provider section to you tuwunel.toml config file. Replace the `< placeholders>` with the values noted in your keycloak `client`.
22+
23+
#### tuwunel.toml
24+
```toml
25+
26+
[[global.identity_provider]]
27+
brand = 'keycloak'
28+
client_id = '<client_id_in_keycloak>'
29+
client_secret = '<client_secret_from_credentials_tab_in_keycloak>'
30+
issuer_url = 'https://<your.keycloak.example.com>/realms/<realm_name>'
31+
```
32+
#### Environment variables
33+
Example Environment variables that can be added to a `docker-compose.yaml` or podman `tuwunel.env` if preferred:
34+
35+
```env
36+
TUWUNEL_IDENTITY_PROVIDER__0__BRAND="keycloak"
37+
TUWUNEL_IDENTITY_PROVIDER__0__CLIENT_ID="<client_id>"
38+
TUWUNEL_IDENTITY_PROVIDER__0__CLIENT_SECRET="<secret>"
39+
TUWUNEL_IDENTITY_PROVIDER__0__ISSUER_URL="https://<your.keycloak.example.com>/realm/<realm_name>"
40+
```

docs/deploying/containers.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Containers
2+
Tuwunel can be deployed in containers such as [Docker](docker.md) or [Podman](podman-systemd.md).
3+

docs/deploying/podman-systemd.md

Lines changed: 70 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,80 @@
1-
# tuwunel in Podman systemd
1+
# Podman, Quadlets, and systemd
22

3-
Copy [tuwunel.container](tuwunel.container) to ~/.config/containers/systemd/tuwunel.container.
4-
Reload daemon:
3+
For a rootless setup, we can use quadlets and systemd to manage the container lifecycle.
4+
5+
> If this is the first container managed with quadlets for your user, ensure that linger is enabled so your containers are not killed after logging out.
6+
>
7+
> `sudo loginctl enable-linger <username>`
8+
9+
## Installation
10+
1. Copy quadlet files to `~/.config/containers/systemd/tuwunel`
11+
12+
### tuwunel.container
13+
14+
<details>
15+
<summary>tuwunel container quadlet</summary>
16+
17+
```
18+
{{#include ../../quadlet/tuwunel.container}}
19+
```
20+
21+
</details>
22+
23+
### tuwunel-db.volume
24+
25+
<details>
26+
<summary>tuwunel database volume quadlet</summary>
27+
28+
```
29+
{{#include ../../quadlet/tuwunel-db.volume}}
30+
```
31+
32+
</details>
33+
34+
### tuwunel.env
35+
36+
<details>
37+
<summary>tuwunel environment variable quadlet</summary>
38+
39+
```env
40+
{{#include ../../quadlet/tuwunel.env}}
41+
```
42+
43+
</details>
44+
45+
46+
47+
48+
```
49+
mkdir -p ~/.config/containers/systemd/tuwunel
50+
```
51+
52+
2.
53+
- Modify tuwunel.env to desired values.
54+
- Modify [tuwenel.toml](generic.md#creating-the-tuwunel-configuration-file) to desired values. This can be saved in your user home directory if desired.
55+
56+
3. Reload daemon to generate our systemd unit files:
557
```
658
systemctl --user daemon-reload
759
```
8-
Start the service:
60+
4. Start tuwunel:
961
```
1062
systemctl --user start tuwunel
1163
```
12-
64+
## Logging
1365
To check the logs, run:
1466
```
15-
journalctl -eu tuwunel.container --user
67+
systemctl --user status tuwunel
68+
```
69+
or
70+
71+
```
72+
podman logs tuwunel-homeserver
1673
```
74+
#### Troubleshooting systemd unit file generation
75+
76+
Look for errors in the output:
77+
78+
79+
`/usr/lib/systemd/system-generators/podman-system-generator --user --dryrun`
80+

docs/deploying/redhat.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
{{#include ../../rpm/README.md}}
2+
3+
## Podman / Quadlets
4+
5+
Podman and Quadlets are well supported on Redhat-based distributions. See [Podman and systemd](podman-systemd.md) for examples.

docs/deploying/reverse-proxy-caddy.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,29 @@ After starting Caddy, verify it's working by checking:
4242
curl https://your.server.name/_tuwunel/server_version
4343
curl https://your.server.name:8448/_tuwunel/server_version
4444
```
45+
## Caddy and .well-known
46+
47+
Caddy can serve `.well-known/matrix/client` and `.well-known/matrix/server` instead of `tuwunel`. This can be done by using the `respond` directive in your caddyfile.
48+
49+
Useful if you want to delegate a domain such as `example.com` -> `matrix.example.com`.
50+
51+
> [!info] Note the use of \` (backtic) in the respond directive to escape JSON that contains \" (double quotes).
52+
53+
```caddyfile
54+
your.server.name, your.server.name:8848 {
55+
56+
@matrix path /.well-known/matrix/*
57+
#Recommended CORS headers (https://spec.matrix.org/v1.17/client-server-api/#well-known-uris)
58+
header @matrix {
59+
Access-Control-Allow-Origin: *
60+
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
61+
Access-Control-Allow-Headers: X-Requested-With, Content-Type, Authorization
62+
}
63+
respond /.well-known/matrix/client `{"m.homeserver": {"base_url":"https://<your.server.name>"}, "org.matrix.msc4143.rtc_foci": [{"type": "livekit", "livekit_service_url": "https://<your.matrix-rtc-jwt.server>"}]} `
64+
respond /.well-known/matrix/server `{"m.server": "<your.server.name>:443"}`
65+
}
66+
```
67+
4568

4669
---
4770

docs/troubleshooting.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,3 +244,32 @@ and is not easy for non-developers to understand.
244244

245245
[unbound-tuning]: https://unbound.docs.nlnetlabs.nl/en/latest/topics/core/performance.html
246246
[unbound-arch]: https://wiki.archlinux.org/title/Unbound
247+
248+
#### MatrixRTC testing tools
249+
[testmatrix](https://pypi.org/project/testmatrix/) is a command line tool for testing various aspects of a matrix server and guiding debugging.
250+
251+
```
252+
$ ./test_matrix.py -u <my-user> -t <token that can be extracted from element-web: all settings: help and about: advanced> example.com
253+
Testing server example.com
254+
Federation url: https://matrix.example.com:443
255+
✔ Server well-known exists
256+
✔ Client well-known has proper CORS header
257+
Client url: https://matrix.example.com
258+
Adding livekit service URL: https://matrixrtc.example.com/livekit/jwt
259+
✔ Server version: Tuwunel (1.5.0)
260+
✔ Federation API endpoints seem to work fine
261+
✔ Client API endpoints seem to work fine
262+
Server oauth metadata endpoint failed (spec 1.15)
263+
QR code login is disabled (MSC 4108)
264+
Public room directory is disabled
265+
✔ MatrixRTC SFU configured
266+
Adding livekit service URL: https://matrixrtc.example.com/livekit/jwt
267+
✔ JWTauth healthz responds
268+
✔ jwt /get_token without auth returns 405, good.
269+
✔ /get_token succeeded. Use the below information to test your livekit SFU on https://livekit.io/connection-test
270+
[...]
271+
𐄂 MatrixRTC configured but delayed events turned off (MSC4140). BAD!
272+
✔ Room summaries (MSC3266) support in matrix compat v1.15
273+
✔ Room summaries stable support works
274+
𐄂 Direct open registration might not be forbidden (returned 401)!
275+
```

quadlet/tuwunel-db.volume

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[Volume]
2+
VolumeName=tuwunel-db

quadlet/tuwunel.container

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# tuwenel.container
2+
3+
[Unit]
4+
Description=Tuwunel Matrix Homeserver
5+
6+
[Container]
7+
ContainerName=tuwunel-homeserver
8+
Image=ghcr.io/matrix-construct/tuwunel:latest
9+
PublishPort=8008:8008
10+
Volume=tuwunel-db:/var/lib/tuwunel/
11+
12+
#Example location in ~/tuwunel/confing/
13+
Volume=%h/tuwunel/config/tuwunel.toml:/etc/tuwunel.toml
14+
EnvironmentFile=tuwunel.env
15+
16+
[Service]
17+
# Uncomment when your system is properly configured, restart=always can mask start up errors.
18+
#Restart=always
19+
20+
[Install]
21+
WantedBy=default.target

quadlet/tuwunel.env

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
TUWUNEL_SERVER_NAME="your.server.tld"
2+
TUWUNEL_PORT=8008
3+
TUWUNEL_MAX_REQUEST_SIZE=20000000
4+
TUWUNEL_ALLOW_REGISTRATION=true
5+
TUWUNEL_REGISTRATION_TOKEN=<replace with a passphrase or random string>
6+
TUWUNEL_ALLOW_FEDERATION=true
7+
TUWUNEL_TRUSTED_SERVERS=["matrix.org"]
8+
TUWUNEL_LOG=info
9+
10+
#Listen on this host for IPv4 and v6
11+
TUWUNEL_ADDRESS=["0.0.0.0", "::"]
12+
13+
#Tell Tuwunel to use the user config file
14+
TUWUNEL_CONFIG=/etc/tuwunel.toml
15+

0 commit comments

Comments
 (0)