2024-03-21 23:16:20 -04:00
# Generic deployment documentation
2024-12-15 22:46:56 -05:00
> ### Getting help
2024-03-21 23:16:20 -04:00
>
2025-04-20 23:50:48 +01:00
> If you run into any problems while setting up Continuwuity, ask us in
> `#continuwuity:continuwuity.org` or [open an issue on
> Forgejo](https://forgejo.ellis.link/continuwuation/continuwuity/issues/new).
2024-03-21 23:16:20 -04:00
2025-04-20 23:50:48 +01:00
## Installing Continuwuity
2024-03-21 23:16:20 -04:00
2024-12-15 22:46:56 -05:00
### Static prebuilt binary
You may simply download the binary that fits your machine architecture (x86_64
or aarch64). Run `uname -m` to see what you need.
2024-03-21 23:16:20 -04:00
2025-07-14 19:48:46 +01:00
You can download prebuilt fully static musl binaries from the latest tagged
2025-04-20 23:50:48 +01:00
release [here ](https://forgejo.ellis.link/continuwuation/continuwuity/releases/latest ) or
2025-07-14 19:48:46 +01:00
from the `main` CI branch workflow artifact output. These also include Debian/Ubuntu
2024-12-15 22:46:56 -05:00
packages.
2025-07-14 19:48:46 +01:00
You can download these directly using curl. The `ci-bins` are CI workflow binaries organized by commit
2024-12-15 22:46:56 -05:00
hash/revision, and `releases` are tagged releases. Sort by descending last
2025-07-14 19:48:46 +01:00
modified date to find the latest.
2024-09-17 18:55:08 -04:00
2024-08-24 05:13:43 +02:00
These binaries have jemalloc and io_uring statically linked and included with
2024-09-17 18:55:08 -04:00
them, so no additional dynamic dependencies need to be installed.
2024-03-21 23:16:20 -04:00
2025-07-14 19:48:46 +01:00
For the **best** performance: if you are using an `x86_64` CPU made in the last ~15 years,
we recommend using the `-haswell-` optimized binaries. These set
`-march=haswell` , which provides the most compatible and highest performance with
optimized binaries. The database backend, RocksDB, benefits most from this as it
uses hardware-accelerated CRC32 hashing/checksumming, which is critical
2024-12-15 22:46:56 -05:00
for performance.
### Compiling
2025-07-14 20:24:29 +01:00
Alternatively, you may compile the binary yourself.
### Building with the Rust toolchain
If wanting to build using standard Rust toolchains, make sure you install:
- (On linux) `liburing-dev` on the compiling machine, and `liburing` on the target host
- (On linux) `pkg-config` on the compiling machine to allow finding `liburing`
- A C++ compiler and (on linux) `libclang` for RocksDB
You can build Continuwuity using `cargo build --release --all-features` .
### Building with Nix
If you prefer, you can use Nix (or [Lix ](https://lix.systems )) to build Continuwuity. This provides improved reproducibility and makes it easy to set up a build environment and generate output. This approach also allows for easy cross-compilation.
2024-09-17 18:55:08 -04:00
2024-10-24 23:03:36 -04:00
You can run the `nix build -L .#static-x86_64-linux-musl-all-features` or
`nix build -L .#static-aarch64-linux-musl-all-features` commands based
2024-09-17 18:55:08 -04:00
on architecture to cross-compile the necessary static binary located at
2024-12-15 22:46:56 -05:00
`result/bin/conduwuit` . This is reproducible with the static binaries produced
in our CI.
2025-04-20 23:50:48 +01:00
## Adding a Continuwuity user
2024-03-21 23:16:20 -04:00
2025-07-14 19:48:46 +01:00
While Continuwuity can run as any user, it is better to use dedicated users for
different services. This also ensures that the file permissions
are set up correctly.
2024-03-21 23:16:20 -04:00
2025-04-20 23:50:48 +01:00
In Debian, you can use this command to create a Continuwuity user:
2024-03-21 23:16:20 -04:00
```bash
2025-04-20 23:50:48 +01:00
sudo adduser --system continuwuity --group --disabled-login --no-create-home
2024-03-21 23:16:20 -04:00
```
2024-11-17 11:12:57 +08:00
For distros without `adduser` (or where it's a symlink to `useradd` ):
2024-05-08 21:26:05 -04:00
2024-08-30 18:54:41 -04:00
```bash
2025-04-20 23:50:48 +01:00
sudo useradd -r --shell /usr/bin/nologin --no-create-home continuwuity
2024-08-30 18:54:41 -04:00
```
2024-05-08 21:26:05 -04:00
2024-03-21 23:16:20 -04:00
## Forwarding ports in the firewall or the router
2025-07-14 19:48:46 +01:00
Matrix's default federation port is 8448, and clients must use port 443.
If you would like to use only port 443 or a different port, you will need to set up
delegation. Continuwuity has configuration options for delegation, or you can configure
your reverse proxy to manually serve the necessary JSON files for delegation
2024-11-15 12:58:02 -05:00
(see the `[global.well_known]` config section).
2024-03-21 23:16:20 -04:00
2025-04-20 23:50:48 +01:00
If Continuwuity runs behind a router or in a container and has a different public
2025-07-14 19:48:46 +01:00
IP address than the host system, you need to forward these public ports directly
or indirectly to the port mentioned in the configuration.
2024-03-21 23:16:20 -04:00
2025-07-14 19:48:46 +01:00
Note for NAT users: if you have trouble connecting to your server from inside
your network, check if your router supports "NAT
2024-11-15 12:58:02 -05:00
hairpinning" or "NAT loopback".
If your router does not support this feature, you need to research doing local
DNS overrides and force your Matrix DNS records to use your local IP internally.
This can be done at the host level using `/etc/hosts` . If you need this to be
on the network level, consider something like NextDNS or Pi-Hole.
2024-03-21 23:16:20 -04:00
## Setting up a systemd service
2025-07-14 19:48:46 +01:00
You can find two example systemd units for Continuwuity
2024-12-11 18:22:51 -05:00
[on the configuration page ](../configuration/examples.md#debian-systemd-unit-file ).
2025-07-14 19:48:46 +01:00
You may need to change the `ExecStart=` path to match where you placed the Continuwuity
binary if it is not in `/usr/bin/conduwuit` .
2024-03-21 23:16:20 -04:00
2024-12-11 18:22:51 -05: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.
2025-07-14 19:48:46 +01:00
If you are using a different `database_path` than the systemd unit's
2024-12-11 18:22:51 -05:00
configured default `/var/lib/conduwuit` , you need to add your path to the
2025-07-14 19:48:46 +01:00
systemd unit's `ReadWritePaths=` . You can do this by either directly editing
`conduwuit.service` and reloading systemd, or by running `systemctl edit conduwuit.service`
2024-12-11 18:22:51 -05:00
and entering the following:
```
[Service]
ReadWritePaths=/path/to/custom/database/path
```
2024-10-19 11:12:41 +08:00
2025-04-20 23:50:48 +01:00
## Creating the Continuwuity configuration file
2024-03-21 23:16:20 -04:00
2025-07-14 19:48:46 +01:00
Now you need to create the Continuwuity configuration file in
`/etc/continuwuity/continuwuity.toml` . You can find an example configuration at
2024-08-30 18:54:41 -04:00
[conduwuit-example.toml ](../configuration/examples.md ).
2024-12-11 18:22:51 -05:00
**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
2025-07-14 19:48:46 +01:00
If you are using a dedicated user for Continuwuity, you need to allow it to
read the configuration. To do this, run:
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/
2025-04-20 23:50:48 +01:00
sudo chown -R continuwuity:continuwuity /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
2025-07-14 19:48:46 +01:00
We recommend Caddy as a reverse proxy because it is trivial to use and handles TLS certificates, reverse proxy headers, etc. transparently with proper defaults.
2025-03-10 21:27:53 +00:00
For other software, please refer to their respective documentation or online guides.
2024-09-17 18:55:08 -04:00
2025-03-10 21:27:53 +00:00
### Caddy
2024-03-21 23:16:20 -04:00
2025-03-10 21:27:53 +00:00
After installing Caddy via your preferred method, create `/etc/caddy/conf.d/conduwuit_caddyfile`
2025-07-14 19:48:46 +01:00
and enter the following (substitute your actual server name):
2024-10-27 12:19:45 -04:00
2025-03-10 21:27:53 +00:00
```caddyfile
your.server.name, your.server.name:8448 {
# TCP reverse_proxy
reverse_proxy 127.0.0.1:6167
# UNIX socket
#reverse_proxy unix//run/conduwuit/conduwuit.sock
}
```
2024-10-27 12:19:45 -04:00
2025-03-10 21:27:53 +00:00
That's it! Just start and enable the service and you're set.
2024-09-17 18:55:08 -04:00
2025-03-10 21:27:53 +00:00
```bash
sudo systemctl enable --now caddy
```
### Other Reverse Proxies
2025-07-14 19:48:46 +01:00
As we prefer our users to use Caddy, we do not provide configuration files for other proxies.
2024-09-17 18:55:08 -04:00
2025-07-14 19:48:46 +01:00
You will need to reverse proxy everything under the following routes:
2024-09-17 18:55:08 -04:00
- `/_matrix/` - core Matrix C-S and S-S APIs
2025-07-12 03:50:26 -05:00
- `/_conduwuit/` and/or `/_continuwuity/` - ad-hoc Continuwuity routes such as `/local_user_count` and
2024-09-17 18:55:08 -04:00
`/server_version`
You can optionally reverse proxy the following individual routes:
- `/.well-known/matrix/client` and `/.well-known/matrix/server` if using
2025-04-20 23:50:48 +01:00
Continuwuity to perform delegation (see the `[global.well_known]` config section)
- `/.well-known/matrix/support` if using Continuwuity to send the homeserver admin
2024-09-17 18:55:08 -04:00
contact and support page (formerly known as MSC1929)
- `/` if you would like to see `hewwo from conduwuit woof!` at the root
2024-06-02 18:00:38 -04:00
2024-11-10 20:20:27 -05:00
See the following spec pages for more details on these files:
- [`/.well-known/matrix/server` ](https://spec.matrix.org/latest/client-server-api/#getwell-knownmatrixserver )
- [`/.well-known/matrix/client` ](https://spec.matrix.org/latest/client-server-api/#getwell-knownmatrixclient )
- [`/.well-known/matrix/support` ](https://spec.matrix.org/latest/client-server-api/#getwell-knownmatrixsupport )
Examples of delegation:
- < https: // puppygock . gay /. well-known / matrix / server >
- < https: // puppygock . gay /. well-known / matrix / client >
2025-03-10 21:27:53 +00:00
For Apache and Nginx there are many examples available online.
2024-03-21 23:16:20 -04:00
2025-07-14 19:48:46 +01:00
Lighttpd is not supported as it appears to interfere with the `X-Matrix` Authorization
header, making federation non-functional. If you find a workaround, please share it so we can add it to this documentation.
2024-03-21 23:16:20 -04:00
2025-07-14 19:48:46 +01:00
If using Apache, you need to use `nocanon` in your `ProxyPass` directive to prevent httpd from interfering with the `X-Matrix` header (note that Apache is not ideal as a general reverse proxy, so we discourage using it if alternatives are available).
2024-03-21 23:16:20 -04:00
2025-07-14 19:48:46 +01:00
If using Nginx, you need to pass the request URI to Continuwuity using `$request_uri` , like this:
2025-03-10 21:27:53 +00:00
- `proxy_pass http://127.0.0.1:6167$request_uri;`
- `proxy_pass http://127.0.0.1:6167;`
2024-03-21 23:16:20 -04:00
2025-07-14 19:48:46 +01:00
Nginx users need to increase the `client_max_body_size` setting (default is 1M) to match the
2025-03-10 21:27:53 +00:00
`max_request_size` defined in conduwuit.toml.
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
2025-04-20 23:50:48 +01:00
Now you can start Continuwuity 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
2025-07-14 19:48:46 +01:00
homeserver address, 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-09-17 18:55:08 -04:00
# If federation is enabled
curl https://your.server.name:8448/_matrix/federation/v1/version
2024-08-30 18:54:41 -04:00
```
2024-03-21 23:16:20 -04:00
2025-07-14 19:48:46 +01:00
- To check if your server can communicate with other homeservers, use the
2024-08-24 05:13:43 +02:00
[Matrix Federation Tester ](https://federationtester.matrix.org/ ). If you can
2025-07-14 19:48:46 +01:00
register but cannot join federated rooms, check your configuration and verify
that 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).