2024-03-22 04:16:20 +01:00
# Generic deployment documentation
### Please note that this documentation is not fully representative of conduwuit at the moment. Assume majority of it is outdated.
> ## Getting help
>
> If you run into any problems while setting up conduwuit, ask us
> in `#conduwuit:puppygock.gay` or [open an issue on GitHub](https://github.com/girlbossceo/conduwuit/issues/new).
## Installing conduwuit
You may simply download the binary that fits your machine. Run `uname -m` to see what you need.
2024-03-31 03:38:44 +02:00
Prebuilt binaries can be downloaded from the latest successful CI workflow on the main branch here: https://github.com/girlbossceo/conduwuit/actions/workflows/ci.yml?query=branch%3Amain+actor%3Agirlbossceo+is%3Asuccess+event%3Apush
2024-03-22 04:16:20 +01:00
Alternatively, you may compile the binary yourself. First, install any dependencies:
```bash
# Debian
$ sudo apt install libclang-dev build-essential
# RHEL
$ sudo dnf install clang
```
2024-04-26 02:21:48 +02:00
Then, `cd` into the source tree of conduwuit and run:
2024-03-22 04:16:20 +01:00
```bash
$ cargo build --release
```
2024-04-26 02:21:48 +02:00
## Adding a conduwuit user
2024-03-22 04:16:20 +01:00
2024-04-26 02:21:48 +02:00
While conduwuit can run as any user it is usually better to use dedicated users for different services. This also allows
2024-03-22 04:16:20 +01:00
you to make sure that the file permissions are correctly set up.
2024-04-26 02:21:48 +02:00
In Debian or RHEL, you can use this command to create a conduwuit user:
2024-03-22 04:16:20 +01:00
```bash
2024-04-26 02:21:48 +02:00
sudo adduser --system conduwuit --group --disabled-login --no-create-home
2024-03-22 04:16:20 +01:00
```
## Forwarding ports in the firewall or the router
2024-04-26 02:21:48 +02:00
conduwuit uses the ports 443 and 8448 both of which need to be open in the firewall.
2024-03-22 04:16:20 +01:00
2024-04-26 02:21:48 +02:00
If conduwuit 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.
2024-03-22 04:16:20 +01:00
## Setting up a systemd service
2024-04-26 02:21:48 +02:00
Now we'll set up a systemd service for conduwuit, so it's easy to start/stop conduwuit and set it to autostart when your
2024-03-22 04:16:20 +01:00
server reboots. Simply paste the default systemd service you can find below into
2024-04-26 02:21:48 +02:00
`/etc/systemd/system/conduwuit.service` .
2024-03-22 04:16:20 +01:00
```systemd
[Unit]
2024-04-26 02:21:48 +02:00
Description=conduwuit Matrix Server
2024-03-22 04:16:20 +01:00
After=network.target
[Service]
2024-04-26 02:21:48 +02:00
Environment="CONDUWUIT_CONFIG=/etc/conduwuit/conduwuit.toml"
User=conduwuit
Group=conduwuit
RuntimeDirectory=conduwuit
2024-03-22 04:16:20 +01:00
RuntimeDirectoryMode=0750
Restart=always
2024-04-26 02:21:48 +02:00
ExecStart=/usr/local/bin/conduwuit
2024-03-22 04:16:20 +01:00
[Install]
WantedBy=multi-user.target
```
Finally, run
```bash
$ sudo systemctl daemon-reload
```
2024-04-26 02:21:48 +02:00
## Creating the conduwuit configuration file
2024-03-22 04:16:20 +01:00
2024-04-26 02:21:48 +02:00
Now we need to create the conduwuit's config file in `/etc/conduwuit/conduwuit.toml` . Paste this in **and take a moment
to read it. You need to change at least the server name.**
2024-03-31 03:38:44 +02:00
RocksDB (`rocksdb`) is the only supported database backend. SQLite only exists for historical reasons and is not recommended. Any performance issues, storage issues, database issues, etc will not be assisted if using SQLite and you will be asked to migrate to RocksDB first.
2024-03-22 04:16:20 +01:00
See the following example config at [conduwuit-example.toml ](../configuration.md )
## Setting the correct file permissions
2024-04-26 02:21:48 +02:00
As we are using a conduwuit specific user we need to allow it to read the config. To do that you can run this command on
2024-03-22 04:16:20 +01:00
Debian or RHEL:
```bash
2024-04-26 02:21:48 +02:00
sudo chown -R root:root /etc/conduwuit
sudo chmod 755 /etc/conduwuit
2024-03-22 04:16:20 +01:00
```
If you use the default database path you also need to run this:
```bash
2024-04-26 02:21:48 +02:00
sudo mkdir -p /var/lib/conduwuit/
sudo chown -R conduwuit:conduwuit /var/lib/conduwuit/
sudo chmod 700 /var/lib/conduwuit/
2024-03-22 04:16:20 +01:00
```
## Setting up the Reverse Proxy
2024-03-31 03:38:44 +02:00
Refer to the documentation or various guides online of your chosen reverse proxy software. A Caddy example will be provided as this is the recommended reverse proxy for new users and is very trivial.
2024-03-22 04:16:20 +01:00
### Caddy
2024-03-31 03:38:44 +02:00
Create `/etc/caddy/conf.d/conduwuit_caddyfile` and enter this (substitute for your server name).
2024-03-22 04:16:20 +01:00
```caddy
your.server.name, your.server.name:8448 {
# TCP
2024-03-31 03:38:44 +02:00
reverse_proxy 127.0.0.1:6167
2024-03-22 04:16:20 +01:00
# UNIX socket
2024-04-26 02:21:48 +02:00
#reverse_proxy unix//run/conduwuit/conduwuit.sock
2024-03-22 04:16:20 +01:00
}
```
That's it! Just start or enable the service and you're set.
```bash
$ sudo systemctl enable caddy
```
## You're done!
2024-04-26 02:21:48 +02:00
Now you can start conduwuit with:
2024-03-22 04:16:20 +01:00
```bash
2024-04-26 02:21:48 +02:00
$ sudo systemctl start conduwuit
2024-03-22 04:16:20 +01:00
```
Set it to start automatically when your system boots with:
```bash
2024-04-26 02:21:48 +02:00
$ sudo systemctl enable conduwuit
2024-03-22 04:16:20 +01:00
```
## How do I know it works?
You can open [a Matrix client ](https://matrix.org/ecosystem/clients ), enter your homeserver and try to register.
You can also use these commands as a quick health check.
```bash
2024-03-31 03:38:44 +02:00
$ curl https://your.server.name/_conduwuit/server_version
2024-03-22 04:16:20 +01:00
# If using port 8448
2024-03-31 03:38:44 +02:00
$ curl https://your.server.name:8448/_conduwuit/server_version
2024-03-22 04:16:20 +01:00
```
- To check if your server can talk with other homeservers, you can use the [Matrix Federation Tester ](https://federationtester.matrix.org/ ).
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.
# What's next?
## Audio/Video calls
For Audio/Video call functionality see the [TURN Guide ](../turn.md ).
## Appservices
If you want to set up an appservice, take a look at the [Appservice Guide ](../appservices.md ).