2024-04-26 00:21:48 +00:00
# conduwuit for Docker
2020-08-12 19:17:53 +00:00
## Docker
2024-02-01 02:10:38 +00:00
To run conduwuit with Docker you can either build the image yourself or pull it from a registry.
2023-06-28 16:51:44 +00:00
### Use a registry
2024-03-31 01:38:44 +00:00
OCI images for conduwuit are available in the registries listed below.
2023-07-21 18:33:32 +00:00
| Registry | Image | Size | Notes |
| --------------- | --------------------------------------------------------------- | ----------------------------- | ---------------------- |
2024-04-26 00:21:48 +00:00
| GitHub Registry | [ghcr.io/girlbossceo/conduwuit:latest][gh] | ![Image Size][shield-latest] | Stable tagged image. |
2024-05-07 17:37:55 +00:00
| GitLab Registry | [registry.gitlab.com/conduwuit/conduwuit:latest][gl] | ![Image Size][shield-latest] | Stable tagged image. |
2024-04-26 00:21:48 +00:00
| Docker Hub | [docker.io/girlbossceo/conduwuit:latest][dh] | ![Image Size][shield-latest] | Stable tagged image. |
2024-05-03 03:29:17 +00:00
| GitHub Registry | [ghcr.io/girlbossceo/conduwuit:main][gh] | ![Image Size][shield-main] | Stable main branch. |
2024-05-07 17:37:55 +00:00
| GitLab Registry | [registry.gitlab.com/conduwuit/conduwuit:main][gl] | ![Image Size][shield-main] | Stable main branch. |
2024-05-03 03:29:17 +00:00
| Docker Hub | [docker.io/girlbossceo/conduwuit:main][dh] | ![Image Size][shield-main] | Stable main branch. |
2023-06-28 16:51:44 +00:00
2024-02-01 02:10:38 +00:00
[dh]: https://hub.docker.com/repository/docker/girlbossceo/conduwuit
[gh]: https://github.com/girlbossceo/conduwuit/pkgs/container/conduwuit
2024-05-07 17:37:55 +00:00
[gl]: https://gitlab.com/conduwuit/conduwuit/container_registry/6351657
2024-02-01 02:10:38 +00:00
[shield-latest]: https://img.shields.io/docker/image-size/girlbossceo/conduwuit/latest
[shield-main]: https://img.shields.io/docker/image-size/girlbossceo/conduwuit/main
2023-07-21 18:33:32 +00:00
2023-06-28 16:51:44 +00:00
2024-04-26 00:21:48 +00:00
Use
2023-06-28 16:51:44 +00:00
```bash
docker image pull < link >
```
to pull it to your machine.
2020-08-12 19:17:53 +00:00
### Run
2023-06-28 16:51:44 +00:00
When you have the image you can simply run it with
2020-08-04 20:06:13 +00:00
2021-11-21 17:34:08 +00:00
```bash
2022-02-13 12:38:13 +00:00
docker run -d -p 8448:6167 \
2024-04-26 00:21:48 +00:00
-v db:/var/lib/conduwuit/ \
2022-02-13 12:38:13 +00:00
-e CONDUIT_SERVER_NAME="your.server.name" \
-e CONDUIT_DATABASE_BACKEND="rocksdb" \
2024-04-26 00:21:48 +00:00
-e CONDUIT_ALLOW_REGISTRATION=false \
2022-02-13 12:38:13 +00:00
-e CONDUIT_ALLOW_FEDERATION=true \
2024-04-26 00:21:48 +00:00
-e CONDUIT_MAX_REQUEST_SIZE="40000000" \
2022-02-13 12:38:13 +00:00
-e CONDUIT_TRUSTED_SERVERS="[\"matrix.org\"]" \
2024-02-01 02:10:38 +00:00
-e CONDUIT_LOG="warn,ruma_state_res=warn" \
2023-07-21 18:33:32 +00:00
--name conduit < link >
2020-08-04 20:06:13 +00:00
```
2024-04-26 00:21:48 +00:00
or you can use [docker compose ](#docker-compose ).
2021-08-17 12:44:53 +00:00
2024-05-03 03:29:17 +00:00
The `-d` flag lets the container run in detached mode. You may supply an optional `conduwuit.toml` config file, an example can be found [here ](../configuration.md ).
You can pass in different env vars to change config values on the fly. You can even configure conduwuit completely by using env vars. For an overview of possible
values, please take a look at the `docker-compose.yml` file.
2021-08-17 12:44:53 +00:00
2024-04-26 00:21:48 +00:00
If you just want to test conduwuit for a short time, you can use the `--rm` flag, which will clean up everything related to your container after you stop it.
2020-08-04 20:06:13 +00:00
2023-07-04 16:41:05 +00:00
### Docker-compose
2020-08-12 19:17:53 +00:00
2022-02-19 16:06:06 +00:00
If the `docker run` command is not for you or your setup, you can also use one of the provided `docker-compose` files.
Depending on your proxy setup, you can use one of the following files;
- If you already have a `traefik` instance set up, use [`docker-compose.for-traefik.yml` ](docker-compose.for-traefik.yml )
- If you don't have a `traefik` instance set up (or any other reverse proxy), use [`docker-compose.with-traefik.yml` ](docker-compose.with-traefik.yml )
- For any other reverse proxy, use [`docker-compose.yml` ](docker-compose.yml )
When picking the traefik-related compose file, rename it so it matches `docker-compose.yml` , and
rename the override file to `docker-compose.override.yml` . Edit the latter with the values you want
for your server.
2024-04-26 00:21:48 +00:00
Additional info about deploying conduwuit can be found [here ](generic.md ).
2020-08-04 20:06:13 +00:00
2020-08-12 19:17:53 +00:00
### Build
2024-04-26 00:21:48 +00:00
To build the conduwuit image with docker-compose, you first need to open and modify the `docker-compose.yml` file. There you need to comment the `image:` option and uncomment the `build:` option. Then call docker compose with:
2020-08-04 20:06:13 +00:00
2021-11-21 17:34:08 +00:00
```bash
2024-04-26 00:21:48 +00:00
docker compose up
2020-08-04 20:06:13 +00:00
```
2021-11-21 17:34:08 +00:00
This will also start the container right afterwards, so if want it to run in detached mode, you also should use the `-d` flag.
2020-08-12 19:17:53 +00:00
### Run
2021-08-17 12:44:53 +00:00
If you already have built the image or want to use one from the registries, you can just start the container and everything else in the compose file in detached mode with:
2020-08-04 20:06:13 +00:00
2021-11-21 17:34:08 +00:00
```bash
2024-04-26 00:21:48 +00:00
docker compose up -d
2020-08-04 20:06:13 +00:00
```
2021-08-17 12:44:53 +00:00
> **Note:** Don't forget to modify and adjust the compose file to your needs.
### Use Traefik as Proxy
2022-02-19 16:06:06 +00:00
As a container user, you probably know about Traefik. It is a easy to use reverse proxy for making
containerized app and services available through the web. With the two provided files,
[`docker-compose.for-traefik.yml` ](docker-compose.for-traefik.yml ) (or
[`docker-compose.with-traefik.yml` ](docker-compose.with-traefik.yml )) and
2023-07-29 06:26:34 +00:00
[`docker-compose.override.yml` ](docker-compose.override.yml ), it is equally easy to deploy
2024-04-26 00:21:48 +00:00
and use conduwuit, with a little caveat. If you already took a look at the files, then you should have
2022-02-19 16:06:06 +00:00
seen the `well-known` service, and that is the little caveat. Traefik is simply a proxy and
2024-04-26 00:21:48 +00:00
loadbalancer and is not able to serve any kind of content, but for conduwuit to federate, we need to
2022-02-19 16:06:06 +00:00
either expose ports `443` and `8448` or serve two endpoints `.well-known/matrix/client` and
`.well-known/matrix/server` .
2021-08-17 12:44:53 +00:00
With the service `well-known` we use a single `nginx` container that will serve those two files.
So...step by step:
2023-07-29 06:26:34 +00:00
1. Copy [`docker-compose.for-traefik.yml` ](docker-compose.for-traefik.yml ) (or
2023-07-29 08:02:56 +00:00
[`docker-compose.with-traefik.yml` ](docker-compose.with-traefik.yml )) and [`docker-compose.override.yml` ](docker-compose.override.yml ) from the repository and remove `.for-traefik` (or `.with-traefik` ) from the filename.
2021-08-17 12:44:53 +00:00
2. Open both files and modify/adjust them to your needs. Meaning, change the `CONDUIT_SERVER_NAME` and the volume host mappings according to your needs.
2024-04-26 00:21:48 +00:00
3. Create the `conduwuit.toml` config file, an example can be found [here ](../configuration.md ), or set `CONDUIT_CONFIG=""` and configure conduwuit per env vars.
2021-08-17 12:44:53 +00:00
4. Uncomment the `element-web` service if you want to host your own Element Web Client and create a `element_config.json` .
5. Create the files needed by the `well-known` service.
2021-11-21 17:34:08 +00:00
- `./nginx/matrix.conf` (relative to the compose file, you can change this, but then also need to change the volume mapping)
```nginx
server {
server_name < SUBDOMAIN > .< DOMAIN > ;
listen 80 default_server;
2022-01-07 13:06:21 +00:00
location /.well-known/matrix/server {
return 200 '{"m.server": "< SUBDOMAIN > .< DOMAIN > :443"}';
2022-11-08 15:56:24 +00:00
types { } default_type "application/json; charset=utf-8";
2021-11-21 17:34:08 +00:00
}
2022-01-07 13:06:21 +00:00
location /.well-known/matrix/client {
return 200 '{"m.homeserver": {"base_url": "https://< SUBDOMAIN > .< DOMAIN > "}}';
2022-11-08 15:56:24 +00:00
types { } default_type "application/json; charset=utf-8";
2022-01-07 13:06:21 +00:00
add_header "Access-Control-Allow-Origin" *;
}
location / {
return 404;
}
2021-11-21 17:34:08 +00:00
}
```
2024-04-26 00:21:48 +00:00
6. Run `docker compose up -d`
2022-02-12 09:29:04 +00:00
7. Connect to your homeserver with your preferred client and create a user. You should do this immediately after starting Conduit, because the first created user is the admin.
2023-07-04 16:41:05 +00:00
## Voice communication
2024-04-26 00:21:48 +00:00
In order to make or receive calls, a TURN server is required. conduwuit suggests using [Coturn ](https://github.com/coturn/coturn ) for this purpose, which is also available as a Docker image. Before proceeding with the software installation, it is essential to have the necessary configurations in place.
2023-07-04 16:41:05 +00:00
### Configuration
Create a configuration file called `coturn.conf` containing:
```conf
use-auth-secret
static-auth-secret=< a secret key >
realm=< your server domain >
```
2023-08-10 14:42:04 +00:00
A common way to generate a suitable alphanumeric secret key is by using `pwgen -s 64 1` .
2024-04-26 00:21:48 +00:00
These same values need to be set in conduwuit. You can either modify conduwuit.toml to include these lines:
2023-07-04 16:41:05 +00:00
```
turn_uris = ["turn:< your server domain > ?transport=udp", "turn:< your server domain > ?transport=tcp"]
turn_secret = "< secret key from coturn configuration > "
```
or append the following to the docker environment variables dependig on which configuration method you used earlier:
```yml
2023-08-27 02:14:03 +00:00
CONDUIT_TURN_URIS: '["turn:< your server domain > ?transport=udp", "turn:< your server domain > ?transport=tcp"]'
CONDUIT_TURN_SECRET: "< secret key from coturn configuration > "
2023-07-04 16:41:05 +00:00
```
Restart Conduit to apply these changes.
### Run
2024-04-26 00:21:48 +00:00
Run the [Coturn ](https://hub.docker.com/r/coturn/coturn ) image using
2023-07-04 16:41:05 +00:00
```bash
docker run -d --network=host -v $(pwd)/coturn.conf:/etc/coturn/turnserver.conf coturn/coturn
```
or docker-compose. For the latter, paste the following section into a file called `docker-compose.yml`
2024-04-26 00:21:48 +00:00
and run `docker compose up -d` in the same directory.
2023-07-04 16:41:05 +00:00
```yml
version: 3
services:
turn:
container_name: coturn-server
image: docker.io/coturn/coturn
restart: unless-stopped
network_mode: "host"
volumes:
- ./coturn.conf:/etc/coturn/turnserver.conf
```
To understand why the host networking mode is used and explore alternative configuration options, please visit the following link: https://github.com/coturn/coturn/blob/master/docker/coturn/README.md.
For security recommendations see Synapse's [Coturn documentation ](https://github.com/matrix-org/synapse/blob/develop/docs/setup/turn/coturn.md#configuration ).