Conduit is a simple, fast and reliable chat server powered by Matrix https://conduit.rs
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
315 lines
11 KiB
315 lines
11 KiB
|
2 years ago
|
# Simple setup
|
||
|
|
|
||
|
|
This is the recommended way to set up Conduit. It is the easiest way to get started and is suitable for most use cases.
|
||
|
6 years ago
|
|
||
|
4 years ago
|
> ## Getting help
|
||
|
|
>
|
||
|
3 years ago
|
> If you run into any problems while setting up Conduit, write an email to `conduit@koesters.xyz`, ask us
|
||
|
4 years ago
|
> in `#conduit:fachschaften.org` or [open an issue on GitLab](https://gitlab.com/famedly/conduit/-/issues/new).
|
||
|
6 years ago
|
|
||
|
5 years ago
|
## Installing Conduit
|
||
|
6 years ago
|
|
||
|
3 years ago
|
Although you might be able to compile Conduit for Windows, we do recommend running it on a Linux server. We therefore
|
||
|
4 years ago
|
only offer Linux binaries.
|
||
|
5 years ago
|
|
||
|
3 years ago
|
You may simply download the binary that fits your machine. Run `uname -m` to see what you need. Now copy the appropriate url:
|
||
|
5 years ago
|
|
||
|
2 years ago
|
**Stable versions:**
|
||
|
|
|
||
|
|
| CPU Architecture | Download stable version |
|
||
|
|
| ------------------------------------------- | --------------------------------------------------------------- |
|
||
|
|
| x84_64 / amd64 (Most servers and computers) | [Binary][x84_64-glibc-master] / [.deb][x84_64-glibc-master-deb] |
|
||
|
|
| armv7 (e.g. Raspberry Pi by default) | [Binary][armv7-glibc-master] / [.deb][armv7-glibc-master-deb] |
|
||
|
|
| armv8 / aarch64 | [Binary][armv8-glibc-master] / [.deb][armv8-glibc-master-deb] |
|
||
|
3 years ago
|
|
||
|
|
These builds were created on and linked against the glibc version shipped with Debian bullseye.
|
||
|
3 years ago
|
If you use a system with an older glibc version (e.g. RHEL8), you might need to compile Conduit yourself.
|
||
|
3 years ago
|
|
||
|
|
[x84_64-glibc-master]: https://gitlab.com/famedly/conduit/-/jobs/artifacts/master/raw/build-output/linux_amd64/conduit?job=docker:master
|
||
|
|
[armv7-glibc-master]: https://gitlab.com/famedly/conduit/-/jobs/artifacts/master/raw/build-output/linux_arm_v7/conduit?job=docker:master
|
||
|
|
[armv8-glibc-master]: https://gitlab.com/famedly/conduit/-/jobs/artifacts/master/raw/build-output/linux_arm64/conduit?job=docker:master
|
||
|
|
[x84_64-glibc-master-deb]: https://gitlab.com/famedly/conduit/-/jobs/artifacts/master/raw/build-output/linux_amd64/conduit.deb?job=docker:master
|
||
|
|
[armv7-glibc-master-deb]: https://gitlab.com/famedly/conduit/-/jobs/artifacts/master/raw/build-output/linux_arm_v7/conduit.deb?job=docker:master
|
||
|
|
[armv8-glibc-master-deb]: https://gitlab.com/famedly/conduit/-/jobs/artifacts/master/raw/build-output/linux_arm64/conduit.deb?job=docker:master
|
||
|
2 years ago
|
|
||
|
|
**Latest versions:**
|
||
|
|
|
||
|
|
| Target | Type | Download |
|
||
|
|
|-|-|-|
|
||
|
2 years ago
|
| `x86_64-unknown-linux-musl` | Statically linked Debian package | [link](https://gitlab.com/api/v4/projects/famedly%2Fconduit/jobs/artifacts/next/raw/x86_64-unknown-linux-musl.deb?job=artifacts) |
|
||
|
|
| `x86_64-unknown-linux-musl` | Statically linked binary | [link](https://gitlab.com/api/v4/projects/famedly%2Fconduit/jobs/artifacts/next/raw/x86_64-unknown-linux-musl?job=artifacts) |
|
||
|
|
| `aarch64-unknown-linux-musl` | Statically linked binary | [link](https://gitlab.com/api/v4/projects/famedly%2Fconduit/jobs/artifacts/next/raw/aarch64-unknown-linux-musl?job=artifacts) |
|
||
|
|
| `x86_64-unknown-linux-gnu` | OCI image | [link](https://gitlab.com/api/v4/projects/famedly%2Fconduit/jobs/artifacts/next/raw/oci-image-amd64.tar.gz?job=artifacts) |
|
||
|
|
| `aarch64-unknown-linux-musl` | OCI image | [link](https://gitlab.com/api/v4/projects/famedly%2Fconduit/jobs/artifacts/next/raw/oci-image-arm64v8.tar.gz?job=artifacts) |
|
||
|
5 years ago
|
|
||
|
6 years ago
|
```bash
|
||
|
5 years ago
|
$ sudo wget -O /usr/local/bin/matrix-conduit <url>
|
||
|
|
$ sudo chmod +x /usr/local/bin/matrix-conduit
|
||
|
6 years ago
|
```
|
||
|
|
|
||
|
3 years ago
|
Alternatively, you may compile the binary yourself. First, install any dependencies:
|
||
|
4 years ago
|
|
||
|
|
```bash
|
||
|
3 years ago
|
# Debian
|
||
|
4 years ago
|
$ sudo apt install libclang-dev build-essential
|
||
|
5 years ago
|
|
||
|
3 years ago
|
# RHEL
|
||
|
|
$ sudo dnf install clang
|
||
|
|
```
|
||
|
|
Then, `cd` into the source tree of conduit-next and run:
|
||
|
5 years ago
|
```bash
|
||
|
|
$ cargo build --release
|
||
|
|
```
|
||
|
4 years ago
|
|
||
|
3 years ago
|
If you want to cross compile Conduit to another architecture, read the guide below.
|
||
|
|
|
||
|
|
<details>
|
||
|
|
<summary>Cross compilation</summary>
|
||
|
|
|
||
|
|
As easiest way to compile conduit for another platform [cross-rs](https://github.com/cross-rs/cross) is recommended, so install it first.
|
||
|
|
|
||
|
|
In order to use RockDB as storage backend append `-latomic` to linker flags.
|
||
|
|
|
||
|
|
For example, to build a binary for Raspberry Pi Zero W (ARMv6) you need `arm-unknown-linux-gnueabihf` as compilation
|
||
|
|
target.
|
||
|
|
|
||
|
|
```bash
|
||
|
|
git clone https://gitlab.com/famedly/conduit.git
|
||
|
|
cd conduit
|
||
|
|
export RUSTFLAGS='-C link-arg=-lgcc -Clink-arg=-latomic -Clink-arg=-static-libgcc'
|
||
|
|
cross build --release --no-default-features --features conduit_bin,backend_rocksdb,jemalloc --target=arm-unknown-linux-gnueabihf
|
||
|
|
```
|
||
|
|
</details>
|
||
|
5 years ago
|
|
||
|
5 years ago
|
## Adding a Conduit user
|
||
|
5 years ago
|
|
||
|
4 years ago
|
While Conduit can run as any user it is usually better to use dedicated users for different services. This also allows
|
||
|
|
you to make sure that the file permissions are correctly set up.
|
||
|
5 years ago
|
|
||
|
3 years ago
|
In Debian or RHEL, you can use this command to create a Conduit user:
|
||
|
5 years ago
|
|
||
|
5 years ago
|
```bash
|
||
|
3 years ago
|
sudo adduser --system conduit --group --disabled-login --no-create-home
|
||
|
5 years ago
|
```
|
||
|
6 years ago
|
|
||
|
4 years ago
|
## Forwarding ports in the firewall or the router
|
||
|
4 years ago
|
|
||
|
|
Conduit uses the ports 443 and 8448 both of which need to be open in the firewall.
|
||
|
|
|
||
|
4 years ago
|
If Conduit runs behind a router or in a container and has a different public IP address than the host system these public ports need to be forwarded directly or indirectly to the port mentioned in the config.
|
||
|
4 years ago
|
|
||
|
3 years ago
|
## Optional: Avoid port 8448
|
||
|
3 years ago
|
|
||
|
|
If Conduit runs behind Cloudflare reverse proxy, which doesn't support port 8448 on free plans, [delegation](https://matrix-org.github.io/synapse/latest/delegate.html) can be set up to have federation traffic routed to port 443:
|
||
|
|
```apache
|
||
|
|
# .well-known delegation on Apache
|
||
|
|
<Files "/.well-known/matrix/server">
|
||
|
|
ErrorDocument 200 '{"m.server": "your.server.name:443"}'
|
||
|
|
Header always set Content-Type application/json
|
||
|
|
Header always set Access-Control-Allow-Origin *
|
||
|
|
</Files>
|
||
|
|
```
|
||
|
|
[SRV DNS record](https://spec.matrix.org/latest/server-server-api/#resolving-server-names) delegation is also [possible](https://www.cloudflare.com/en-gb/learning/dns/dns-records/dns-srv-record/).
|
||
|
|
|
||
|
5 years ago
|
## Setting up a systemd service
|
||
|
6 years ago
|
|
||
|
4 years ago
|
Now we'll set up a systemd service for Conduit, so it's easy to start/stop Conduit and set it to autostart when your
|
||
|
|
server reboots. Simply paste the default systemd service you can find below into
|
||
|
5 years ago
|
`/etc/systemd/system/conduit.service`.
|
||
|
6 years ago
|
|
||
|
|
```systemd
|
||
|
|
[Unit]
|
||
|
5 years ago
|
Description=Conduit Matrix Server
|
||
|
6 years ago
|
After=network.target
|
||
|
|
|
||
|
|
[Service]
|
||
|
5 years ago
|
Environment="CONDUIT_CONFIG=/etc/matrix-conduit/conduit.toml"
|
||
|
5 years ago
|
User=conduit
|
||
|
3 years ago
|
Group=conduit
|
||
|
6 years ago
|
Restart=always
|
||
|
5 years ago
|
ExecStart=/usr/local/bin/matrix-conduit
|
||
|
6 years ago
|
|
||
|
|
[Install]
|
||
|
|
WantedBy=multi-user.target
|
||
|
|
```
|
||
|
|
|
||
|
|
Finally, run
|
||
|
5 years ago
|
|
||
|
6 years ago
|
```bash
|
||
|
|
$ sudo systemctl daemon-reload
|
||
|
|
```
|
||
|
|
|
||
|
5 years ago
|
## Creating the Conduit configuration file
|
||
|
|
|
||
|
2 years ago
|
Now we need to create the Conduit's config file in
|
||
|
|
`/etc/matrix-conduit/conduit.toml`. Paste in the contents of
|
||
|
2 years ago
|
[`conduit-example.toml`](../configuration.md) **and take a moment to read it.
|
||
|
2 years ago
|
You need to change at least the server name.**
|
||
|
4 years ago
|
You can also choose to use a different database backend, but right now only `rocksdb` and `sqlite` are recommended.
|
||
|
5 years ago
|
|
||
|
5 years ago
|
## Setting the correct file permissions
|
||
|
|
|
||
|
4 years ago
|
As we are using a Conduit specific user we need to allow it to read the config. To do that you can run this command on
|
||
|
3 years ago
|
Debian or RHEL:
|
||
|
5 years ago
|
|
||
|
5 years ago
|
```bash
|
||
|
4 years ago
|
sudo chown -R root:root /etc/matrix-conduit
|
||
|
|
sudo chmod 755 /etc/matrix-conduit
|
||
|
5 years ago
|
```
|
||
|
5 years ago
|
|
||
|
5 years ago
|
If you use the default database path you also need to run this:
|
||
|
|
|
||
|
5 years ago
|
```bash
|
||
|
4 years ago
|
sudo mkdir -p /var/lib/matrix-conduit/
|
||
|
3 years ago
|
sudo chown -R conduit:conduit /var/lib/matrix-conduit/
|
||
|
4 years ago
|
sudo chmod 700 /var/lib/matrix-conduit/
|
||
|
5 years ago
|
```
|
||
|
5 years ago
|
|
||
|
5 years ago
|
## Setting up the Reverse Proxy
|
||
|
6 years ago
|
|
||
|
4 years ago
|
This depends on whether you use Apache, Caddy, Nginx or another web server.
|
||
|
5 years ago
|
|
||
|
|
### Apache
|
||
|
|
|
||
|
|
Create `/etc/apache2/sites-enabled/050-conduit.conf` and copy-and-paste this:
|
||
|
5 years ago
|
|
||
|
5 years ago
|
```apache
|
||
|
3 years ago
|
# Requires mod_proxy and mod_proxy_http
|
||
|
|
#
|
||
|
|
# On Apache instance compiled from source,
|
||
|
|
# paste into httpd-ssl.conf or httpd.conf
|
||
|
|
|
||
|
5 years ago
|
Listen 8448
|
||
|
|
|
||
|
|
<VirtualHost *:443 *:8448>
|
||
|
|
|
||
|
|
ServerName your.server.name # EDIT THIS
|
||
|
6 years ago
|
|
||
|
|
AllowEncodedSlashes NoDecode
|
||
|
3 years ago
|
ProxyPass /_matrix/ http://127.0.0.1:6167/_matrix/ timeout=300 nocanon
|
||
|
5 years ago
|
ProxyPassReverse /_matrix/ http://127.0.0.1:6167/_matrix/
|
||
|
6 years ago
|
|
||
|
|
</VirtualHost>
|
||
|
|
```
|
||
|
|
|
||
|
5 years ago
|
**You need to make some edits again.** When you are done, run
|
||
|
5 years ago
|
|
||
|
6 years ago
|
```bash
|
||
|
3 years ago
|
# Debian
|
||
|
6 years ago
|
$ sudo systemctl reload apache2
|
||
|
3 years ago
|
|
||
|
|
# Installed from source
|
||
|
|
$ sudo apachectl -k graceful
|
||
|
6 years ago
|
```
|
||
|
|
|
||
|
4 years ago
|
### Caddy
|
||
|
3 years ago
|
|
||
|
4 years ago
|
Create `/etc/caddy/conf.d/conduit_caddyfile` and enter this (substitute for your server name).
|
||
|
3 years ago
|
|
||
|
4 years ago
|
```caddy
|
||
|
|
your.server.name, your.server.name:8448 {
|
||
|
|
reverse_proxy /_matrix/* 127.0.0.1:6167
|
||
|
|
}
|
||
|
|
```
|
||
|
3 years ago
|
|
||
|
4 years ago
|
That's it! Just start or enable the service and you're set.
|
||
|
3 years ago
|
|
||
|
4 years ago
|
```bash
|
||
|
|
$ sudo systemctl enable caddy
|
||
|
|
```
|
||
|
|
|
||
|
5 years ago
|
### Nginx
|
||
|
|
|
||
|
4 years ago
|
If you use Nginx and not Apache, add the following server section inside the http section of `/etc/nginx/nginx.conf`
|
||
|
5 years ago
|
|
||
|
5 years ago
|
```nginx
|
||
|
5 years ago
|
server {
|
||
|
5 years ago
|
listen 443 ssl http2;
|
||
|
|
listen [::]:443 ssl http2;
|
||
|
|
listen 8448 ssl http2;
|
||
|
|
listen [::]:8448 ssl http2;
|
||
|
5 years ago
|
server_name your.server.name; # EDIT THIS
|
||
|
5 years ago
|
merge_slashes off;
|
||
|
5 years ago
|
|
||
|
3 years ago
|
# Nginx defaults to only allow 1MB uploads
|
||
|
3 years ago
|
# Increase this to allow posting large files such as videos
|
||
|
3 years ago
|
client_max_body_size 20M;
|
||
|
|
|
||
|
5 years ago
|
location /_matrix/ {
|
||
|
2 years ago
|
proxy_pass http://127.0.0.1:6167;
|
||
|
5 years ago
|
proxy_set_header Host $http_host;
|
||
|
|
proxy_buffering off;
|
||
|
3 years ago
|
proxy_read_timeout 5m;
|
||
|
5 years ago
|
}
|
||
|
5 years ago
|
|
||
|
|
ssl_certificate /etc/letsencrypt/live/your.server.name/fullchain.pem; # EDIT THIS
|
||
|
|
ssl_certificate_key /etc/letsencrypt/live/your.server.name/privkey.pem; # EDIT THIS
|
||
|
|
ssl_trusted_certificate /etc/letsencrypt/live/your.server.name/chain.pem; # EDIT THIS
|
||
|
|
include /etc/letsencrypt/options-ssl-nginx.conf;
|
||
|
5 years ago
|
}
|
||
|
|
```
|
||
|
4 years ago
|
|
||
|
5 years ago
|
**You need to make some edits again.** When you are done, run
|
||
|
5 years ago
|
|
||
|
5 years ago
|
```bash
|
||
|
|
$ sudo systemctl reload nginx
|
||
|
|
```
|
||
|
|
|
||
|
6 years ago
|
## SSL Certificate
|
||
|
|
|
||
|
4 years ago
|
If you chose Caddy as your web proxy SSL certificates are handled automatically and you can skip this step.
|
||
|
|
|
||
|
3 years ago
|
The easiest way to get an SSL certificate, if you don't have one already, is to [install](https://certbot.eff.org/instructions) `certbot` and run this:
|
||
|
5 years ago
|
|
||
|
6 years ago
|
```bash
|
||
|
3 years ago
|
# To use ECC for the private key,
|
||
|
|
# paste into /etc/letsencrypt/cli.ini:
|
||
|
|
# key-type = ecdsa
|
||
|
|
# elliptic-curve = secp384r1
|
||
|
|
|
||
|
5 years ago
|
$ sudo certbot -d your.server.name
|
||
|
6 years ago
|
```
|
||
|
3 years ago
|
[Automated renewal](https://eff-certbot.readthedocs.io/en/stable/using.html#automated-renewals) is usually preconfigured.
|
||
|
|
|
||
|
|
If using Cloudflare, configure instead the edge and origin certificates in dashboard. In case you’re already running a website on the same Apache server, you can just copy-and-paste the SSL configuration from your main virtual host on port 443 into the above-mentioned vhost.
|
||
|
6 years ago
|
|
||
|
|
## You're done!
|
||
|
|
|
||
|
5 years ago
|
Now you can start Conduit with:
|
||
|
5 years ago
|
|
||
|
6 years ago
|
```bash
|
||
|
|
$ sudo systemctl start conduit
|
||
|
|
```
|
||
|
|
|
||
|
5 years ago
|
Set it to start automatically when your system boots with:
|
||
|
5 years ago
|
|
||
|
6 years ago
|
```bash
|
||
|
|
$ sudo systemctl enable conduit
|
||
|
|
```
|
||
|
5 years ago
|
|
||
|
5 years ago
|
## How do I know it works?
|
||
|
|
|
||
|
|
You can open <https://app.element.io>, enter your homeserver and try to register.
|
||
|
|
|
||
|
|
You can also use these commands as a quick health check.
|
||
|
|
|
||
|
|
```bash
|
||
|
|
$ curl https://your.server.name/_matrix/client/versions
|
||
|
3 years ago
|
|
||
|
|
# If using port 8448
|
||
|
5 years ago
|
$ curl https://your.server.name:8448/_matrix/client/versions
|
||
|
|
```
|
||
|
|
|
||
|
4 years ago
|
- To check if your server can talk with other homeservers, you can use the [Matrix Federation Tester](https://federationtester.matrix.org/).
|
||
|
4 years ago
|
If you can register but cannot join federated rooms check your config again and also check if the port 8448 is open and forwarded correctly.
|
||
|
4 years ago
|
|
||
|
|
# What's next?
|
||
|
|
|
||
|
|
## Audio/Video calls
|
||
|
|
|
||
|
2 years ago
|
For Audio/Video call functionality see the [TURN Guide](../turn.md).
|
||
|
4 years ago
|
|
||
|
|
## Appservices
|
||
|
|
|
||
|
2 years ago
|
If you want to set up an appservice, take a look at the [Appservice Guide](../appservices.md).
|