Reactivated old docker-matrix-compose role, parallel to docker-matrix-ansible to allow alternativ installation

This commit is contained in:
2023-12-22 10:23:42 +01:00
parent 75a89a5c9c
commit b5e9197393
19 changed files with 780 additions and 6 deletions

View File

@@ -1 +0,0 @@
matrix-docker-ansible-deploy/

View File

@@ -1,51 +0,0 @@
# Docker-Matrix Role README
## Overview
This document serves as the README for the `docker-matrix` role, a part of the `CyMaIS` project. This role automates the deployment of a Matrix server using Docker.
Matrix is an open-source project that provides a protocol for secure, decentralized, real-time communication. It offers features like end-to-end encrypted chat, VoIP, and file sharing, catering to both individual and enterprise users. With a focus on interoperability, Matrix can bridge with other communication systems, offering a unified platform for messaging and collaboration.
## Dependencies
- `nginx-docker-reverse-proxy` (see `meta/main.yml`)
## Files and Their Functions
1. **`vars/main.yml`**: Defines variables such as `docker_compose_instance_directory`.
2. **`handlers/main.yml`**: Contains handlers like `recreate matrix` for restarting the Matrix service.
3. **`tasks/main.yml`**: Contains main tasks like creating directories and configuration files.
4. **`templates/log.config.j2`**: Template for the Matrix server's logging configuration.
5. **`templates/homeserver.yaml.j2`**: Template for the main configuration file of the Matrix server.
6. **`templates/docker-compose.yml.j2`**: Docker-Compose template for setting up the Matrix server and database.
## Important Administration Commands
- **Create Matrix Users**:
```
docker compose exec -it synapse register_new_matrix_user -u [Username] -p [Password] -a -c /data/homeserver.yaml http://localhost:8008
```
- **Execute Docker-Compose Commands**:
- Restart services:
```
docker-compose up -d --force-recreate
```
- View logs:
```
docker-compose logs
```
## Sources
### Guides
- https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html
- https://cyberhost.uk/element-matrix-setup/
- https://www.linode.com/docs/guides/how-to-install-the-element-chat-app/
- https://hub.docker.com/r/vectorim/element-web
## Links to ChatGPT Conversations
- https://chat.openai.com/share/d4485223-3750-4b0b-9733-45776c55d7cf
- https://chat.openai.com/share/f68873d9-aae9-4a1e-83b6-c3f23705a4ad
- https://chat.openai.com/share/11690964-9997-4e44-b63f-3c384a5ddc1d
- https://chat.openai.com/share/6f537c30-7337-47ed-8c85-19306e0eb74b
- https://chat.openai.com/share/31974492-2950-4dbc-8a83-edd7e1569bec

View File

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

View File

@@ -1,142 +0,0 @@
---
- name: "include tasks nginx-docker-proxy-domain.yml"
include_tasks: nginx-docker-proxy-domain.yml
loop: "{{ domains }}"
loop_control:
loop_var: domain
- name: Clone the git repository
git:
repo: https://github.com/spantaleev/matrix-docker-ansible-deploy.git
dest: "{{ local_repository_directory }}"
update: yes
delegate_to: localhost
become: false
- name: create temporary inventory directory
tempfile:
state: directory
register: matrix_inventory_tmp_dir
delegate_to: localhost
become: false
- name: protect inventory directory
file:
path: "{{ matrix_inventory_tmp_dir.path }}"
mode: '0700'
delegate_to: localhost
become: false
# Host file
- name: set the hosts files path
set_fact:
hosts_path: "{{ matrix_inventory_tmp_dir.path }}/hosts.yml"
- name: create hosts.yml
template:
src: "hosts.yml.j2"
dest: "{{hosts_path}}"
become: false
delegate_to: localhost
# Vars file
- name: set the vars folder path
set_fact:
vars_folder_path: "{{ matrix_inventory_tmp_dir.path }}/host_vars/{{inventory_hostname}}/"
- name: create vars directory
file:
path: "{{vars_folder_path}}"
state: directory
recurse: yes
delegate_to: localhost
become: false
- name: set the vars path
set_fact:
vars_file_path: "{{ vars_folder_path }}vars.yml"
- name: create vars.yml
template:
src: "vars.yml.j2"
dest: "{{vars_file_path}}"
become: false
delegate_to: localhost
- name: show variable information
debug:
msg: "hosts_path: {{hosts_path}}\nmatrix_inventory_tmp_dir:{{ matrix_inventory_tmp_dir }}"
when: verbose | bool
- name: install requirements
local_action: command just roles
args:
chdir: "{{ local_repository_directory }}"
become: false
- name: play matrix-docker-ansible-deploy
local_action: "command ansible-playbook -i {{hosts_path}} {{local_repository_directory}}/setup.yml -vvv --tags={{matrix_playbook_tags}}"
become: false
#- name: delete inventory directory
# file:
# path: "{{ matrix_inventory_tmp_dir.path }}"
# state: absent
# delegate_to: localhost
# become: false
#
#- name: "create {{docker_compose_instance_directory}}"
# file:
# path: "{{docker_compose_instance_directory}}"
# state: directory
# mode: 0755
#
#- name: "create {{docker_compose_instance_directory}}mautrix_whatsapp"
# file:
# path: "{{docker_compose_instance_directory}}mautrix_whatsapp"
# state: directory
# mode: 0755
#
#- name: add whatsapp-bridge-config.yml
# template:
# src: "whatsapp-bridge-config.yml.j2"
# dest: "{{docker_compose_instance_directory}}mautrix_whatsapp/config.yml"
# notify: recreate matrix
#
#- name: add element-config.json
# template:
# src: "element-config.json.j2"
# dest: "{{docker_compose_instance_directory}}element-config.json"
# notify: recreate matrix
#
#- 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}}{{synapse_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_synapse_data,dst=/data -e SYNAPSE_SERVER_NAME={{synapse_domain}} -e SYNAPSE_REPORT_STATS=no --entrypoint /bin/sh matrixdotorg/synapse:latest -c 'chown -vR 991:991 /data'"
#
#- name: add docker-compose.yml
# template:
# src: "docker-compose.yml.j2"
# dest: "{{docker_compose_instance_directory}}docker-compose.yml"
# notify: recreate matrix

