From 95e15adc1396fddbbfcdca47a67be3c5526dc52b Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 9 Jul 2020 13:09:08 +0200 Subject: [PATCH] services: add Synapse Synapse is the Matrix server software. This needs some manual setup, launching `docker-compose exec synapse sh` followed by `register_new_matrix_user -c /data/homeserver.yaml https://matrix.belanyi.fr/` inside the container. --- docker-compose.yml | 11 ++++++ .../nginx/proxy-confs/matrix.subdomain.conf | 39 +++++++++++++++++++ matrix/matrix.env | 5 +++ 3 files changed, 55 insertions(+) create mode 100644 letsencrypt/nginx/proxy-confs/matrix.subdomain.conf create mode 100644 matrix/matrix.env diff --git a/docker-compose.yml b/docker-compose.yml index 7af1f67..d040d39 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -326,3 +326,14 @@ services: expose: - 5000 user: 1000:1000 + + synapse: + image: matrixdotorg/synapse + restart: unless-stopped + container_name: synapse + env_file: + - ./matrix/matrix.env + volumes: + - ./matrix:/data + ports: + - 8008:8008 diff --git a/letsencrypt/nginx/proxy-confs/matrix.subdomain.conf b/letsencrypt/nginx/proxy-confs/matrix.subdomain.conf new file mode 100644 index 0000000..de1a0ac --- /dev/null +++ b/letsencrypt/nginx/proxy-confs/matrix.subdomain.conf @@ -0,0 +1,39 @@ +# make sure that your dns has a cname set for matrix and that your matrix container is not using a base url + +server { + listen 443 ssl; + listen [::]:443 ssl; + + server_name matrix.belanyi.fr; + + include /config/nginx/ssl.conf; + + location /_matrix { + include /config/nginx/proxy.conf; + + resolver 127.0.0.11 valid=30s; + + set $upstream_app synapse; + set $upstream_port 8008; + set $upstream_proto http; + proxy_pass $upstream_proto://$upstream_app:$upstream_port; + + # Nginx by default only allows file uploads up to 1M in size + # Increase client_max_body_size to match max_upload_size defined in homeserver.yaml + client_max_body_size 10M; + } +} + +server { + listen 443 ssl; + listen [::]:443 ssl; + + server_name belanyi.fr; + + include /config/nginx/ssl.conf; + + location /.well-known/matrix/server { + default_type application/json; + return 200 '{"m.server": "matrix.belanyi.fr:443"}'; + } +} diff --git a/matrix/matrix.env b/matrix/matrix.env new file mode 100644 index 0000000..19b45b8 --- /dev/null +++ b/matrix/matrix.env @@ -0,0 +1,5 @@ +SYNAPSE_SERVER_NAME=belanyi.fr +UID=1000 +GID=1000 +TZ=FR +SYNAPSE_REPORT_STATS=yes