WIP: matrix
This commit is contained in:
parent
cb861223ea
commit
b638cd7310
21 changed files with 249 additions and 14 deletions
32
roles/matrix/files/matrix.log.config
Normal file
32
roles/matrix/files/matrix.log.config
Normal file
|
@ -0,0 +1,32 @@
|
|||
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:
|
||||
# beware: increasing this to DEBUG will make synapse log sensitive
|
||||
# information such as access tokens.
|
||||
level: INFO
|
||||
|
||||
|
||||
root:
|
||||
level: INFO
|
||||
|
||||
|
||||
handlers: [console]
|
||||
|
||||
|
||||
disable_existing_loggers: false
|
8
roles/matrix/files/matrix.signing.key
Normal file
8
roles/matrix/files/matrix.signing.key
Normal file
|
@ -0,0 +1,8 @@
|
|||
$ANSIBLE_VAULT;1.1;AES256
|
||||
38363633306139626564313833363364653037613238396266303133663231643739373237666662
|
||||
6639636136303666353639353632373530326263633264350a616465313137663731393464383263
|
||||
65373565343462633733366636343766656666396531383638363232363565646364663035353333
|
||||
3236383136353065660a353631326630623165366631666639343864633531383238643131373363
|
||||
64303565363439343064393039323265623364633738373163373339376134643966333032326564
|
||||
61646536633335633938336438663430643461623230666163636561303430393732663062393461
|
||||
346332333463636566326364663465306565
|
31
roles/matrix/tasks/main.yml
Normal file
31
roles/matrix/tasks/main.yml
Normal file
|
@ -0,0 +1,31 @@
|
|||
- name: Create app directory
|
||||
file:
|
||||
path: "{{ service_dir }}"
|
||||
state: directory
|
||||
- name: Copy signing key
|
||||
copy:
|
||||
src: "{{ role_path }}/files/matrix.log.config"
|
||||
dest: "{{ service_dir }}/matrix.log.config"
|
||||
- name: Copy Docker Compose script
|
||||
template:
|
||||
src: "{{ role_path }}/templates/docker-compose.yml.j2"
|
||||
dest: "{{ service_dir }}/docker-compose.yml"
|
||||
- name: Copy homeserver.yaml
|
||||
template:
|
||||
src: "{{ role_path }}/templates/homeserver.yaml.j2"
|
||||
dest: "{{ service_dir }}/homeserver.yaml"
|
||||
register: homeserver
|
||||
- name: Copy signing key
|
||||
copy:
|
||||
src: "{{ role_path }}/files/matrix.signing.key"
|
||||
dest: "{{ service_dir }}/matrix.signing.key"
|
||||
- name: Create data directory
|
||||
file:
|
||||
path: "{{ data_dir }}"
|
||||
state: directory
|
||||
- name: Start the Docker Compose
|
||||
docker_compose:
|
||||
project_src: "{{ service_dir }}"
|
||||
pull: true
|
||||
remove_orphans: true
|
||||
restarted: "{{ homeserver.changed }}"
|
41
roles/matrix/templates/docker-compose.yml.j2
Normal file
41
roles/matrix/templates/docker-compose.yml.j2
Normal file
|
@ -0,0 +1,41 @@
|
|||
version: '3'
|
||||
|
||||
services:
|
||||
synapse:
|
||||
image: docker.io/matrixdotorg/synapse:v1.77.0
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- SYNAPSE_CONFIG_PATH=/data/homeserver.yaml
|
||||
volumes:
|
||||
- /data/matrix/uploads:/data/uploads
|
||||
- /data/matrix/media:/data/media
|
||||
- /srv/matrix/homeserver.yaml:/data/homeserver.yaml
|
||||
- /srv/matrix/matrix.log.config:/data/matrix.log.config
|
||||
- /srv/matrix/matrix.signing.key:/data/matrix.signing.key
|
||||
depends_on:
|
||||
- db
|
||||
networks:
|
||||
- traefik
|
||||
ports:
|
||||
- "{{ internal_matrix_port }}:8008"
|
||||
labels:
|
||||
- traefik.enable=true
|
||||
- traefik.http.routers.matrix.entryPoints=websecure
|
||||
- traefik.http.routers.matrix.rule=Host(`{{ matrix_domain }}`)
|
||||
- traefik.http.routers.matrix.tls=true
|
||||
- traefik.http.routers.matrix.tls.certResolver=letsencrypt
|
||||
- traefik.http.routers.matrix.service=matrix
|
||||
- traefik.http.services.matrix.loadbalancer.server.port=8008
|
||||
|
||||
db:
|
||||
image: docker.io/postgres:12-alpine
|
||||
environment:
|
||||
- POSTGRES_USER=synapse
|
||||
- POSTGRES_PASSWORD={{ database_password }}
|
||||
- POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=C --lc-ctype=C
|
||||
volumes:
|
||||
- /data/matrix/schemas:/var/lib/postgresql/data
|
||||
|
||||
networks:
|
||||
traefik:
|
||||
external: true
|
35
roles/matrix/templates/homeserver.yaml.j2
Normal file
35
roles/matrix/templates/homeserver.yaml.j2
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Configuration file for Synapse.
|
||||
#
|
||||
# For more information on how to configure Synapse, including a complete accounting of
|
||||
# each option, go to docs/usage/configuration/config_documentation.md or
|
||||
# https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html
|
||||
server_name: "{{ matrix_domain }}"
|
||||
pid_file: /data/homeserver.pid
|
||||
listeners:
|
||||
- port: 8008
|
||||
tls: false
|
||||
type: http
|
||||
x_forwarded: true
|
||||
resources:
|
||||
- names: [client, federation]
|
||||
compress: false
|
||||
database:
|
||||
name: psycopg2
|
||||
args:
|
||||
user: synapse
|
||||
password: "{{ database_password }}"
|
||||
host: db
|
||||
cp_min: 5
|
||||
cp_max: 10
|
||||
log_config: "/data/matrix.log.config"
|
||||
media_store_path: "/data/media"
|
||||
registration_shared_secret: "{{ registration_shared_secret }}"
|
||||
report_stats: false
|
||||
macaroon_secret_key: "{{ macaroon_secret_key }}"
|
||||
form_secret: "{{ form_secret }}"
|
||||
signing_key_path: "/data/matrix.signing.key"
|
||||
trusted_key_servers:
|
||||
- server_name: "matrix.org"
|
||||
|
||||
|
||||
# vim:ft=yaml
|
41
roles/matrix/vars/main.yml
Normal file
41
roles/matrix/vars/main.yml
Normal file
|
@ -0,0 +1,41 @@
|
|||
service_name: matrix
|
||||
data_dir: "{{ base_data_dir }}/{{ service_name }}"
|
||||
service_dir: "{{ base_service_dir }}/{{ service_name }}"
|
||||
|
||||
matrix_domain: "matrix.{{ domain_name_pim }}"
|
||||
|
||||
registration_shared_secret: !vault |
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
66643364393432353763666361383331316635356431636530663162643134653939306438366533
|
||||
3463393262623364336430363638356439393461393237650a626630633963343530643565323633
|
||||
35613636386365393035666366636534306266613935653136666430366330323032653164363066
|
||||
6531323364383131360a616465336164303030643132336264646333346666626138386331636164
|
||||
65366438356238383234386662363631316334613439613739303165613363636261643934656665
|
||||
32653764373939373739666263653261343036636365316566623934343261653436613962343335
|
||||
343132326461336338323938326264666630
|
||||
macaroon_secret_key: !vault |
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
61656638626162383134356238393031346464623930363636376136633038623836323737633463
|
||||
3733383661663339313965636134373037366235613562340a376334666266623438313066346166
|
||||
64333564613438313861396632633464386236356236313461373461613632346538343837343264
|
||||
3363623135613063300a333932363036353063653931616361363934633239653732343737373536
|
||||
31366265383939303664623565633435626530316430323036663261353334336264306162653361
|
||||
38306437616333316638396161393164393766356566323362343565663630306465663133333733
|
||||
343039623366313961393136356239373837
|
||||
form_secret: !vault |
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
38646165646636353331323565343033396431623338633734653838633032363930323637656637
|
||||
3931643733343537343534386137313737383562346534300a353535633239626332393831613661
|
||||
39366230313234663930363962386336646639393566356437623937393062353134303138363734
|
||||
6430653164656339660a613234313464653138313331333137646331323338346230643630636466
|
||||
35383837356633303061663362626439653030333063383532373663316330373737323736326562
|
||||
37313034363262346333343166343231316264303934366565643466396164333166643561373365
|
||||
656533393033356363303933353231376466
|
||||
database_password: !vault |
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
38393732313834343631626234353261653536646434343561613264626162363839303432333133
|
||||
3635333330626263666430353931666635393738643163300a633231343334666331373936333565
|
||||
36376164396464623233613033636562626630623730633730666333363437613234636638356630
|
||||
3336373235336232630a353732653331623963313865333765633965353630363733386534313639
|
||||
38643839323733393031373139376662326134653965646366663631396464393861636538313563
|
||||
3934363539366139346633626433396438663739393332663030
|
Reference in a new issue