2024-03-21 23:16:20 -04:00
# Generic deployment documentation
> ## Getting help
>
2024-08-24 05:13:43 +02:00
> 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).
2024-03-21 23:16:20 -04:00
## Installing conduwuit
2024-08-24 05:13:43 +02:00
You may simply download the binary that fits your machine. Run `uname -m` to see
what you need.
2024-03-21 23:16:20 -04:00
2024-08-24 05:13:43 +02:00
Prebuilt fully static musl binaries can be downloaded from the latest tagged
release [here ](https://github.com/girlbossceo/conduwuit/releases/latest ) or
`main` CI branch workflow artifact output. These also include Debian packages.
These binaries have jemalloc and io_uring statically linked and included with
them.
2024-03-21 23:16:20 -04:00
2024-08-24 05:13:43 +02:00
Alternatively, you may compile the binary yourself. We recommend using
2024-09-08 10:24:38 -04:00
Nix (or [Lix ](https://lix.systems ) to build conduwuit as this has the most guaranteed
2024-05-08 21:26:05 -04:00
reproducibiltiy and easiest to get a build environment and output going.
2024-03-21 23:16:20 -04:00
2024-08-24 05:13:43 +02:00
Otherwise, follow standard Rust project build guides (installing git and cloning
the repo, getting the Rust toolchain via rustup, installing LLVM toolchain +
libclang for RocksDB, installing liburing for io_uring and RocksDB, etc).
2024-03-21 23:16:20 -04:00
2024-04-25 20:21:48 -04:00
## Adding a conduwuit user
2024-03-21 23:16:20 -04:00
2024-08-24 05:13:43 +02:00
While conduwuit can run as any user it is better to use dedicated users for
different services. This also allows you to make sure that the file permissions
are correctly set up.
2024-03-21 23:16:20 -04:00
2024-07-13 22:15:16 -04:00
In Debian or Fedora/RHEL, you can use this command to create a conduwuit user:
2024-03-21 23:16:20 -04:00
```bash
2024-08-30 18:54:41 -04:00
sudo adduser --system conduwuit --group --disabled-login --no-create-home
2024-03-21 23:16:20 -04:00
```
2024-05-08 21:26:05 -04:00
For distros without `adduser` :
2024-08-30 18:54:41 -04:00
```bash
sudo useradd -r --shell /usr/bin/nologin --no-create-home conduwuit
```
2024-05-08 21:26:05 -04:00
2024-03-21 23:16:20 -04:00
## Forwarding ports in the firewall or the router
2024-08-24 05:13:43 +02:00
conduwuit uses the ports 443 and 8448 both of which need to be open in the
firewall.
2024-03-21 23:16:20 -04:00
2024-08-24 05:13:43 +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-21 23:16:20 -04:00
## Setting up a systemd service
2024-08-24 05:13:43 +02:00
The systemd unit for conduwuit can be found
[here ](../configuration/examples.md#example-systemd-unit-file ). You may need to
change the `ExecStart=` path to where you placed the conduwuit binary.
2024-03-21 23:16:20 -04:00
2024-10-19 11:12:41 +08:00
On systems where rsyslog is used alongside journald (i.e. Red Hat-based distros and OpenSUSE), put `$EscapeControlCharactersOnReceive off` inside `/etc/rsyslog.conf` to allow color in logs.
2024-04-25 20:21:48 -04:00
## Creating the conduwuit configuration file
2024-03-21 23:16:20 -04:00
2024-08-24 05:13:43 +02:00
Now we need to create the conduwuit's config file in
`/etc/conduwuit/conduwuit.toml` . The example config can be found at
2024-08-30 18:54:41 -04:00
[conduwuit-example.toml ](../configuration/examples.md ).
**Please take a moment to read the config. You need to change at least the server name.**
2024-03-21 23:16:20 -04:00
2024-06-26 19:25:44 -04:00
RocksDB is the only supported database backend.
2024-03-21 23:16:20 -04:00
## Setting the correct file permissions
2024-08-24 05:13:43 +02:00
If you are using a dedicated user for conduwuit, you will need to allow it to
read the config. To do that you can run this:
2024-03-21 23:16:20 -04:00
```bash
2024-10-23 19:59:56 -04:00
sudo chown -R root:root /etc/conduwuit
sudo chmod -R 755 /etc/conduwuit
2024-03-21 23:16:20 -04:00
```
If you use the default database path you also need to run this:
2024-08-30 18:54:41 -04:00
```bash
2024-10-23 19:59:56 -04:00
sudo mkdir -p /var/lib/conduwuit/
sudo chown -R conduwuit:conduwuit /var/lib/conduwuit/
2024-08-30 18:54:41 -04:00
sudo chmod 700 /var/lib/conduwuit/
2024-03-21 23:16:20 -04:00
```
## Setting up the Reverse Proxy
2024-08-24 05:13:43 +02:00
Refer to the documentation or various guides online of your chosen reverse proxy
software. A [Caddy ](https://caddyserver.com/ ) example will be provided as this
is the recommended reverse proxy for new users and is very trivial to use
(handles TLS, reverse proxy headers, etc transparently with proper defaults).
2024-03-21 23:16:20 -04:00
2024-08-24 05:13:43 +02:00
Lighttpd is not supported as it seems to mess with the `X-Matrix` Authorization
header, making federation non-functional. If using Apache, you need to use
`nocanon` to prevent this.
2024-06-02 18:00:38 -04:00
2024-03-21 23:16:20 -04:00
### Caddy
2024-08-24 05:13:43 +02:00
Create `/etc/caddy/conf.d/conduwuit_caddyfile` and enter this (substitute for
your server name).
2024-03-21 23:16:20 -04:00
2024-08-30 18:54:41 -04:00
```caddyfile
your.server.name, your.server.name:8448 {
# TCP reverse_proxy
2024-08-24 05:13:43 +02:00
127.0.0.1:6167
2024-08-30 18:54:41 -04:00
# UNIX socket
#reverse_proxy unix//run/conduwuit/conduwuit.sock
2024-03-21 23:16:20 -04:00
}
```
2024-05-08 21:26:05 -04:00
That's it! Just start and enable the service and you're set.
2024-03-21 23:16:20 -04:00
2024-08-30 18:54:41 -04:00
```bash
sudo systemctl enable --now caddy
```
2024-03-21 23:16:20 -04:00
2024-07-03 03:49:33 -04:00
## You're done
2024-03-21 23:16:20 -04:00
2024-04-25 20:21:48 -04:00
Now you can start conduwuit with:
2024-03-21 23:16:20 -04:00
2024-08-30 18:54:41 -04:00
```bash
sudo systemctl start conduwuit
```
2024-03-21 23:16:20 -04:00
Set it to start automatically when your system boots with:
2024-08-30 18:54:41 -04:00
```bash
sudo systemctl enable conduwuit
```
2024-03-21 23:16:20 -04:00
## How do I know it works?
2024-08-24 05:13:43 +02:00
You can open [a Matrix client ](https://matrix.org/ecosystem/clients ), enter your
homeserver and try to register.
2024-03-21 23:16:20 -04:00
2024-08-24 05:13:43 +02:00
You can also use these commands as a quick health check (replace
`your.server.name` ).
2024-03-21 23:16:20 -04:00
2024-08-30 18:54:41 -04:00
```bash
curl https://your.server.name/_conduwuit/server_version
2024-03-21 23:16:20 -04:00
2024-08-30 18:54:41 -04:00
# If using port 8448
curl https://your.server.name:8448/_conduwuit/server_version
```
2024-03-21 23:16:20 -04:00
2024-08-24 05:13:43 +02: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.
2024-03-21 23:16:20 -04:00
# What's next?
## Audio/Video calls
For Audio/Video call functionality see the [TURN Guide ](../turn.md ).
## Appservices
2024-08-24 05:13:43 +02:00
If you want to set up an appservice, take a look at the [Appservice
Guide](../appservices.md).