View File

@@ -1,8 +0,0 @@
matrix_servers:
hosts:
{{inventory_hostname}}:
ansible_host: "{{ip4_address}}"
ansible_ssh_user: administrator
become: true
become_user: root
ansible_become_password: "{{ansible_become_password}}"

View File

@@ -1,71 +0,0 @@
# The bare domain name which represents your Matrix identity.
# Matrix user ids for your server will be of the form (`@user:<matrix-domain>`).
#
# Note: this playbook does not touch the server referenced here.
# Installation happens on another server ("matrix.<matrix-domain>").
#
# If you've deployed using the wrong domain, you'll have to run the Uninstalling step,
# because you can't change the Domain after deployment.
#
# Example value: example.com
matrix_domain: "{{synapse_domain}}"
# The Matrix homeserver software to install.
# See:
# - `roles/custom/matrix-base/defaults/main.yml` for valid options
# - the `docs/configuring-playbook-IMPLEMENTATION_NAME.md` documentation page, if one is available for your implementation choice
matrix_homeserver_implementation: synapse
# A secret used as a base, for generating various other secrets.
# You can put any string here, but generating a strong one is preferred (e.g. `pwgen -s 64 1`).
matrix_homeserver_generic_secret_key: "{{matrix_generic_secret_key}}"
# By default, the playbook manages its own Traefik (https://doc.traefik.io/traefik/) reverse-proxy server.
# It will retrieve SSL certificates for you on-demand and forward requests to all other components.
# For alternatives, see `docs/configuring-playbook-own-webserver.md`.
matrix_playbook_reverse_proxy_type: playbook-managed-traefik
# Ensure that public urls use https
matrix_playbook_ssl_enabled: true
# Disable the web-secure (port 443) endpoint, which also disables SSL certificate retrieval
devture_traefik_config_entrypoint_web_secure_enabled: false
# If your reverse-proxy runs on another machine, consider using `0.0.0.0:81`, just `81` or `SOME_IP_ADDRESS_OF_THIS_MACHINE:81`
devture_traefik_container_web_host_bind_port: "127.0.0.1:{{http_port}}"
# We bind to `127.0.0.1` by default (see above), so trusting `X-Forwarded-*` headers from
# a reverse-proxy running on the local machine is safe enough.
devture_traefik_config_entrypoint_web_forwardedHeaders_insecure: true
# This is something which is provided to Let's Encrypt when retrieving SSL certificates for domains.
#
# In case SSL renewal fails at some point, you'll also get an email notification there.
#
# If you decide to use another method for managing SSL certificates (different than the default Let's Encrypt),
# you won't be required to define this variable (see `docs/configuring-playbook-ssl-certificates.md`).
#
# Example value: someone@example.com
devture_traefik_config_certificatesResolvers_acme_email: "{{administrator_email}}"
# A Postgres password to use for the superuser Postgres user (called `matrix` by default).
#
# The playbook creates additional Postgres users and databases (one for each enabled service)
# using this superuser account.
devture_postgres_connection_password: "{{matrix_postgres_password}}"
# By default, we configure Coturn's external IP address using the value specified for `ansible_host` in your `inventory/hosts` file.
# If this value is an external IP address, you can skip this section.
#
# If `ansible_host` is not the server's external IP address, you have 2 choices:
# 1. Uncomment the line below, to allow IP address auto-detection to happen (more on this below)
# 2. Uncomment and adjust the line below to specify an IP address manually
#
# By default, auto-detection will be attempted using the `https://ifconfig.co/json` API.
# Default values for this are specified in `matrix_coturn_turn_external_ip_address_auto_detection_*` variables in the Coturn role
# (see `roles/custom/matrix-coturn/defaults/main.yml`).
#
# If your server has multiple IP addresses, you may define them in another variable which allows a list of addresses.
# Example: `matrix_coturn_turn_external_ip_addresses: ['1.2.3.4', '4.5.6.7']`
#
# matrix_coturn_turn_external_ip_address: ''

View File

@@ -1,2 +0,0 @@
---
local_repository_directory: "{{role_path}}/matrix-docker-ansible-deploy"