2021-03-02 16:38:38 +00:00
# Matrix (Synapse)
2020-09-08 16:40:57 +00:00
2021-03-02 16:38:38 +00:00
<!-- metadata -->
2021-12-12 19:00:51 +00:00
2021-12-26 01:30:53 +00:00
* **Category**: Apps
* **Status**: 0, work-in-progress
* **Image**: [`matrixdotorg/synapse` ](https://hub.docker.com/r/matrixdotorg/synapse ), 4, upstream
* **Healthcheck**: Yes
* **Backups**: No
2022-02-08 00:42:32 +00:00
* **Email**: Yes
2021-12-26 01:30:53 +00:00
* **Tests**: No
2022-02-08 00:42:32 +00:00
* **SSO**: Yes
2022-02-08 00:38:23 +00:00
2021-03-02 16:38:38 +00:00
<!-- endmetadata -->
2020-09-08 16:40:57 +00:00
2021-03-02 16:38:38 +00:00
## Basic usage
2022-02-08 00:41:44 +00:00
1. Set up Docker Swarm and [`abra` ](https://docs.coopcloud.tech/abra/ )
2. Deploy [`coop-cloud/traefik` ](https://git.coopcloud.tech/coop-cloud/traefik )
3. `abra app new matrix-synapse --secrets` (optionally with `--pass` if you'd like to save secrets in `pass` )
2023-01-20 00:02:28 +00:00
4. `abra app config YOURAPPDOMAIN` - be sure to change `$DOMAIN` to something that resolves to your Docker swarm box
5. `abra app deploy YOURAPPDOMAIN`
6. Create an initial user: `abra app run YOURAPPDOMAIN app register_new_matrix_user -c /data/homeserver.yaml http://localhost:8008`
2021-12-12 19:00:51 +00:00
## Tips & Tricks
2023-07-06 15:02:49 +00:00
### Set Admin User
`abra app cmd YOURAPPDOMAIN db set_admin <adminuser>`
2022-02-08 00:49:08 +00:00
### Disabling federation
2023-01-08 01:09:55 +00:00
- Use `DISABLE_FEDERATION=1` to turn off federation listeners
- Don't use [`compose.matrix.yml` ](https://git.coopcloud.tech/coop-cloud/traefik/src/branch/master/compose.matrix.yml ) in your traefik config to keep the federation ports closed
2022-02-08 00:49:08 +00:00
2022-04-06 16:07:31 +00:00
### Enabling federation
2023-01-08 01:09:55 +00:00
See [`#27` ](https://git.coopcloud.tech/coop-cloud/matrix-synapse/pulls/27 ) for more. Depending on your setup, using `SERVE_SERVER_WELLKNOWN=true` might work to start federating. Make sure you don't leave `DISABLE_FEDERATION=1` set!
2022-02-08 00:49:08 +00:00
### Getting client discovery on a custom domain
2023-01-08 01:09:55 +00:00
You'll need to deploy something like [this ](https://git.autonomic.zone/ruangrupa/well-known-uris ). This could be implemented in this recipe but we haven't merged it in yet. Change sets are welcome.
2022-05-12 19:31:50 +00:00
### Telegram bridging
2023-01-08 01:09:55 +00:00
> WIP docs
2022-05-12 20:27:12 +00:00
2022-05-15 08:47:52 +00:00
Setting it up is a bit of a chicken/egg & chasing cats moment.
You need to get your bot setup on the telegram side first and have these values:
```
api_id: ...
api_hash: ...
telegram_bot_token: ...
```
Here is a rough guide:
2022-05-12 20:27:12 +00:00
2022-05-12 20:32:35 +00:00
```
2022-05-15 08:47:52 +00:00
abra app secret insert < domain > telegram_api_hash v1 < secret >
abra app secret insert < domain > telegram_bot_token v1 < secret >
2022-05-12 20:32:35 +00:00
abra app secret generate -a < domain >
2022-05-15 08:47:52 +00:00
2022-05-12 20:32:35 +00:00
abra app deploy < domain >
abra app run matrix.fva.wtf telegram_bridge cat /data/registration.yaml
abra app undeploy < domain >
2022-05-15 08:47:52 +00:00
abra app secret rm < domain > telegram_as_token
2022-05-12 20:32:35 +00:00
abra app secret insert < domain > telegram_as_token v1 < secret >
2022-05-15 08:47:52 +00:00
abra app secret rm < domain > telegram_as_token
2022-05-12 20:32:35 +00:00
abra app secret insert < domain > telegram_hs_token v1 < secret >
2022-05-15 08:47:52 +00:00
2022-05-12 20:32:35 +00:00
abra app deploy < domain >
```
Some helpful documentation:
2022-05-12 20:27:12 +00:00
2022-05-12 19:31:50 +00:00
- [`docs.mau.fi` ](https://docs.mau.fi/bridges/python/setup/docker.html?bridge=telegram )
- [`example-config.yaml` ](https://mau.dev/mautrix/telegram/-/blob/master/mautrix_telegram/example-config.yaml )
2022-05-16 16:55:32 +00:00
### Discord bridging
2023-01-08 01:09:55 +00:00
> WIP docs
2022-05-16 16:55:32 +00:00
Just as messy as the Telegram bridging above! Rough guide:
- get a local copy of [`config.yaml` ](https://github.com/matrix-org/matrix-appservice-discord/blob/develop/config/config.sample.yaml )
- fill it out with the values you need, all the discord token stuff, etc.
- run `mkdir -p data && cp config.yaml data/` then `docker run --rm -v data:/data halfshot/matrix-appservice-discord:v1.0.0 sh -c "cd /data && node /build/src/discordas.js -r -u "http://discordbridge:9005" -c config.yaml"`
- this generates the app service registration configuration you need to feed to the homeserver
- run secret generation for the `discord_db_password` , insert your `discord_bot_token`
- run `abra app cp <domain> discord-registration.yaml app:/discord-data` (it has to be called `discord-registration.yaml` )
- deploy the bridge & happy hacking
Some helpful documentation:
- [`matrix-org/matrix-appservice-discord` docs ](https://github.com/matrix-org/matrix-appservice-discord#bridging-a-room )
- [`t2bot.io/discord` ](https://t2bot.io/discord/ )
2022-09-21 08:54:27 +00:00
### Signal bridging
2023-01-08 01:09:55 +00:00
> WIP docs
2022-09-21 08:54:27 +00:00
2023-01-08 01:09:55 +00:00
OK, it's also awful to set this up. Do you see a pattern emerging :)
2022-09-21 08:54:27 +00:00
- fake that you have the required tokens:
- `abra app secret insert example.com signal_hs_token v1 foo`
- `abra app secret insert example.com signal_as_token v1 foo`
- generate the database password:
- `abra app secret generate example.com -a`
- deploy the thing and then check the `/data/registration.yaml`
- rm the fake `signal_hs/as_token` values and re-insert the new ones from `registration.yaml`
- re-deploy the whole thing and then it should come up, message `@signalbot:example.com` to test