New app: Matrix Synapse (#684)

* New app: Matrix Synapse

* Change default version

* default version fix

* Add explanation to change the max_upload_size

* Update explanation to change the max_upload_size

* Fix bugs in explanation to change the max_upload_size

* Remove simple

* Code clean up

* Overhaul: no need for the user to execute command

* code formatting

* add public_baseurl

* homeserver.yaml configured to use postgres

* finished postgres setup

* Add "start" description
This commit is contained in:
Schiriki 2022-07-31 16:59:46 +02:00 committed by GitHub
parent 2cfe45f09c
commit 80053a8de3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 118 additions and 0 deletions

View File

@ -0,0 +1,118 @@
captainVersion: 4
services:
$$cap_appname-db:
image: postgres:$$cap_postgres_version
restart: unless-stopped
environment:
POSTGRES_DB: synapse_db
POSTGRES_PASSWORD: $$cap_db_password
POSTGRES_USER: synapse_user
POSTGRES_INITDB_ARGS: --encoding='UTF8' --lc-collate='C' --lc-ctype='C'
volumes:
- $$cap_appname-db:/var/lib/postgresql/data
caproverExtra:
notExposeAsWebApp: true
$$cap_appname:
restart: unless-stopped
environment:
TZ: $$cap_time_zone
volumes:
- $$cap_appname-data:/data
caproverExtra:
containerHttpPort: '8008'
dockerfileLines:
- FROM matrixdotorg/synapse:$$cap_synapse_version
- RUN mkdir /data/
- ENV SYNAPSE_SERVER_NAME=$$cap_appname.$$cap_root_domain
- ENV SYNAPSE_REPORT_STATS=$$cap_synapse_stats
- RUN /start.py generate
- RUN echo '\nserve_server_wellknown\072 true' >> /data/homeserver.yaml
- RUN echo "\nenable_registration\072 $$cap_enable_registration \nenable_registration_without_verification\072 true" >> /data/homeserver.yaml
- RUN echo "\nmax_upload_size\072 $$cap_max_upload_sizeM" >> /data/homeserver.yaml
- RUN sed -i '/^server_name.*/a public_baseurl\o072 "https://$$cap_appname.$$cap_root_domain"' /data/homeserver.yaml
- RUN sed -i 's/name\o072 sqlite3/name\o072 psycopg2/g' /data/homeserver.yaml
- RUN sed -i 's/database\o072 .*homeserver\.db/database\o072 synapse_db\n user\o072 synapse_user\n password\o072 $$cap_db_password\n host\o072 srv-captain--$$cap_appname-db\n port\o072 5432\n/g' /data/homeserver.yaml
caproverOneClickApp:
variables:
- id: '$$cap_synapse_version'
label: Synapse Version
defaultValue: 'v1.63.1'
description: Check out their Docker page for the valid tags https://hub.docker.com/r/matrixdotorg/synapse/tags
validRegex: '/^v[0-9]{1,}|latest$/'
- id: '$$cap_time_zone'
label: Time zone
defaultValue: Europe/Berlin
description: The time zone of your server https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
validRegex: '/.{1,}/'
- id: '$$cap_synapse_stats'
label: Report stats
defaultValue: 'no'
description: 'Report stats'
validRegex: '/^(yes|no)$/i'
- id: '$$cap_enable_registration'
label: Enable public registration
defaultValue: 'false'
description: >-
Set this to true if you want EVERYONE to be able to register.
It's recommended to set this to false and create users manually.
validRegex: '/^(true|false)$/i'
- id: '$$cap_max_upload_size'
label: Max upload size
defaultValue: '300'
description: >-
The maximum size of a file that can be uploaded, in megabytes.
If you set this higher than 500, you will will also need to increase the nginx "client_max_body_size".
validRegex: '/^[0-9]{1,}$/'
- id: '$$cap_postgres_version'
label: Postgres version
defaultValue: '14'
description: >-
The version of postgres that you want to use.
You can find the valid versions here: https://hub.docker.com/r/postgres/postgres/tags
validRegex: '/^[0-9]{1,}|latest$/'
- id: '$$cap_db_password'
label: Database password
defaultValue: $$cap_gen_random_hex(20)
description: >-
The password for the Synapse database.
validRegex: '/^[0-9a-zA-Z]{1,}$/'
instructions:
start: >-
Synapse is a server implementation of the matrix protocol that allows you to host your own messaging server.
Matrix is build to federate with other servers, so you can communicate with people from other servers.
More information about matrix can be found here: https://matrix.org/
end: >-
Almost done.
Enable and force https in the web interface
Wait 30 seconds, go to https://$$cap_appname.$$cap_root_domain and should be able to see "It works! Synapse is running"
$$cap_appname.$$cap_root_domain is the domain you enter in the custom homeserver field of your client
Remember this is just the server, you also need a client like https://app.element.io/ to use this app.
If you set public registration to false, you can create new users with the following command:
sudo docker exec -it $(sudo docker ps | grep -o srv-captain--$$cap_appname.*) register_new_matrix_user http://localhost:8008 -c /data/homeserver.yaml
You can always change the config file located in /var/lib/docker/volumes/srv-captain--$$cap_appname-data/_data/homeserver.yaml
link to the the configuration manual: https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html
after a change restart the container by clicking "Save & Update"
displayName: Matrix Synapse
isOfficial: true
description: Server for the matrix protocol
documentation: https://github.com/matrix-org/synapse/tree/develop/docker

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB