Compare commits

..

125 Commits

Author SHA1 Message Date
af3c8fd252 add comrade backupbot 2022-04-12 15:29:56 +02:00
40d6b1df4e Add note about federation. 2022-04-06 16:07:31 +00:00
0378e8d89f bump homeserver.yaml version 2022-04-06 17:31:14 +02:00
c542629264 add SERVE_SERVER_WELLKNOWN variable
This config allows matrix-synapse to create a endpoint on
$DOMAIN/.well-known/matrix/server used for federation.
It's a straight forward way (no port opening required)
to enable federation if you are okay having a subdomain
(matrix.example.org) as your homeserver address.
2022-04-06 13:01:28 +02:00
005ce43f61 feat: encryption by default
See #22.
2022-04-03 19:25:19 +02:00
bca2a983c0 docs: more feedback on deploy 2022-03-31 17:56:04 +02:00
89892ed818 chore: publish 1.3.0+v1.55.2 release 2022-03-31 17:46:21 +02:00
1b32621af9 config to hide local login
Closes #25.
2022-03-14 17:19:56 +01:00
919e9253ae Disable registrations by default
See #22.
2022-03-13 16:55:48 +01:00
c71f3bc519 very hacky multiple keycloaks!
See #24.
2022-03-08 09:34:00 +01:00
e9b5a5360f fix: provide correct initargs
Closes #23.
2022-03-08 09:17:27 +01:00
1188f5d770 chore: publish 1.2.0+v1.52.0 release 2022-02-10 11:21:01 +01:00
17ad6ac250 docs: more tips around privacy stuff 2022-02-08 01:49:08 +01:00
1bcb2d83b2 docs: document features 2022-02-08 01:42:32 +01:00
8ded1abe20 docs: inline commands, fix links 2022-02-08 01:41:44 +01:00
6f3e135b1d docs: newline in metadata 2022-02-08 01:38:23 +01:00
02a9d526fd docs: remove old badge 2022-02-08 01:38:19 +01:00
d5bde0c969 chore: remove old file 2022-02-08 01:37:35 +01:00
29c4b53f40 docs: more tips from tracking configs 2022-02-08 01:37:17 +01:00
89bb7a9f58 chore: ignore synapse clone 2022-02-08 01:37:10 +01:00
9c1bdb632b chore: publish 1.1.0+v1.51.0 release 2022-02-08 00:46:28 +01:00
32b1f856b7 fix: remove old vendor & bump log config 2022-02-08 00:32:58 +01:00
c807a7813d feat: more privacy friendly defaults
See #22
2022-02-08 00:32:28 +01:00
f5275b2384 bump config version 2022-01-12 11:34:09 +01:00
ef7d74d102 autojoin room config 2022-01-12 11:27:43 +01:00
a8f43e725d fix: metadata parsing 2021-12-26 02:30:53 +01:00
fa101da24b drop that back for testing 2021-12-13 17:29:20 +01:00
98635cb612 fix: close up and quote password 2021-12-13 17:28:53 +01:00
643eceae13 update vendor 2021-12-13 17:24:22 +01:00
64905ccc35 feat: smtp support 2021-12-13 17:21:07 +01:00
965809ce11 fix: whitelist SSO 2021-12-13 16:55:38 +01:00
047dac8d21 WIP remove nginx proxying for now
See #20
2021-12-13 16:40:47 +01:00
33d6f5819c fix: support openid 2021-12-13 15:00:04 +01:00
96a28d62ca fix: use root 2021-12-13 14:12:10 +01:00
038f03d872 fix: quotes 2021-12-13 14:01:37 +01:00
37465d7baf fix: do fedi port work in traefik 2021-12-13 13:55:16 +01:00
d2db4622a6 fix: drop that 2021-12-13 13:47:39 +01:00
9800197803 fix: fixed turn_uris 2021-12-13 13:42:02 +01:00
e13dee14bd fix: fedi port and bind_addresses 2021-12-13 13:41:05 +01:00
ff78ac0aab fix: env var + escaping logic 2021-12-13 13:22:14 +01:00
85949eed2b fix: set default 2021-12-13 13:18:17 +01:00
e9748c1641 fix: drop deploy opts on non-app service 2021-12-13 13:16:22 +01:00
2f294803ac fix: more conn tweaks for postgres 2021-12-13 13:10:23 +01:00
fa503e1f1d fix: ; 2021-12-13 12:58:46 +01:00
8222f55f64 fix: faster turn around 2021-12-13 12:57:57 +01:00
9ddafdbbc6 fix: pass secret 2021-12-13 12:56:34 +01:00
522b1ef917 fix: omg thread in the right place 2021-12-13 12:54:09 +01:00
1763e0f749 fix: switch over to list for threading 2021-12-13 12:52:48 +01:00
789d5d0745 fix: thread STACK_NAME again 2021-12-13 12:50:01 +01:00
8ab11e14a8 fix: thread STACK_NAME 2021-12-13 12:46:48 +01:00
184252de29 fix: get the full addr 2021-12-13 12:46:00 +01:00
aa7357596a docs: log generation 2021-12-13 12:43:51 +01:00
b4b867bf4f fix: generate new log config 2021-12-13 12:42:40 +01:00
4daf9eecb3 fix: logging config 2021-12-13 12:39:19 +01:00
68d73bd4e7 fix: no hardcoded secrets 2021-12-13 12:16:23 +01:00
6727434db5 fix: remove test domain 2021-12-13 12:06:26 +01:00
85598331b7 fix: get perms working 2021-12-13 12:06:20 +01:00
0c0c1d6052 fix: pass domain 2021-12-13 10:56:36 +01:00
7094f51810 fix: stop templating falling over keycloak 2021-12-13 10:56:27 +01:00
e8a876a28c fix: vendor homeserver config 2021-12-13 10:46:18 +01:00
17d116c600 fix: drop that missing password 2021-12-13 10:38:55 +01:00
d53efd82b9 fix: set right type 2021-12-13 10:37:46 +01:00
fd76821803 fix: pass list for turn_uris 2021-12-13 10:37:03 +01:00
e2d21764f1 fix: dont use turn user/pass 2021-12-13 10:32:06 +01:00
daf4fcb02e feat: turn config
Closes #17.
2021-12-13 00:03:24 +01:00
4f936a594a feat: keycloak config
Closes #18.
2021-12-12 23:56:34 +01:00
10e459f183 feat: disable federation
Closes #19.
2021-12-12 23:50:45 +01:00
650e0cbc28 feat: proxying support
Part of #1.
2021-12-12 23:31:37 +01:00
a5f9105613 fix: template secret, skip _FILE dance 2021-12-12 23:26:06 +01:00
b2a29da9a3 fix: admin email & sort 2021-12-12 23:25:24 +01:00
b7cce0a516 WIP: postgres db support
Part of #2.
2021-12-12 20:01:30 +01:00
93ae4d6c8a chore: version label 2021-12-12 19:47:43 +01:00
1ec30af608 chore: bump to latest 2021-12-12 19:23:09 +01:00
dc6146c597 chore: formatting, style 2021-12-12 19:22:49 +01:00
87df9c99c6 chore: remove old file 2021-12-12 19:21:56 +01:00
3wc
867c07f88f Goodbye, emojis! 😢
[ci skip]
2021-11-23 12:19:05 +02:00
1b1cdf4af2 Revert internal network change (see https://git.autonomic.zone/coop-cloud/organising/issues/62)
All checks were successful
continuous-integration/drone/push Build is passing
2021-07-15 16:08:45 +02:00
68f18336d7 Version v1.38.0; sync labels
All checks were successful
continuous-integration/drone/push Build is passing
2021-07-14 07:02:39 +00:00
012a93a689 Update matrixdotorg/synapse Docker tag to v1.38.0
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is passing
2021-07-14 07:02:29 +00:00
bbb28ff6c2 Scope internal network internally
All checks were successful
continuous-integration/drone/push Build is passing
2021-07-10 15:41:39 +02:00
a79a2aa2d8 Version v1.37.1; sync labels
All checks were successful
continuous-integration/drone/push Build is passing
2021-07-01 07:02:32 +00:00
c1ad176dfc Update matrixdotorg/synapse Docker tag to v1.37.1
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is passing
2021-07-01 07:02:21 +00:00
627a0b6a01 Version v1.37.0; sync labels
All checks were successful
continuous-integration/drone/push Build is passing
2021-06-30 07:02:33 +00:00
44836c713a Update matrixdotorg/synapse Docker tag to v1.37.0
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is failing
2021-06-30 07:02:22 +00:00
92ff8ebcb7 Version v1.36.0; sync labels
All checks were successful
continuous-integration/drone/push Build is passing
2021-06-21 10:31:40 +00:00
4aca0bbf14 Use new image namespace
All checks were successful
continuous-integration/drone/push Build is passing
2021-06-21 12:31:29 +02:00
a0aea386a4 Version v1.36.0; sync labels
All checks were successful
continuous-integration/drone/push Build is passing
2021-06-16 07:40:30 +00:00
7238f765b1 Version v1.36.0; sync labels
All checks were successful
continuous-integration/drone/push Build is passing
2021-06-16 09:39:18 +02:00
03bbade383 Update matrixdotorg/synapse Docker tag to v1.36.0
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is passing
2021-06-16 07:02:25 +00:00
6da0caae76 Version v1.35.1; sync labels
All checks were successful
continuous-integration/drone/push Build is passing
2021-06-04 07:03:30 +00:00
107737c377 Update matrixdotorg/synapse Docker tag to v1.35.1
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is failing
2021-06-04 07:03:18 +00:00
84574ff569 Remove trigger, we make the tags [ci skip] 2021-06-04 00:14:56 +02:00
56f2323bbb Add release logic CI setup 2021-06-03 22:35:41 +02:00
f7b95a6687 Version v1.35.0; sync labels 2021-06-03 22:34:06 +02:00
a2e22e4a54 Update matrixdotorg/synapse Docker tag to v1.35.0 2021-06-03 22:34:06 +02:00
2952c623a1 Update matrixdotorg/synapse Docker tag to v1.34.0 2021-05-18 07:01:48 +00:00
74f7a698aa Merge pull request 'Update matrixdotorg/synapse Docker tag to v1.33.2 (main)' (#9) from renovate/main-docker-matrixdotorg-synapse-1.x into main
Reviewed-on: https://git.autonomic.zone/coop-cloud/matrix-synapse/pulls/9
2021-05-17 09:44:40 +02:00
7aed440d97 Update matrixdotorg/synapse Docker tag to v1.33.2 2021-05-12 07:01:49 +00:00
aca1a644d9 Merge pull request 'Update matrixdotorg/synapse Docker tag to v1.33.1 (main)' (#8) from renovate/main-docker-matrixdotorg-synapse-1.x into main
Reviewed-on: https://git.autonomic.zone/coop-cloud/matrix-synapse/pulls/8
2021-05-10 10:26:23 +02:00
241b8bd7ff Update matrixdotorg/synapse Docker tag to v1.33.1 2021-05-07 07:01:57 +00:00
3c74eccfa1 Version v1.33.0; sync labels 2021-05-06 09:38:03 +02:00
b704f7aceb Merge pull request 'Update matrixdotorg/synapse Docker tag to v1.33.0 (main)' (#7) from renovate/main-docker-matrixdotorg-synapse-1.x into main
Reviewed-on: https://git.autonomic.zone/coop-cloud/matrix-synapse/pulls/7
2021-05-06 09:37:14 +02:00
c0bde0b431 Update matrixdotorg/synapse Docker tag to v1.33.0 2021-05-06 07:01:48 +00:00
d968f064af Version v1.32.2; sync labels 2021-05-03 09:27:34 +02:00
d8307ad2bf Merge pull request 'Update matrixdotorg/synapse Docker tag to v1.32.2 (main)' (#6) from renovate/main-docker-matrixdotorg-synapse-1.x into main
Reviewed-on: https://git.autonomic.zone/coop-cloud/matrix-synapse/pulls/6
2021-05-03 09:26:39 +02:00
d9ed3f07be Update matrixdotorg/synapse Docker tag to v1.32.2 2021-04-23 07:02:18 +00:00
f98f61063a Merge pull request 'Update matrixdotorg/synapse Docker tag to v1.31.0 (main)' (#5) from renovate/main-docker-matrixdotorg-synapse-1.x into main
Reviewed-on: https://git.autonomic.zone/coop-cloud/matrix-synapse/pulls/5
2021-04-07 11:57:07 +02:00
714f11df3b Update matrixdotorg/synapse Docker tag to v1.31.0 2021-04-07 07:01:57 +00:00
c1c6ece1dc Merge pull request 'Update matrixdotorg/synapse Docker tag to v1.30.1 (main)' (#4) from renovate/main-docker-matrixdotorg-synapse-1.x into main
Reviewed-on: https://git.autonomic.zone/coop-cloud/matrix-synapse/pulls/4
2021-04-06 10:37:58 +02:00
1f01929ed8 Update matrixdotorg/synapse Docker tag to v1.30.1 2021-04-06 07:01:48 +00:00
3wc
fbb5b5a984 Version v1.9.1; sync labels 2021-04-05 11:45:45 +02:00
3wc
e695bea733 Pin docker image tag 2021-04-05 11:44:11 +02:00
3wc
9420ca82ec Fix type name in README
[ci skip]
2021-03-02 20:24:18 +02:00
3wc
6f383f2c3a Fix README links & CI status
[ci skip]
2021-03-02 20:12:59 +02:00
3wc
31d1aba393 compose-stacks → coop-cloud
[ci skip]
2021-03-02 19:58:21 +02:00
3wc
bc7d4c3c92 Follow new exciting README standard
See coop-cloud/organising#31
2021-03-02 18:38:38 +02:00
3wc
e66832b78a Move config to abra.sh
Ref coop-cloud/abra#43
2021-02-08 15:28:40 +02:00
3wc
93c6214959 Fix embarrassing mass-typo 😳 2020-12-31 23:02:26 +02:00
3wc
e490ccbfca APP → TYPE
Ref coop-cloud/abra#47
2020-12-31 22:54:41 +02:00
3wc
139c4ecfc4 Switch from envrc → env format
Ref coop-cloud/abra#40
2020-12-30 13:23:03 +02:00
3wc
52af3d76ae SERVICE -> APP 2020-10-29 19:48:31 +02:00
8a20bddd41 Remove whitespace 2020-10-27 08:48:06 +01:00
6f0999895f Make generic 2020-10-27 08:47:59 +01:00
a75a19a120 Merge pull request 'Configure Renovate' (#3) from renovate/configure into main
Reviewed-on: https://git.autonomic.zone/compose-stacks/matrix-synapse/pulls/3
2020-09-15 08:53:33 +02:00
28c64539da Add renovate.json 2020-09-14 20:02:13 +00:00
18 changed files with 2978 additions and 115 deletions

64
.env.sample Normal file
View File

@ -0,0 +1,64 @@
TYPE=matrix-synapse
DOMAIN=matrix.example.com
LETS_ENCRYPT_ENV=production
SECRET_DB_PASSWORD_VERSION=v1
SYNAPSE_ADMIN_EMAIL=admin@example.com
SECRET_REGISTRATION_SHARED_SECRET_VERSION=v1
SECRET_MACAROON_SECRET_KEY_VERSION=v1
SECRET_FORM_SECRET_VERSION=v1
COMPOSE_FILE="compose.yml"
#DISABLE_FEDERATION=1
# Set "true" to enable federation endpoint on $DOMAIN/.well-known/matrix/server
SERVE_SERVER_WELLKNOWN=false
ENABLE_REGISTRATION=false
PASSWORD_LOGIN_ENABLED=true
#AUTO_JOIN_ROOM_ENABLED=1
#AUTO_JOIN_ROOM="#example:example.com"
SQL_LOG_LEVEL=WARN
ROOT_LOG_LEVEL=WARN
REDACTION_RETENTION_PERIOD=7d
RETENTION_MAX_LIFETIME=1m
ENABLE_3PID_LOOKUP=true
USER_IPS_MAX_AGE=1d
ENCRYPTED_BY_DEFAULT=all
#ENABLE_ALLOWLIST=1
#FEDERATION_ALLOWLIST="[]"
#COMPOSE_FILE="compose.yml:compose.keycloak.yml"
#KEYCLOAK_ENABLED=1
#KEYCLOAK_NAME=
#KEYCLOAK_URL=
#KEYCLOAK_CLIENT_ID=
#KEYCLOAK_CLIENT_DOMAIN=
#SECRET_KEYCLOAK_CLIENT_SECRET_VERSION=v1
#COMPOSE_FILE="compose.yml:compose.turn.yml"
#TURN_ENABLED=1
#TURN_URIS="[\"turns:coturn.foo.zone?transport=udp\", \"turns:coturn.foo.zone?transport=tcp\"]"
#TURN_ALLOW_GUESTS=true
#SECRET_TURN_SHARED_SECRET_VERSION=v1
#COMPOSE_FILE="compose.yml:compose.smtp.yml"
#SMTP_ENABLED=1
#SMTP_APP_NAME=
#SMTP_FROM=
#SMTP_HOST=
#SMTP_PORT=
#SMTP_USER=
#SECRET_SMTP_PASSWORD_VERSION=v1

View File

@ -1,11 +0,0 @@
export STACK_NAME=matrix
export APP=matrix
export DOMAIN=matrix.example.com
export LETS_ENCRYPT_ENV=production
export ENTRYPOINT_CONF_VERSION=v1
## TURN server
#export TURNSERVER_CONF_VERSION=v1
#export COTURN_SHARED_SECRET_VERSION=v1

3
.gitignore vendored
View File

@ -1 +1,2 @@
/.envrc
.envrc
synapse

View File

@ -1,19 +1,81 @@
# Matrix Synapse
# Matrix (Synapse)
Matrix Synapse, based on the [official `matrixdotorg/synapse`
image][synapse-docker].
<!-- metadata -->
1. Set up Docker Swarm and [`abra`][abra]
2. Deploy [`compose-stacks/traefik`][compose-traefik]
2. `cp .envrc.sample .envrc`
3. Edit `.envrc` - be sure to change `$DOMAIN` to something that resolves to
your Docker swarm box
4. `direnv allow` (or `. .envrc`)
4. `abra secret_generate coturn_shared_secret`
5. `abra deploy`
6. `abra service_run synapse` to open a shell
7. `abra register_new_matrix_user`
* **Category**: Apps
* **Status**: 0, work-in-progress
* **Image**: [`matrixdotorg/synapse`](https://hub.docker.com/r/matrixdotorg/synapse), 4, upstream
* **Healthcheck**: Yes
* **Backups**: No
* **Email**: Yes
* **Tests**: No
* **SSO**: Yes
[synapse-docker]: https://hub.docker.com/r/matrixdotorg/synapse
[abra]: https://git.autonomic.zone/autonomic-cooperative/abra
[compose-traefik]: https://git.autonomic.zone/compose-stacks/traefik
<!-- endmetadata -->
## Basic usage
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`)
4. `abra app YOURAPPDOMAIN config` - be sure to change `$DOMAIN` to something that resolves to your Docker swarm box
5. `abra app YOURAPPDOMAIN deploy`
6. Create an initial user: `abra app YOURAPPDOMAIN run app register_new_matrix_user -c /data/homeserver.yaml http://localhost:8008`
## Tips & Tricks
### Disabling federation
> We're not sure this does it exactly and there is still a discussion running
> upstrem about whether this is the right way to do it & whether it could be
> more convenient. We welcome issues / change sets to close up more federation
> functionality.
- 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
### Enabling federation
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.
### Seeing what changed in `homeserver.yaml` between versions
Change the version range to suit your needs.
```
git clone https://github.com/matrix-org/synapse
cd synapse/docs
git log --follow -p v1.48.0..v1.51.0 sample_config.yaml
```
### Generating a new `homeserver.yaml`
The default is also available to see [here](https://matrix-org.github.io/synapse/latest/usage/configuration/homeserver_sample_config.html).
```
docker run -it \
--entrypoint="" \
-e SYNAPSE_SERVER_NAME=foo.com \
-e SYNAPSE_REPORT_STATS=no \
matrixdotorg/synapse:v1.48.0 \
sh -c '/start.py generate; cat /data/homeserver.yaml' > homeserver.yaml.tmpl`
```
### Generating a new `<server>.log.config`
```
docker run -it \
--entrypoint="" \
-e SYNAPSE_SERVER_NAME=foo.com \
-e SYNAPSE_REPORT_STATS=no \
matrixdotorg/synapse:v1.48.0 \
sh -c '/start.py generate; cat /data/foo.com.log.config' > log.config
```
### Getting client discovery on a custom domain
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. Chang sets are welcome.

View File

@ -1,3 +0,0 @@
sub_register_new_matrix_user() {
abra run synapse register_new_matrix_user -c /data/homeserver.yaml http://localhost:8008
}

3
abra.sh Normal file
View File

@ -0,0 +1,3 @@
export ENTRYPOINT_CONF_VERSION=v1
export HOMESERVER_YAML_VERSION=v8
export LOG_CONFIG_VERSION=v2

View File

@ -1,35 +0,0 @@
services:
app:
environment:
- TURN_SERVER=${DOMAIN}
- TURN_PORT=3478
secrets:
- coturn_shared_secret
coturn:
image: instrumentisto/coturn:latest
networks:
- swarm_host
secrets:
- coturn_shared_secret
configs:
- source: turnserver_conf
target: /etc/coturn/turnserver.conf
configs:
turnserver_conf:
name: ${STACK_NAME}_turnserver_conf_${TURNSERVER_CONF_VERSION}
file: turnserver.conf.tmpl
template_driver: golang
secrets:
coturn_shared_secret:
external: true
name: ${STACK_NAME}_coturn_shared_secret_${COTURN_SHARED_SECRET_VERSION}
networks:
# use host-mode networking until Docker can handle mass port-forwards:
# https://github.com/moby/moby/issues/11185
swarm_host:
external:
name: 'host'

22
compose.keycloak.yml Normal file
View File

@ -0,0 +1,22 @@
---
version: "3.8"
services:
app:
secrets:
- db_password
- form_secret
- keycloak_client_secret
- macaroon_secret_key
- registration_shared_secret
environment:
- KEYCLOAK_CLIENT_DOMAIN
- KEYCLOAK_CLIENT_ID
- KEYCLOAK_ENABLED
- KEYCLOAK_NAME
- KEYCLOAK_URL
secrets:
keycloak_client_secret:
external: true
name: ${STACK_NAME}_keycloak_client_secret_${SECRET_KEYCLOAK_CLIENT_SECRET_VERSION}

17
compose.keycloak2.yml Normal file
View File

@ -0,0 +1,17 @@
---
version: "3.8"
services:
app:
secrets:
- keycloak2_client_secret
environment:
- KEYCLOAK2_CLIENT_ID
- KEYCLOAK2_ENABLED
- KEYCLOAK2_NAME
- KEYCLOAK2_URL
secrets:
keycloak2_client_secret:
external: true
name: ${STACK_NAME}_keycloak2_client_secret_${SECRET_KEYCLOAK2_CLIENT_SECRET_VERSION}

23
compose.smtp.yml Normal file
View File

@ -0,0 +1,23 @@
---
version: "3.8"
services:
app:
secrets:
- db_password
- form_secret
- macaroon_secret_key
- registration_shared_secret
- smtp_password
environment:
- SMTP_APP_NAME
- SMTP_ENABLED
- SMTP_FROM
- SMTP_HOST
- SMTP_PORT
- SMTP_USER
secrets:
smtp_password:
external: true
name: ${STACK_NAME}_smtp_password_${SECRET_SMTP_PASSWORD_VERSION}

20
compose.turn.yml Normal file
View File

@ -0,0 +1,20 @@
---
version: "3.8"
services:
app:
secrets:
- db_password
- form_secret
- macaroon_secret_key
- registration_shared_secret
- turn_shared_secret
environment:
- TURN_ALLOW_GUESTS
- TURN_ENABLED
- TURN_URIS
secrets:
turn_shared_secret:
external: true
name: ${STACK_NAME}_turn_shared_secret_${SECRET_TURN_SHARED_SECRET_VERSION}

View File

@ -3,47 +3,117 @@ version: "3.8"
services:
app:
image: "matrixdotorg/synapse:v1.9.1"
image: "matrixdotorg/synapse:v1.55.2"
volumes:
- "synapse:/data"
- "data:/data"
secrets:
- db_password
- registration_shared_secret
- macaroon_secret_key
- form_secret
environment:
- ENCRYPTED_BY_DEFAULT
- AUTO_JOIN_ROOM
- AUTO_JOIN_ROOM_ENABLED
- DISABLE_FEDERATION
- DOMAIN
- ENABLE_3PID_LOOKUP
- ENABLE_ALLOWLIST
- ENABLE_REGISTRATION
- FEDERATION_ALLOWLIST
- LETSENCRYPT_HOST=${DOMAIN}
- PASSWORD_LOGIN_ENABLED
- REDACTION_RETENTION_PERIOD
- ROOT_LOG_LEVEL
- SERVE_SERVER_WELLKNOWN
- SQL_LOG_LEVEL
- STACK_NAME
- SYNAPSE_ADMIN_EMAIL
- SYNAPSE_REPORT_STATS=no
- SYNAPSE_SERVER_NAME=${DOMAIN}
- USER_IPS_MAX_AGE
- VIRTUAL_HOST=${DOMAIN}
- VIRTUAL_PORT=8008
- LETSENCRYPT_HOST=${DOMAIN}
- SYNAPSE_SERVER_NAME=${DOMAIN}
- SYNAPSE_REPORT_STATS=no
networks:
- proxy
- internal
entrypoint: /docker-entrypoint.sh
configs:
- source: homeserver_yaml
target: /data/homeserver.yaml
- source: log_config
target: /data/log.config
- source: entrypoint_conf
target: /docker-entrypoint.sh
mode: 0555
entrypoint: /docker-entrypoint.sh
deploy:
restart_policy:
condition: on-failure
delay: "60s"
max_attempts: 3
window: 120s
labels:
- "traefik.enable=true"
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=8008"
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS})"
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`)"
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect"
- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLForceHost=true"
- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}"
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
- "coop-cloud.${STACK_NAME}.version=1.3.0+v1.55.2"
db:
image: postgres:13-alpine
secrets:
- db_password
environment:
- LC_COLLATE=C
- LC_CTYPE=C
- POSTGRES_DB=synapse
- POSTGRES_INITDB_ARGS="-E \"UTF8\""
- POSTGRES_PASSWORD_FILE=/run/secrets/db_password
- POSTGRES_USER=synapse
networks:
- internal
healthcheck:
test: ["CMD", "pg_isready", "-U", "synapse"]
volumes:
- postgres:/var/lib/postgresql/data
deploy:
labels:
backupbot.backup: "true"
backupbot.backup.pre-hook: "mkdir -p /tmp/backup/ && PGPASSWORD=$$(cat $${POSTGRES_PASSWORD_FILE}) pg_dump -U $${POSTGRES_USER} $${POSTGRES_DB} > /tmp/backup/backup.sql"
backupbot.backup.post-hook: "rm -rf /tmp/backup"
backupbot.backup.path: "/tmp/backup/"
volumes:
synapse:
data:
postgres:
networks:
proxy:
external: true
internal:
configs:
entrypoint_conf:
name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_CONF_VERSION}
file: entrypoint.sh.tmpl
template_driver: golang
homeserver_yaml:
name: ${STACK_NAME}_homserver_yaml_${HOMESERVER_YAML_VERSION}
file: homeserver.yaml.tmpl
template_driver: golang
log_config:
name: ${STACK_NAME}_log_config_${LOG_CONFIG_VERSION}
file: log.config.tmpl
template_driver: golang
secrets:
db_password:
external: true
name: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION}
registration_shared_secret:
external: true
name: ${STACK_NAME}_db_password_${SECRET_REGISTRATION_SHARED_SECRET_VERSION}
macaroon_secret_key:
external: true
name: ${STACK_NAME}_db_password_${SECRET_MACAROON_SECRET_KEY_VERSION}
form_secret:
external: true
name: ${STACK_NAME}_db_password_${SECRET_FORM_SECRET_VERSION}

View File

@ -1,18 +1,11 @@
#!/bin/bash
if [[ ! -f /data/homeserver.yaml ]]; then
# https://github.com/matrix-org/synapse/tree/develop/docker#running-synapse
# default user permissions for the synapse user
chown 991:991 /data
if [[ ! -f /data/{{ env "DOMAIN" }}.signing.key ]]; then
/start.py generate
apt update && apt install -y wget
wget https://github.com/mikefarah/yq/releases/download/3.3.2/yq_linux_amd64 && \
chmod +x yq_linux_amd64 && \
mv yq_linux_amd64 /bin/yq
# turn (https://github.com/matrix-org/synapse/blob/master/docs/turn-howto.md#synapse-setup)
yq w -i /data/homeserver.yaml turn_uris "[]"
yq w -i /data/homeserver.yaml turn_uris\[0\] "turn:${TURN_SERVER}:${TURN_PORT}?transport=udp"
yq w -i /data/homeserver.yaml turn_uris\[1\] "turn:${TURN_SERVER}:${TURN_PORT}?transport=tcp"
yq w -i /data/homeserver.yaml coturn_shared_secret "$(tr -d \"\n\" < /run/secrets/coturn_shared_secret)"
fi
/start.py

6
gen.sh
View File

@ -1,6 +0,0 @@
secret="screw\$naval5seem!herb" && \
time=$(date +%s) && \
expiry=8400 && \
username=$(( $time + $expiry )) &&\
echo username:$username && \
echo password : $(echo -n $username | openssl dgst -binary -sha1 -hmac $secret | openssl base64)

2632
homeserver.yaml.tmpl Normal file

File diff suppressed because it is too large Load Diff

20
log.config.tmpl Normal file
View File

@ -0,0 +1,20 @@
version: 1
formatters:
precise:
format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s'
handlers:
console:
class: logging.StreamHandler
formatter: precise
loggers:
synapse.storage.SQL:
level: {{ env "SQL_LOG_LEVEL" }}
root:
level: {{ env "ROOT_LOG_LEVEL" }}
handlers: [console]
disable_existing_loggers: false

6
release/1.3.0+v1.55.2 Normal file
View File

@ -0,0 +1,6 @@
The deployment failed due to the app/db getting confused. I think this is just
due to the recipe not having good healthcheck config. After the app container
flapped a bit, everything came up nicely. d1 @ autonomic co-op.
Same thing happened to me when deploying this for another instance. Also d1 @
autonomic co-op.

View File

@ -1,15 +0,0 @@
use-auth-secret
static-auth-secret={{ secret "coturn_shared_secret" }}
realm=turn.{{ env "DOMAIN" }}
log-file=stdout
pidfile=/var/tmp/turnserver.pid
userdb=/var/tmp/turnserver.db
no-cli
no-tls
no-dtls
prod
no-tcp-relay