Matrix draft

This commit is contained in:
2023-12-12 22:36:35 +01:00
parent d5baaff695
commit 320080270f
15 changed files with 170 additions and 10 deletions

View File

View File

@@ -0,0 +1,8 @@
---
- name: recreate matrix
command:
cmd: docker-compose up -d --force-recreate
chdir: "{{docker_compose_instance_directory}}"
environment:
COMPOSE_HTTP_TIMEOUT: 600
DOCKER_CLIENT_TIMEOUT: 600

View File

@@ -0,0 +1,2 @@
dependencies:
- nginx-docker-reverse-proxy

View File

@@ -0,0 +1,33 @@
---
- name: "include tasks nginx-docker-proxy-domain.yml"
include_tasks: nginx-docker-proxy-domain.yml
- name: "create {{docker_compose_instance_directory}}"
file:
path: "{{docker_compose_instance_directory}}"
state: directory
mode: 0755
- name: add homeserver.yaml
template:
src: "homeserver.yaml.j2"
dest: "{{docker_compose_instance_directory}}homeserver.yaml"
notify: recreate matrix
- name: add log.config
template:
src: "log.config.j2"
dest: "{{docker_compose_instance_directory}}{{domain}}.log.config"
notify: recreate matrix
# https://github.com/matrix-org/synapse/issues/6303
- name: set correct folder permissions
command:
cmd: "docker run --rm --mount type=volume,src=matrix_data,dst=/data -e SYNAPSE_SERVER_NAME={{domain}} -e SYNAPSE_REPORT_STATS=no --entrypoint /bin/sh matrixdotorg/synapse:latest -c 'chown -vR 991:991 /data'"
chdir: "{{path_docker_compose_instances}}baserow/"
- name: add docker-compose.yml
template:
src: "docker-compose.yml.j2"
dest: "{{docker_compose_instance_directory}}docker-compose.yml"
notify: recreate matrix

View File

@@ -0,0 +1,45 @@
version: '3.1'
services:
application:
image: matrixdotorg/synapse:latest
restart: unless-stopped
logging:
driver: journald
volumes:
- data:/data
- ./homeserver.yaml:/data/homeserver.yaml:ro
- ./{{domain}}.log.config:/data/{{domain}}.log.config:ro
environment:
- SYNAPSE_SERVER_NAME={{domain}}
- SYNAPSE_REPORT_STATS=no
ports:
- "127.0.0.1:{{http_port}}:8008"
depends_on:
- database
database:
logging:
driver: journald
image: postgres:alpine
restart: unless-stopped
volumes:
- database:/var/lib/postgresql/data
environment:
- POSTGRES_DB=matrix
- POSTGRES_USER=matrix
- POSTGRES_PASSWORD={{matrix_database_password}}
- POSTGRES_INITDB_ARGS='--encoding=UTF-8 --lc-collate=C --lc-ctype=C'
healthcheck:
test: ["CMD-SHELL", "pg_isready -U matrix"]
interval: 10s
timeout: 5s
retries: 6
volumes:
database:
data:
networks:
default:
driver: bridge

View File

@@ -0,0 +1,28 @@
server_name: "{{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: matrix
password: {{matrix_database_password}}
database: matrix
host: database
cp_min: 5
cp_max: 10
log_config: "/data/{{domain}}.log.config"
media_store_path: /data/media_store
registration_shared_secret: "{{matrix_registration_shared_secret}}"
report_stats: true
macaroon_secret_key: "{{matrix_macaroon_secret_key}}"
form_secret: "{{matrix_form_secret}}"
signing_key_path: "/data/{{domain}}.signing.key"
trusted_key_servers:
- server_name: "matrix.org"

View File

@@ -0,0 +1,25 @@
version: 1
formatters:
precise:
format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s'
handlers:
file:
class: logging.handlers.RotatingFileHandler
formatter: precise
filename: /data/{{ domain }}.homeserver.log
maxBytes: 10485760
backupCount: 3
console:
class: logging.StreamHandler
formatter: precise
loggers:
synapse:
level: INFO
handlers: [file, console]
root:
level: INFO
handlers: [file, console]

View File

@@ -0,0 +1,2 @@
---
docker_compose_instance_directory: "{{path_docker_compose_instances}}matrix/"