Compare commits
180 Commits
docs-overh
...
next
| Author | SHA1 | Date |
|---|---|---|
|
|
9b57c89df6 | 4 years ago |
|
|
34d3f74f36 | 4 years ago |
|
|
11a21fc136 | 4 years ago |
|
|
0183d003d0 | 4 years ago |
|
|
f712455047 | 4 years ago |
|
|
58ea081762 | 4 years ago |
|
|
bffddbd487 | 4 years ago |
|
|
41fef1da64 | 4 years ago |
|
|
892a0525f2 | 4 years ago |
|
|
1fc616320a | 4 years ago |
|
|
14a178d783 | 4 years ago |
|
|
339a26f56c | 4 years ago |
|
|
ca724b6340 | 4 years ago |
|
|
9bfc7b34b6 | 4 years ago |
|
|
afa5d449c6 | 4 years ago |
|
|
2fff720df3 | 4 years ago |
|
|
da00f611e9 | 4 years ago |
|
|
9fccbb014a | 4 years ago |
|
|
109892b4b7 | 4 years ago |
|
|
24a835647c | 4 years ago |
|
|
c4bce1d0c7 | 4 years ago |
|
|
9b63708685 | 4 years ago |
|
|
86177faae7 | 5 years ago |
|
|
2a749c1e99 | 5 years ago |
|
|
5ae753b2e7 | 5 years ago |
|
|
743bdbe961 | 5 years ago |
|
|
d5d25fb064 | 5 years ago |
|
|
8087a26a35 | 5 years ago |
|
|
bbe16f8467 | 5 years ago |
|
|
50f931a2fd | 5 years ago |
|
|
1541b93f45 | 5 years ago |
|
|
ccf501a420 | 5 years ago |
|
|
6f70beb78c | 5 years ago |
|
|
259fc580ca | 5 years ago |
|
|
55d78b1914 | 5 years ago |
|
|
484a044b50 | 5 years ago |
|
|
2264a5f945 | 5 years ago |
|
|
e88929e154 | 5 years ago |
|
|
d996d1b0e6 | 5 years ago |
|
|
dc8bc4a880 | 5 years ago |
|
|
87694f4369 | 5 years ago |
|
|
335027e739 | 5 years ago |
|
|
0ccda5f1c7 | 5 years ago |
|
|
9082a531c9 | 5 years ago |
|
|
91afa1e0e0 | 5 years ago |
|
|
f2ef5677e0 | 5 years ago |
|
|
1c4d9af586 | 5 years ago |
|
|
09895a20c8 | 5 years ago |
|
|
636db8cfaa | 5 years ago |
|
|
6bc8fb2ae7 | 5 years ago |
|
|
5b23d3d06e | 5 years ago |
|
|
47f3263396 | 5 years ago |
|
|
d38f9b5f01 | 5 years ago |
|
|
fa616342b6 | 5 years ago |
|
|
34fa7fee05 | 5 years ago |
|
|
e8d998cedf | 5 years ago |
|
|
565fe3a7dd | 5 years ago |
|
|
5c02dc7830 | 5 years ago |
|
|
159e22e450 | 5 years ago |
|
|
ab472e9b7c | 5 years ago |
|
|
31264e3d1d | 5 years ago |
|
|
422bd09e32 | 5 years ago |
|
|
b64538c6f1 | 5 years ago |
|
|
178451e9b5 | 5 years ago |
|
|
583a966f6e | 5 years ago |
|
|
cbee7fe111 | 5 years ago |
|
|
d68c93b5fa | 5 years ago |
|
|
979ec6b4fa | 5 years ago |
|
|
910ad7fed1 | 5 years ago |
|
|
2c8412fe58 | 5 years ago |
|
|
06b0c9267f | 5 years ago |
|
|
00927a7ce3 | 5 years ago |
|
|
4aacafc298 | 5 years ago |
|
|
23c5ec8099 | 5 years ago |
|
|
562a2524d7 | 5 years ago |
|
|
51245d34f1 | 5 years ago |
|
|
4a773a1096 | 5 years ago |
|
|
5821b8e705 | 5 years ago |
|
|
0737bc021f | 5 years ago |
|
|
487046571c | 5 years ago |
|
|
2d242523fc | 5 years ago |
|
|
bbe36810ec | 5 years ago |
|
|
a449b1d73f | 5 years ago |
|
|
71341ea05a | 5 years ago |
|
|
73b764322f | 5 years ago |
|
|
a1f51440e2 | 5 years ago |
|
|
0d6ae2e1e7 | 5 years ago |
|
|
d0baca44f8 | 5 years ago |
|
|
5536bfdca5 | 5 years ago |
|
|
3357bbec1e | 5 years ago |
|
|
102ff574ea | 5 years ago |
|
|
2770ce2cf6 | 5 years ago |
|
|
7cd7f1923f | 5 years ago |
|
|
43d693ca19 | 5 years ago |
|
|
875b345a5f | 5 years ago |
|
|
17adf096e9 | 5 years ago |
|
|
487601a249 | 5 years ago |
|
|
27788af022 | 5 years ago |
|
|
4b39d7cb64 | 5 years ago |
|
|
c53d79e287 | 5 years ago |
|
|
984ad5ecd6 | 5 years ago |
|
|
b546a5bf15 | 5 years ago |
|
|
a87519fb71 | 5 years ago |
|
|
9c3f1a9272 | 5 years ago |
|
|
8518d59a0b | 5 years ago |
|
|
4e68c22457 | 5 years ago |
|
|
73d876643c | 5 years ago |
|
|
22779c21d3 | 5 years ago |
|
|
8c584887c9 | 5 years ago |
|
|
33738dbbc2 | 5 years ago |
|
|
a6bb9bbe68 | 5 years ago |
|
|
b9eb39a9c6 | 5 years ago |
|
|
364820aae4 | 5 years ago |
|
|
ec38411620 | 5 years ago |
|
|
9ec8b7f2b3 | 5 years ago |
|
|
a08ea15695 | 5 years ago |
|
|
49dd3567c6 | 5 years ago |
|
|
69df9a0145 | 5 years ago |
|
|
d0d47675d8 | 5 years ago |
|
|
bd4ea14a29 | 5 years ago |
|
|
9033cc86aa | 5 years ago |
|
|
1b25e78e3a | 5 years ago |
|
|
d57c19802d | 5 years ago |
|
|
9ded40e983 | 5 years ago |
|
|
a469ca0461 | 5 years ago |
|
|
632a1343eb | 5 years ago |
|
|
00c9ad12bd | 5 years ago |
|
|
1601027605 | 5 years ago |
|
|
afca61fe7c | 5 years ago |
|
|
9bff276fa9 | 5 years ago |
|
|
19b89ab91f | 5 years ago |
|
|
0330d3e270 | 5 years ago |
|
|
a1e8a99db5 | 5 years ago |
|
|
33172a70e6 | 5 years ago |
|
|
1b56a7bbfd | 5 years ago |
|
|
d485eb5a24 | 5 years ago |
|
|
41d07be97b | 5 years ago |
|
|
bef4fe50ce | 5 years ago |
|
|
9152b877a7 | 5 years ago |
|
|
9f8c45c763 | 5 years ago |
|
|
5800e9b797 | 5 years ago |
|
|
5aa56b92ee | 5 years ago |
|
|
dd87066546 | 5 years ago |
|
|
30b309b708 | 5 years ago |
|
|
d5695fb9fe | 5 years ago |
|
|
81e056417c | 5 years ago |
|
|
72dd95f500 | 5 years ago |
|
|
b6e755f67e | 5 years ago |
|
|
4f8cf3bed4 | 5 years ago |
|
|
b3ea6adc9c | 5 years ago |
|
|
6d83954c40 | 5 years ago |
|
|
667ffb4239 | 5 years ago |
|
|
48494c9464 | 5 years ago |
|
|
2ef23b213a | 5 years ago |
|
|
33481ec062 | 5 years ago |
|
|
3b78e43a18 | 5 years ago |
|
|
4956fb9fba | 5 years ago |
|
|
b09499c2df | 5 years ago |
|
|
46d8a46e1f | 5 years ago |
|
|
bf7e019a68 | 5 years ago |
|
|
75ba8bb565 | 5 years ago |
|
|
0823506d05 | 5 years ago |
|
|
2c3bee34a0 | 5 years ago |
|
|
a4310f840e | 5 years ago |
|
|
5bd5b41c70 | 5 years ago |
|
|
f9a2edc0dd | 5 years ago |
|
|
ecd1e45a44 | 5 years ago |
|
|
1d46569929 | 5 years ago |
|
|
1e3a8ca35d | 5 years ago |
|
|
0cb22996be | 5 years ago |
|
|
38effda799 | 5 years ago |
|
|
3cf0145bc5 | 5 years ago |
|
|
3eabaa2a95 | 5 years ago |
|
|
31f60ad6fd | 5 years ago |
|
|
41dd620d74 | 5 years ago |
|
|
9410d3ef9c | 5 years ago |
|
|
665aee11c0 | 5 years ago |
|
|
5173d0deb5 | 5 years ago |
|
|
c2c6a8673e | 5 years ago |
|
|
096e0971f1 | 5 years ago |
71 changed files with 2044 additions and 2231 deletions
@ -0,0 +1,86 @@
@@ -0,0 +1,86 @@
|
||||
# Setting up Appservices |
||||
|
||||
## Getting help |
||||
|
||||
If you run into any problems while setting up an Appservice, write an email to `timo@koesters.xyz`, ask us in `#conduit:matrix.org` or [open an issue on GitLab](https://gitlab.com/famedly/conduit/-/issues/new). |
||||
|
||||
## Set up the appservice - general instructions |
||||
|
||||
Follow whatever instructions are given by the appservice. This usually includes |
||||
downloading, changing its config (setting domain, homeserver url, port etc.) |
||||
and later starting it. |
||||
|
||||
At some point the appservice guide should ask you to add a registration yaml |
||||
file to the homeserver. In Synapse you would do this by adding the path to the |
||||
homeserver.yaml, but in Conduit you can do this from within Matrix: |
||||
|
||||
First, go into the #admins room of your homeserver. The first person that |
||||
registered on the homeserver automatically joins it. Then send a message into |
||||
the room like this: |
||||
|
||||
@conduit:your.server.name: register_appservice |
||||
``` |
||||
paste |
||||
the |
||||
contents |
||||
of |
||||
the |
||||
yaml |
||||
registration |
||||
here |
||||
``` |
||||
|
||||
You can confirm it worked by sending a message like this: |
||||
`@conduit:your.server.name: list_appservices` |
||||
|
||||
The @conduit bot should answer with `Appservices (1): your-bridge` |
||||
|
||||
Then you are done. Conduit will send messages to the appservices and the |
||||
appservice can send requests to the homeserver. You don't need to restart |
||||
Conduit, but if it doesn't work, restarting while the appservice is running |
||||
could help. |
||||
|
||||
## Appservice-specific instructions |
||||
|
||||
### Tested appservices |
||||
|
||||
These appservices have been tested and work with Conduit without any extra steps: |
||||
|
||||
- [matrix-appservice-discord](https://github.com/Half-Shot/matrix-appservice-discord) |
||||
- [mautrix-hangouts](https://github.com/mautrix/hangouts/) |
||||
- [mautrix-telegram](https://github.com/mautrix/telegram/) |
||||
|
||||
### [mautrix-signal](https://github.com/mautrix/signal) |
||||
|
||||
There are a few things you need to do, in order for the Signal bridge (at least |
||||
up to version `0.2.0`) to work. How you do this depends on whether you use |
||||
Docker or `virtualenv` to run it. In either case you need to modify |
||||
[portal.py](https://github.com/mautrix/signal/blob/master/mautrix_signal/portal.py). |
||||
Do this **before** following the bridge installation guide. |
||||
|
||||
1. **Create a copy of `portal.py`**. Go to |
||||
[portal.py](https://github.com/mautrix/signal/blob/master/mautrix_signal/portal.py) |
||||
at [mautrix-signal](https://github.com/mautrix/signal) (make sure you change to |
||||
the correct commit/version of mautrix-signal you're using) and copy its |
||||
content. Create a new `portal.py` on your system and paste the content in. |
||||
2. **Patch the copy**. Exact line numbers may be slightly different, look nearby if they don't match: |
||||
- [Line 1020](https://github.com/mautrix/signal/blob/4ea831536f154aba6419d13292479eb383ea3308/mautrix_signal/portal.py#L1020) |
||||
```diff |
||||
--- levels.users[self.main_intent.mxid] = 9001 if is_initial else 100 |
||||
+++ levels.users[self.main_intent.mxid] = 100 if is_initial else 100 |
||||
``` |
||||
- [Between lines 1041 and 1042](https://github.com/mautrix/signal/blob/4ea831536f154aba6419d13292479eb383ea3308/mautrix_signal/portal.py#L1041-L1042) add a new line: |
||||
```diff |
||||
"type": str(EventType.ROOM_POWER_LEVELS), |
||||
+++ "state_key": "", |
||||
"content": power_levels.serialize(), |
||||
``` |
||||
3. **Deploy the patch**. This is different depending on how you have `mautrix-signal` deployed: |
||||
- [*If using virtualenv*] Copy your patched `portal.py` to `./lib/python3.7/site-packages/mautrix_signal/portal.py` (the exact version of Python may be different on your system). |
||||
- [*If using Docker*] Map the patched `portal.py` into the `mautrix-signal` container: |
||||
|
||||
```yaml |
||||
volumes: |
||||
- ./your/path/on/host/portal.py:/usr/lib/python3.9/site-packages/mautrix_signal/portal.py |
||||
``` |
||||
4. Now continue with the [bridge installation instructions ](https://docs.mau.fi/bridges/index.html) and the general bridge notes above. |
||||
@ -0,0 +1,11 @@
@@ -0,0 +1,11 @@
|
||||
Install docker: |
||||
|
||||
``` |
||||
$ sudo apt install docker |
||||
$ sudo usermod -aG docker $USER |
||||
$ exec sudo su -l $USER |
||||
$ sudo systemctl start docker |
||||
$ cargo install cross |
||||
$ cross build --release --target armv7-unknown-linux-musleabihf |
||||
``` |
||||
The cross-compiled binary is at target/armv7-unknown-linux-musleabihf/release/conduit |
||||
@ -1,16 +0,0 @@
@@ -1,16 +0,0 @@
|
||||
[book] |
||||
title = "Conduit Docs" |
||||
author = "The Conduit contributors" |
||||
description = "Conduit is a simple, fast and reliable chat server for the Matrix protocol" |
||||
language = "en" |
||||
src = "docs" |
||||
|
||||
[rust] |
||||
edition = "2018" |
||||
|
||||
[build] |
||||
build-dir = "public" |
||||
create-missing = true |
||||
|
||||
[output.html.search] |
||||
limit-results = 15 |
||||
@ -1,16 +0,0 @@
@@ -1,16 +0,0 @@
|
||||
# Summary |
||||
|
||||
[Home](index.md) |
||||
|
||||
- [Installation](installation.md) |
||||
- [Prerequisites](installation/prerequisites.md) |
||||
- [From Binaries](installation/manual.md) |
||||
- [From Packages](installation/packages.md) |
||||
- [With Docker](installation/docker.md) |
||||
- [Configuration](configuration.md) |
||||
- [Config options](configuration/configuration.md) |
||||
- [Appservices](configuration/appservices.md) |
||||
- [Contribute](contribute.md) |
||||
- [Basics](development/basics.md) |
||||
- [Cross compilation](development/cross-compilation.md) |
||||
- [Tests & CI](development/tests-ci.md) |
||||
@ -1,2 +0,0 @@
@@ -1,2 +0,0 @@
|
||||
# Configuring Conduit |
||||
|
||||
@ -1,220 +0,0 @@
@@ -1,220 +0,0 @@
|
||||
# Configuring Conduit |
||||
|
||||
Conduit can be configured via a config file (conventionally called Conduit.toml) or environment variables. If a config |
||||
file exists and environment variables are set, environment variables overwrite config options. |
||||
|
||||
You absolutely need to set the environment variable `CONDUIT_CONFIG_FILE` to either point to a config file ( |
||||
e.g. `CONDUIT_CONFIG_FILE=/etc/conduit/Conduit.toml`) or to an empty string (`CONDUIT_CONFIG_FILE=''`) if you want to |
||||
configure Conduit with just environment variables. |
||||
|
||||
## Mandatory config options |
||||
|
||||
Mandatory variables must be configured in order for Conduit to run properly. |
||||
|
||||
### Server Name |
||||
|
||||
- Config file key: `server_name` |
||||
- Envirnoment variable: `CONDUIT_SERVER_NAME` |
||||
- Default value: _None, you will need to choose your own._ |
||||
|
||||
The server_name is the name of this server. It is used as a suffix for user and room ids. Example: If you set it |
||||
to `conduit.rs`, your usernames will look like `@somebody:conduit.rs`. |
||||
|
||||
The Conduit server needs to be reachable at https://your.server.name/ on port 443 (client-server) and 8448 ( |
||||
server-server) OR you can create /.well-known files to redirect requests. See |
||||
the [Client-Server specs](https://matrix.org/docs/spec/client_server/latest#get-well-known-matrix-client) and |
||||
the [Server-Server specs](https://matrix.org/docs/spec/server_server/r0.1.4#get-well-known-matrix-server) for more |
||||
information. |
||||
|
||||
### Database Path |
||||
|
||||
- Config file key: `database_path` |
||||
- Envirnoment variable: `CONDUIT_DATABASE_PATH` |
||||
- Default value: _None, but many people like to use `/var/lib/conduit/`_. |
||||
|
||||
A **directory** where Conduit stores its database and media files. This directory must exist, have enough free space and |
||||
be readable and writable by the user Conduit is running as. |
||||
|
||||
What does _enough free space_ mean? It heavily on the amount of messages your Conduit server will see and the amount and |
||||
size of media files users on your Conduit server send. As a rule of thumb, you should have at least 10 GB of free space |
||||
left. You should be comfortable for quite some time with 50 GB. |
||||
|
||||
### TCP Port |
||||
|
||||
- Config file key: `port` |
||||
- Environment variable: `CONDUIT_PORT` |
||||
- Default value: _None, but many people like to use `6167`_. |
||||
|
||||
The TCP port Conduit will listen on for connections. The port needs to be free (no other program is listeing on it). |
||||
|
||||
Conduit does currently (2021-09) not offer HTTPS by itself. Only unencrypted HTTP requests will be accepted on this |
||||
port. Unless you know what you are doing, this port should not be exposed to the internet. Instead, use a reverse proxy |
||||
capable of doing TLS to offer your Conduit server to the internet via HTTPS. See [TODO] for example configurations. |
||||
|
||||
## Optional configuration options |
||||
|
||||
These config options come with defaults and don't need to be configured for Conduit to run. That said, you should still |
||||
check them to make sure that your Conduit server behaves like you want it to do. |
||||
|
||||
### Maximum request size |
||||
|
||||
- Config file key: `max_request_size` |
||||
- Environment variable: `CONDUIT_MAX_REQUEST_SIZE` |
||||
- Default value: `20_000_000` (~= 20 MB) |
||||
|
||||
The maximum size in bytes for incoming requests to Conduit. You can use underscores to improve readability. |
||||
|
||||
This will effectively limit the size for images, videos and other files users on your Conduit server can send. |
||||
|
||||
### Allow Registration? |
||||
|
||||
- Config file key: `allow_registration` |
||||
- Environment variable: `CONDUIT_ALLOW_REGISTRATION` |
||||
- Default value: `true` |
||||
- Possible values: `true`, `false` |
||||
|
||||
It this is set to `false`, no new users can register accounts on your Conduit server. Already registered users will not |
||||
be affected from this setting and can continue to user your server. |
||||
|
||||
The first user to ever register on your Conduit server will be considered the admin account and is automatically invited |
||||
into the admin room. |
||||
|
||||
### Allow Encryption? |
||||
|
||||
- Config file key: `allow_encryption` |
||||
- Environment variable: `CONDUIT_ALLOW_ENCRYPTION` |
||||
- Default value: `true` |
||||
- Possible values: `true`, `false` |
||||
|
||||
If this is set to `false`, Conduit disables the ability for users to create encrypted chats. Existing encrypted chats |
||||
may continue to work. |
||||
|
||||
### Allow federation? |
||||
|
||||
- Config file key: `allow_federation` |
||||
- Environment variable: `CONDUIT_ALLOW_FEDERATION` |
||||
- Default value: `false` |
||||
- Possible values: `true`, `false` |
||||
|
||||
Federation means that users from different Matrix servers can chat with each other. E.g. `@mathew:matrix.org` can chat |
||||
with `@timo:conduit.rs`. |
||||
|
||||
If this option is set to `false`, users on your Conduit server can only talk with other users on your Conduit server. |
||||
|
||||
Federation with other servers needs to happen over HTTPS, so make sure you have set up a reverse proxy. |
||||
|
||||
### Jaeger Tracing |
||||
|
||||
- Config file key: `allow_jaeger` |
||||
- Environment variable: `CONDUIT_ALLOW_JAEGER` |
||||
- Default value: `false` |
||||
- Possible values: `true`, `false` |
||||
|
||||
Enable Jaeger to support monitoring and troubleshooting through Jaeger. |
||||
|
||||
If you don't know what Jaeger is, you can safely leave this set to `false`. |
||||
|
||||
### Trusted servers |
||||
|
||||
- Config file key: `trusted_servers` |
||||
- Environment variable: `CONDUIT_TRUSTED_SERVERS` |
||||
- Default value: `[]` |
||||
- Possible values: JSON-Array of server domains, e.g. `["matrix.org"]` or `["matrix.org", "conduit.rs"]`. |
||||
|
||||
Matrix servers have so-called "server keys", which authenticate messages from their users. Because your Conduit server |
||||
might not know the server keys from every server it encounters, it can ask a _trusted server_ for them. This speeds |
||||
things up for rooms with people from a lot of different servers. |
||||
|
||||
You should only set this to include trustworthy servers. Most people consider a good default to be `["matrix.org"]`. |
||||
|
||||
Only relevant if you have federation enabled. |
||||
|
||||
### Limit amount of concurrent requests |
||||
|
||||
- Config file key: `max_concurrent_requests` |
||||
- Environment variable: `CONDUIT_MAX_CONCURRENT_REQUESTS` |
||||
- Default value: `100` |
||||
- Suggested values: `1` - `1000` (u16) |
||||
|
||||
How many requests Conduit can make at the same time. This affects federation with other Matrix servers, push |
||||
notifications and app_services. |
||||
|
||||
// TODO Timo: When does it make sense to change this? |
||||
|
||||
### Configure logging |
||||
|
||||
- Config file key: `log` |
||||
- Environment variable: `CONDUIT_LOG` |
||||
- Default value: `info,state_res=warn,rocket=off,_=off,sled=off` |
||||
|
||||
Configures which kind of messages Conduit logs. |
||||
|
||||
> // TODO: Better and more thorough explanation |
||||
|
||||
### Worker threads |
||||
|
||||
- Config file key: `workers` |
||||
- Environment variable: `CONDUIT_WORKERS` |
||||
- Default value: cpu core count * 2 |
||||
- Possible values: // TODO |
||||
|
||||
> // TODO: Which thing exactly threads? What not? |
||||
|
||||
### Listening address |
||||
|
||||
- Config file key: `address` |
||||
- Environment variable: `CONDUIT_ADDRESS` |
||||
- Default value: `127.0.0.1` |
||||
- Possible values: Valid IP addresses. |
||||
|
||||
Which IP address conduit is listening on. 127.0.0.1 means that Conduit can only be accessed from the same server or |
||||
through a reverse proxy on that server. If you want it to be accessible from any network interface (which you should |
||||
not, because other matrix servers should talk to your Conduit via a reverse proxy and not directly), you can set it |
||||
to `0.0.0.0`. |
||||
|
||||
### Database cache capacity |
||||
|
||||
- Config file key: `db_cache_capacity_mb` |
||||
- Environment variable: `CONDUIT_DB_CACHE_CAPACITY_MB` |
||||
- Default value: `200` |
||||
- Possible values: `true`, `false` |
||||
|
||||
The total amount of memory (RAM) that the database cache will be able to use. |
||||
|
||||
> // TODO: this needs clearification: In RAM or on disk and for what exactly? |
||||
|
||||
### PDU cache capacity |
||||
|
||||
- Config file key: `pdu_cache_capacity` |
||||
- Environment variable: `CONDUIT_PDU_CACHE_CAPACITY` |
||||
- Default value: `100_000` |
||||
- Suggested values: `1_000` - `1_000_000` (u32) |
||||
|
||||
The total capacity (read: number of items) the pdu cache can hold in memory. Setting this to a lower number may slow |
||||
Conduit down, as it must fetch more data from the database. Increasing it will mean that Conduit will start to use more |
||||
memory as the cache slowly fills up. |
||||
|
||||
### SQLite WAL clean interval |
||||
|
||||
- Config file key: `sqlite_wal_clean_second_interval` |
||||
- Environment variable: `CONDUIT_SQLITE_WAL_CLEAN_SECOND_INTERVAL` |
||||
- Default value: `60` (every 60 seconds) |
||||
- Suggested values: `1` - `3600` (u32) |
||||
|
||||
How often the WAL file should be cleaned up. The WAL file will be written to until cleaned up, after which it restarts |
||||
writing from the beginning. |
||||
|
||||
The file's size will correspond to how long it could write to it in one go. (e.g. if conduit writes 100MB of data to the |
||||
database inbetween that period, the file will grow to 100MB). You can read more about that in |
||||
the [SQLite Docs](https://www.sqlite.org/draft/wal.html). |
||||
|
||||
Reducing this down too much can offset the benefits of using a WAL at all. However, having this too high can result in a |
||||
large WAL file. |
||||
|
||||
Only relevant when using SQLite as the database. |
||||
|
||||
### Still undocumented config options |
||||
|
||||
- `tracing_flame` |
||||
- `proxy` |
||||
- `jwt_secret` |
||||
@ -1,13 +0,0 @@
@@ -1,13 +0,0 @@
|
||||
# Cross compilation |
||||
|
||||
Install docker: |
||||
|
||||
```bash |
||||
sudo apt install docker |
||||
sudo usermod -aG docker $USER |
||||
exec sudo su -l $USER |
||||
sudo systemctl start docker |
||||
cargo install cross |
||||
cross build --release --target armv7-unknown-linux-musleabihf |
||||
``` |
||||
The cross-compiled binary is at target/armv7-unknown-linux-musleabihf/release/conduit |
||||
@ -1,52 +0,0 @@
@@ -1,52 +0,0 @@
|
||||
# Conduit |
||||
|
||||
Conduit is a simple, fast and reliable chat server for the [Matrix] protocol written in [Rust]. |
||||
|
||||
----- |
||||
> Note: This project is work-in-progress. Do *not* rely on it yet. |
||||
|
||||
## What is Matrix? |
||||
|
||||
[Matrix] is an open network for secure and decentralized |
||||
communication. It allows you to chat with friends even if they are using |
||||
another servers and client. You can even use bridges to communicate with users |
||||
outside of Matrix, like a community on Discord or your family on Hangouts. |
||||
|
||||
## Why Conduit? |
||||
|
||||
Conduit is an open-source server implementation of the [Matrix |
||||
Specification] with a focus on easy setup and low |
||||
system requirements, making it very easy to set up. |
||||
|
||||
Other server implementations try to be extremely scalable, which makes sense if |
||||
the goal is to support millions of users on a single instance, but makes |
||||
smaller deployments a lot more inefficient. Conduit tries to keep it simple but |
||||
takes full advantage of that, for example by using an in-memory database for |
||||
[huge performance gains](https://github.com/timokoesters/romeo-and-juliet-benchmark). |
||||
|
||||
The future for Conduit in peer-to-peer Matrix (every client contains a server) |
||||
is also bright. |
||||
|
||||
Conduit tries to be reliable by using the Rust programming language and paying |
||||
close attention to error handling to make sure that evil clients, misbehaving |
||||
servers or even a partially broken database will not cause the whole server to |
||||
stop working. |
||||
|
||||
## Chat with us! |
||||
|
||||
We have a room on Matrix: [#conduit:matrix.org](https://matrix.to/#/#conduit:matrix.org) |
||||
|
||||
You can also contact us using: |
||||
- Matrix: [@timo:koesters.xyz](https://matrix.to/#/@timo:koesters.xyz) |
||||
- Email: [conduit@koesters.xyz](mailto:conduit@koesters.xyz) |
||||
|
||||
|
||||
## Donate |
||||
|
||||
Liberapay: <https://liberapay.com/timokoesters/>\ |
||||
Bitcoin: `bc1qnnykf986tw49ur7wx9rpw2tevpsztvar5x8w4n` |
||||
|
||||
|
||||
[Matrix]: https://matrix.org/ |
||||
[Rust]: https://rust-lang.org |
||||
[Matrix Specification]: https://matrix.org/docs/spec |
||||
@ -1,12 +0,0 @@
@@ -1,12 +0,0 @@
|
||||
# Distribution packages |
||||
|
||||
## Debian / Ubuntu |
||||
|
||||
[@paul:luon.net](https://matrix.to/#/@paul:luon.net) plans to package Conduit for Debian as soon as it reaches 1.0. |
||||
Until it is available in the official repos, you can install the development version of it manually: |
||||
|
||||
```bash |
||||
sudo apt-get install ca-certificates |
||||
wget --https-only -O /tmp/conduit.deb https://gitlab.com/famedly/conduit/-/jobs/artifacts/master/raw/conduit-x86_64-unknown-linux-gnu.deb?job=build:cargo-deb:x86_64-unknown-linux-gnu |
||||
sudo dpkg -i /tmp/conduit.deb |
||||
``` |
||||
@ -1,31 +0,0 @@
@@ -1,31 +0,0 @@
|
||||
# Prerequisites for running Conduit |
||||
|
||||
You'll need: |
||||
|
||||
- A domain. Commonly cost about $10/year. |
||||
- A Linux server with a stable internet connection, at least 500 MB of RAM and some disk space for messages and |
||||
attachments. Commonly start at $5/month. |
||||
- Some basic knowledge about using a shell, SSH and configuring and protecting a server. |
||||
|
||||
|
||||
## A word of caution: |
||||
|
||||
Don't underestimate the toll of administrating your own server. |
||||
Conduit can't protect your conversations if your server gets compromised or deleted. |
||||
|
||||
Make sure that you got: |
||||
|
||||
- Automatic security updates |
||||
- On Ubuntu/Debian: Set up unattended-upgrades |
||||
- On RHEL/CentOS: Have a look at yum-cron |
||||
- A firewall blocking all but the needed incoming ports |
||||
- ufw is an easy interface for the linux firewall |
||||
- Protection against automatic attacks |
||||
- fail2ban scans logs and bans IPs which try to brute force their way into your server. |
||||
- Disable ssh login for root and switch from password to key based authentication. |
||||
- Automated backups |
||||
- Most VPS hosting companies offer whole server backups for a small fee. |
||||
- Or run your own backup with something like borg. |
||||
- A way to get notified if your disk fills up. |
||||
- If you send too much cat videos to your friends, Conduit might at some point become unable to |
||||
store any important messages. |
||||
@ -1,40 +0,0 @@
@@ -1,40 +0,0 @@
|
||||
# About Matrix Homeservers |
||||
|
||||
Matrix homeservers manage its users chats. Every Matrix username includes the homserver it belongs to: |
||||
`@alice:matrix.org` means that the `matrix.org` homeserver hosts a user called `@alice`. |
||||
Every time someone chats with Alice, the `matrix.org` homeserver stores these messages. |
||||
When `@alice:matrix.org` talks with `@adelaide:matrix.org`, that's easy. Both users use the same server. |
||||
|
||||
But how can `@bob:vector.tld`, who uses the `vector.tld` homeserver, exchange messages with `@alice:matrix.org`? |
||||
This is where it get's a bit more complicated. |
||||
|
||||
## Matrix Homeserver discovery |
||||
|
||||
The Matrix specification specifies multiple ways how servers can discover and then talk to each other. |
||||
Let's look at the most common one: |
||||
|
||||
### .well-known files |
||||
|
||||
At first, the only information a server has about a user (e.g. `@bob:vector.tld`) is its homeserver name: `vector.tld`. |
||||
It then makes a HTTP GET request to `https://vector.tld/.well-known/matrix/server`. |
||||
In the ideal case, this file contains a content like this: |
||||
|
||||
```json |
||||
{ |
||||
"m.server": "matrix.vector.tld:443" |
||||
} |
||||
``` |
||||
|
||||
This translates to: The matrix homeserver software for users with a username ending on `vector.tld` |
||||
can be found at the address `matrix.vector.tld` at port 443 (which is the common port for HTTPS). |
||||
|
||||
The homeserver on it's quest to find `@bob:vector.tld` now contacts `matrix.vector.tld:443` and is then |
||||
able to exchange chat messages with it. |
||||
|
||||
|
||||
### Why so complicated? |
||||
|
||||
Organizations often don't want to run their Matrix server on the same machine that hosts their website, |
||||
but `@foo:matrix.evil.corp` usernames are ugly and everyone wants to be `@foo:evil.corp`. |
||||
|
||||
To solve that problem, Matrix implements this extra step via a .well-known file or a DNS entry. |
||||
@ -1,20 +0,0 @@
@@ -1,20 +0,0 @@
|
||||
site_name: Conduit Docs |
||||
site_description: Conduit is a simple, fast and reliable chat server for the Matrix protocol |
||||
theme: |
||||
name: material |
||||
repo_url: https://gitlab.com/famedly/conduit |
||||
nav: |
||||
- Home: index.md |
||||
- Installation: |
||||
- Prerequisites: installation/prerequisites.md |
||||
- Distribution Packages: installation/packages.md |
||||
- Manual: installation/manual.md |
||||
- Docker: installation/docker.md |
||||
- Configuration: |
||||
- Conduit.toml: configuration/conduit.toml.md |
||||
- Appservices: configuration/appservices.md |
||||
- Development: |
||||
- Basics: development/basics.md |
||||
- Cross compilation: development/cross-compilation.md |
||||
- Tests & CI: development/tests-ci.md |
||||
|
||||
@ -0,0 +1,84 @@
@@ -0,0 +1,84 @@
|
||||
use crate::{ |
||||
database::{admin::AdminCommand, DatabaseGuard}, |
||||
ConduitResult, Error, Ruma, |
||||
}; |
||||
use ruma::{ |
||||
api::client::{error::ErrorKind, r0::room::report_content}, |
||||
events::room::message, |
||||
int, |
||||
}; |
||||
|
||||
#[cfg(feature = "conduit_bin")] |
||||
use rocket::{http::RawStr, post}; |
||||
|
||||
/// # `POST /_matrix/client/r0/rooms/{roomId}/report/{eventId}`
|
||||
///
|
||||
/// Reports an inappropriate event to homeserver admins
|
||||
///
|
||||
#[cfg_attr(
|
||||
feature = "conduit_bin", |
||||
post("/_matrix/client/r0/rooms/<_>/report/<_>", data = "<body>") |
||||
)] |
||||
#[tracing::instrument(skip(db, body))] |
||||
pub async fn report_event_route( |
||||
db: DatabaseGuard, |
||||
body: Ruma<report_content::Request<'_>>, |
||||
) -> ConduitResult<report_content::Response> { |
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated"); |
||||
|
||||
let pdu = match db.rooms.get_pdu(&body.event_id)? { |
||||
Some(pdu) => pdu, |
||||
_ => { |
||||
return Err(Error::BadRequest( |
||||
ErrorKind::InvalidParam, |
||||
"Invalid Event ID", |
||||
)) |
||||
} |
||||
}; |
||||
|
||||
if body.score > int!(0) || body.score < int!(-100) { |
||||
return Err(Error::BadRequest( |
||||
ErrorKind::InvalidParam, |
||||
"Invalid score, must be within 0 to -100", |
||||
)); |
||||
}; |
||||
|
||||
if body.reason.chars().count() > 250 { |
||||
return Err(Error::BadRequest( |
||||
ErrorKind::InvalidParam, |
||||
"Reason too long, should be 250 characters or fewer", |
||||
)); |
||||
}; |
||||
|
||||
db.admin.send(AdminCommand::SendMessage( |
||||
message::RoomMessageEventContent::text_html( |
||||
format!( |
||||
"Report received from: {}\n\n\ |
||||
Event ID: {}\n\ |
||||
Room ID: {}\n\ |
||||
Sent By: {}\n\n\ |
||||
Report Score: {}\n\ |
||||
Report Reason: {}", |
||||
sender_user, pdu.event_id, pdu.room_id, pdu.sender, body.score, body.reason |
||||
), |
||||
format!( |
||||
"<details><summary>Report received from: <a href=\"https://matrix.to/#/{0}\">{0}\
|
||||
</a></summary><ul><li>Event Info<ul><li>Event ID: <code>{1}</code>\ |
||||
<a href=\"https://matrix.to/#/{2}/{1}\">🔗</a></li><li>Room ID: <code>{2}</code>\
|
||||
</li><li>Sent By: <a href=\"https://matrix.to/#/{3}\">{3}</a></li></ul></li><li>\
|
||||
Report Info<ul><li>Report Score: {4}</li><li>Report Reason: {5}</li></ul></li>\ |
||||
</ul></details>", |
||||
sender_user, |
||||
pdu.event_id, |
||||
pdu.room_id, |
||||
pdu.sender, |
||||
body.score, |
||||
RawStr::new(&body.reason).html_escape() |
||||
), |
||||
), |
||||
)); |
||||
|
||||
db.flush()?; |
||||
|
||||
Ok(report_content::Response {}.into()) |
||||
} |
||||
Loading…
Reference in new issue