From 7377aa9c2017eef3eb777c7669a8d03dbfbad0bb Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 19 Feb 2025 12:01:36 +0100 Subject: [PATCH] Cleaned up matomo integration --- playbook.servers.yml | 10 +++--- roles/docker-matrix-compose/README.md | 32 ++----------------- .../templates/global.includes.conf.j2 | 6 ++-- roles/nginx/tasks/main.yml | 10 ------ roles/nginx/templates/nginx.conf.j2 | 13 +++----- 5 files changed, 13 insertions(+), 58 deletions(-) diff --git a/playbook.servers.yml b/playbook.servers.yml index ad5e174d..646cb933 100644 --- a/playbook.servers.yml +++ b/playbook.servers.yml @@ -19,13 +19,11 @@ # Priority: 1 # Almost all other roles depend on the Matomo tracking -- hosts: all - tasks: - - name: "setup matomo hosts if matomo hosts set or global_matomo_tracking_enabled" - include_role: - name: docker-matomo - when: "'matomo' in group_names or (global_matomo_tracking_enabled | bool)" +- name: "setup matomo" + hosts: matomo become: true + roles: + - role: docker-matomo # Priority: 2 # Much other roles rely on a working ldap setup diff --git a/roles/docker-matrix-compose/README.md b/roles/docker-matrix-compose/README.md index b9d1991d..fa9e7c27 100644 --- a/roles/docker-matrix-compose/README.md +++ b/roles/docker-matrix-compose/README.md @@ -2,39 +2,10 @@ ## 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. +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. This role was developed by [Kevin Veen-Birkenbach](https://www.veen.world/) 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.directories.instance`. -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 - ``` - ## Cleanup ``` # Cleanup Database @@ -70,6 +41,7 @@ For login with Token checkout [this guide](https://docs.mau.fi/bridges/go/slack/ - 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 +- https://github.com/matrix-org/matrix-synapse-ldap3 ## Links to ChatGPT Conversations diff --git a/roles/nginx-modifier-all/templates/global.includes.conf.j2 b/roles/nginx-modifier-all/templates/global.includes.conf.j2 index 66592a23..452afcde 100644 --- a/roles/nginx-modifier-all/templates/global.includes.conf.j2 +++ b/roles/nginx-modifier-all/templates/global.includes.conf.j2 @@ -1,9 +1,9 @@ -# Allow multiple sub_filters +{# Allow multiple sub_filters #} sub_filter_once off; sub_filter_types text/html; {% if global_matomo_tracking_enabled | bool %} - # Include Global Matomo Tracking + {# Include Global Matomo Tracking #} {% include 'roles/nginx-modifier-matomo/templates/matomo-tracking.conf.j2' %} {% endif %} @@ -12,6 +12,6 @@ sub_filter_types text/html; {% endif %} {% if global_theming_enabled | bool %} - # Include Global CSS Location + {# Include Global CSS Location #} {% include 'roles/nginx-modifier-css/templates/location.conf.j2' %} {% endif %} diff --git a/roles/nginx/tasks/main.yml b/roles/nginx/tasks/main.yml index ab5e8916..74c90448 100644 --- a/roles/nginx/tasks/main.yml +++ b/roles/nginx/tasks/main.yml @@ -4,16 +4,6 @@ notify: restart nginx when: run_once_nginx is not defined -# I assume the following can be deleted -# @todo Delete - -- name: install nginx-mod-headers-more for matomo - pacman: - name: nginx-mod-headers-more - state: present - notify: restart nginx - when: run_once_nginx is not defined and global_matomo_tracking_enabled | bool - - name: "Delete {{nginx.directories.configuration}} directory, when mode_reset" file: path: "{{ nginx.directories.configuration }}" diff --git a/roles/nginx/templates/nginx.conf.j2 b/roles/nginx/templates/nginx.conf.j2 index 44c50d59..2211dead 100644 --- a/roles/nginx/templates/nginx.conf.j2 +++ b/roles/nginx/templates/nginx.conf.j2 @@ -1,8 +1,3 @@ -{% if global_matomo_tracking_enabled | bool %} -# @todo Assume this can be removed. Remove. -load_module /usr/lib/nginx/modules/ngx_http_headers_more_filter_module.so; -{% endif %} - worker_processes auto; events @@ -15,12 +10,12 @@ http include mime.types; default_type text/html; - # caching + {# caching #} proxy_cache_path /tmp/cache levels=1:2 keys_zone=cache:20m max_size=20g inactive=14d use_temp_path=off; - # logging and debugging + {# logging and debugging #} {% if enable_debug | bool %} - # individual log format for better debugging + {# individual log format for better debugging #} log_format debug '$host - $remote_addr [$time_local] ' '"$request" $status $body_bytes_sent ' '"Referer: $http_referer" ' @@ -39,7 +34,7 @@ http sendfile on; keepalive_timeout 65; - # gzip + {# gzip #} gzip on; gzip_proxied any; gzip_vary on;