Restructured code and matrix rol

This commit is contained in:
2024-01-19 15:12:18 +01:00
parent 0aebca62f6
commit c4209f0559
64 changed files with 249 additions and 224 deletions

View File

@@ -35,6 +35,14 @@ Matrix is an open-source project that provides a protocol for secure, decentrali
docker-compose logs
```
## Cleanup
```
# Cleanup Database
for db in matrix mautrix_whatsapp_bridge mautrix_telegram_bridge mautrix_signal_bridge mautrix_slack_bridge; do python reset-database-in-central-postgres.py $db; done
# Cleanup Docker and Volumes
docker compose down -v
```
## Debug:
- https://federationtester.matrix.org/

View File

@@ -1,6 +1,6 @@
---
- name: "include docker-compose-database.yml"
include_tasks: docker-compose-database.yml
- name: "include docker/compose/database.yml"
include_tasks: docker/compose/database.yml
- name: "include task certbot-matomo.yml"
include_tasks: certbot-matomo.yml
@@ -53,12 +53,6 @@
path: "{{docker_compose_instance_directory}}"
state: absent
- name: "create registrations folder"
file:
path: "{{docker_compose_instance_directory}}registrations"
state: directory
mode: 0755
- name: "create bridge folders"
file:
path: "{{docker_compose_instance_directory}}mautrix/{{item.bridge_name}}"
@@ -113,14 +107,15 @@
timeout: 120
loop: "{{ bridges }}"
- name: move registration files
command:
cmd: mv {{docker_compose_instance_directory}}mautrix/{{item.bridge_name}}/registration.yaml {{docker_compose_instance_directory}}registrations/{{item.bridge_name}}.registration.yaml
chdir: "{{ docker_compose_instance_directory }}"
loop: "{{ bridges }}"
- name: "change file permissions"
file:
path: "{{docker_compose_instance_directory}}registrations/{{item.bridge_name}}.registration.yaml"
path: "{{docker_compose_instance_directory}}mautrix/{{item.bridge_name}}/registration.yaml"
mode: 0755
loop: "{{ bridges }}"
loop: "{{ bridges }}"
- name: create admin account
command:
cmd: docker compose exec -it synapse register_new_matrix_user -u {{matrix_admin_name}} -p {{matrix_admin_password}} -a -c /data/homeserver.yaml http://localhost:8008
chdir: "{{ docker_compose_instance_directory }}"
ignore_errors: true
when: mode_setup | bool

View File

@@ -2,7 +2,7 @@ version: '3.1'
services:
{% include 'templates/docker-service-' + database_type + '.yml.j2' %}
{% include 'templates/docker/services/' + database_type + '.yml.j2' %}
synapse:
image: matrixdotorg/synapse:latest
@@ -14,15 +14,28 @@ services:
- synapse_data:/data
- ./homeserver.yaml:/data/homeserver.yaml:ro
- ./{{synapse_domain}}.log.config:/data/{{synapse_domain}}.log.config:ro
- ./registrations:{{registration_file_folder}}
{% for item in bridges %}
- {{docker_compose_instance_directory}}mautrix/{{item.bridge_name}}/registration.yaml:{{registration_file_folder}}{{item.bridge_name}}.registration.yaml:ro
{% endfor %}
environment:
- SYNAPSE_SERVER_NAME={{synapse_domain}}
- SYNAPSE_REPORT_STATS=no
ports:
- "127.0.0.1:{{synapse_http_port}}:8008"
{% include 'templates/docker-container-depends-on-just-database.yml.j2' %}
{% include 'templates/docker-container-networks.yml.j2' %}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8008/"]
interval: 1m
timeout: 10s
retries: 3
{% include 'templates/docker/container/depends-on-also-database.yml.j2' %}
{% for item in bridges %}
mautrix-{{item.bridge_name}}:
# The condition service_healthy does not work.
# In practice is does not make a difference anyhow, due to the reason that synapse will restart until it is running
condition: service_started
{% endfor %}
{% include 'templates/docker/container/networks.yml.j2' %}
element:
image: vectorim/element-web:latest
container_name: matrix-element
@@ -31,7 +44,12 @@ services:
- ./element-config.json:/app/config.json
ports:
- "127.0.0.1:{{element_http_port}}:80"
{% include 'templates/docker-container-networks.yml.j2' %}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:80/"]
interval: 1m
timeout: 10s
retries: 3
{% include 'templates/docker/container/networks.yml.j2' %}
{% for item in bridges %}
mautrix-{{item.bridge_name}}:
@@ -40,12 +58,15 @@ services:
restart: {{docker_restart_policy}}
volumes:
- ./mautrix/{{item.bridge_name}}:/data
- ./registrations:{{registration_file_folder}}
{% include 'templates/docker-container-networks.yml.j2' %}
healthcheck:
test: ["CMD-SHELL", "test -f {{registration_file_folder}}registration.yaml || exit 1"]
interval: 1m
timeout: 10s
retries: 3
{% include 'templates/docker/container/networks.yml.j2' %}
{% endfor %}
{% include 'templates/docker-compose-volumes.yml.j2' %}
{% include 'templates/docker/compose/volumes.yml.j2' %}
synapse_data:
{% include 'templates/docker-compose-networks.yml.j2' %}
{% include 'templates/docker/compose/networks.yml.j2' %}

View File

@@ -2,7 +2,7 @@
docker_compose_project_name: "matrix"
database_password: "{{matrix_database_password}}"
database_type: "postgres"
registration_file_folder: "/data/registration/"
registration_file_folder: "/data/"
well_known_directory: "{{nginx_well_known_root}}/matrix/"
bridges: