From 8c24a02a43dede1607a1a51808ed8d967fd47dae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=AD=C3=B0ir=20Valberg=20Gu=C3=B0mundsson?= Date: Tue, 11 Jul 2023 20:42:20 +0200 Subject: [PATCH 1/8] Enable email in matrix. --- .../files/configs/matrix/homeserver.yaml.j2 | 21 ++++--------------- .../docker/tasks/services/matrix_element.yml | 3 +++ roles/docker/tasks/services/postfix.yml | 2 +- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/roles/docker/files/configs/matrix/homeserver.yaml.j2 b/roles/docker/files/configs/matrix/homeserver.yaml.j2 index b4749018..6c6714e5 100644 --- a/roles/docker/files/configs/matrix/homeserver.yaml.j2 +++ b/roles/docker/files/configs/matrix/homeserver.yaml.j2 @@ -820,23 +820,10 @@ password_config: # If your SMTP server requires authentication, the optional smtp_user & # smtp_pass variables should be used # -#email: -# enable_notifs: false -# smtp_host: "localhost" -# smtp_port: 25 -# smtp_user: "exampleusername" -# smtp_pass: "examplepassword" -# require_transport_security: False -# notif_from: "Your Friendly %(app)s Home Server " -# app_name: Matrix -# # if template_dir is unset, uses the example templates that are part of -# # the Synapse distribution. -# #template_dir: res/templates -# notif_template_html: notif_mail.html -# notif_template_text: notif_mail.txt -# notif_for_new_users: True -# riot_base_url: "http://localhost/riot" - +email: + smtp_host: "{{ smtp_host }}" + smtp_port: {{ smtp_port }} + notif_from: "{{ services.matrix.domain }} " #password_providers: # - module: "ldap_auth_provider.LdapAuthProvider" diff --git a/roles/docker/tasks/services/matrix_element.yml b/roles/docker/tasks/services/matrix_element.yml index 62df3f3e..527fb89a 100644 --- a/roles/docker/tasks/services/matrix_element.yml +++ b/roles/docker/tasks/services/matrix_element.yml @@ -82,6 +82,7 @@ networks: - matrix - external_services + - postfix volumes: - "{{ services.matrix.volume_folder }}/data:/data" environment: @@ -113,5 +114,7 @@ external_services: external: name: external_services + postfix: + external: true matrix: name: "matrix" diff --git a/roles/docker/tasks/services/postfix.yml b/roles/docker/tasks/services/postfix.yml index ece525e3..76c4f595 100644 --- a/roles/docker/tasks/services/postfix.yml +++ b/roles/docker/tasks/services/postfix.yml @@ -23,6 +23,6 @@ - "{{ services.postfix.volume_folder }}/dkim:/etc/opendkim/keys" env: # Get all services which have allowed_sender_domain defined - ALLOWED_SENDER_DOMAINS: "{{ services | dict2items | selectattr('value.allowed_sender_domain', 'true') | map(attribute='value.domain') | join(' ') }}" + ALLOWED_SENDER_DOMAINS: "{{ base_domain }} {{ services | dict2items | selectattr('value.allowed_sender_domain', 'true') | map(attribute='value.domain') | join(' ') }}" HOSTNAME: "{{ services.postfix.domain }}" # the name the smtp server will identify itself as DKIM_AUTOGENERATE: "true" From 99206761551c163bbf49b36a00ee065163fc890b Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Tue, 11 Jul 2023 21:44:05 +0200 Subject: [PATCH 2/8] Fix sender domains for Postfix --- roles/docker/tasks/services/postfix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/docker/tasks/services/postfix.yml b/roles/docker/tasks/services/postfix.yml index 76c4f595..ece525e3 100644 --- a/roles/docker/tasks/services/postfix.yml +++ b/roles/docker/tasks/services/postfix.yml @@ -23,6 +23,6 @@ - "{{ services.postfix.volume_folder }}/dkim:/etc/opendkim/keys" env: # Get all services which have allowed_sender_domain defined - ALLOWED_SENDER_DOMAINS: "{{ base_domain }} {{ services | dict2items | selectattr('value.allowed_sender_domain', 'true') | map(attribute='value.domain') | join(' ') }}" + ALLOWED_SENDER_DOMAINS: "{{ services | dict2items | selectattr('value.allowed_sender_domain', 'true') | map(attribute='value.domain') | join(' ') }}" HOSTNAME: "{{ services.postfix.domain }}" # the name the smtp server will identify itself as DKIM_AUTOGENERATE: "true" From 7d8b96cef02856397e74e30a9dab6b152e7a15bf Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Tue, 11 Jul 2023 21:56:04 +0200 Subject: [PATCH 3/8] Add cron jobs to clean cached Mastodon data, close #170 --- roles/docker/tasks/services/mastodon.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/roles/docker/tasks/services/mastodon.yml b/roles/docker/tasks/services/mastodon.yml index 654a32b7..62aed535 100644 --- a/roles/docker/tasks/services/mastodon.yml +++ b/roles/docker/tasks/services/mastodon.yml @@ -187,3 +187,21 @@ external: true internal_network: internal: true + +- name: Configure cron job to remove old Mastodon media daily + cron: + name: Clean Mastodon media data older than a week + cron_file: ansible_mastodon_clean_media + job: docker exec mastodon_web_1 tootctl media remove --days 7 + special_time: daily + user: root + state: present + +- name: Configure cron job to remove old Mastodon preview cards daily + cron: + name: Clean Mastodon media data older than a week + cron_file: ansible_mastodon_clean_preview_cards + job: docker exec mastodon_web_1 tootctl media remove --days 14 + special_time: daily + user: root + state: present From ec73fb702c9eb241f22ec5857dd9687275d1dd51 Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Tue, 11 Jul 2023 22:02:21 +0200 Subject: [PATCH 4/8] Fix cron job name --- roles/docker/tasks/services/mastodon.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/docker/tasks/services/mastodon.yml b/roles/docker/tasks/services/mastodon.yml index 62aed535..a44a5f02 100644 --- a/roles/docker/tasks/services/mastodon.yml +++ b/roles/docker/tasks/services/mastodon.yml @@ -199,7 +199,7 @@ - name: Configure cron job to remove old Mastodon preview cards daily cron: - name: Clean Mastodon media data older than a week + name: Clean Mastodon preview card data older than two weeks cron_file: ansible_mastodon_clean_preview_cards job: docker exec mastodon_web_1 tootctl media remove --days 14 special_time: daily From e2a6d19a322ec6d5e6c5a3361b9793c74b82364a Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Tue, 11 Jul 2023 22:26:08 +0200 Subject: [PATCH 5/8] Fix folder permissions for Mastodon --- roles/docker/tasks/services/mastodon.yml | 35 +++++++++++++++++------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/roles/docker/tasks/services/mastodon.yml b/roles/docker/tasks/services/mastodon.yml index a44a5f02..3faf488c 100644 --- a/roles/docker/tasks/services/mastodon.yml +++ b/roles/docker/tasks/services/mastodon.yml @@ -1,18 +1,33 @@ # vim: ft=yaml.ansible --- -- name: create mastodon volume folders +- name: Create volume folder for Mastodon data file: - name: "{{ services.mastodon.volume_folder }}/{{ volume }}" + name: "{{ services.mastodon.volume_folder }}/mastodon_data" state: directory owner: "991" - group: "991" - loop: - - "postgres_data" - - "postgres_config" - - "redis_data" - - "mastodon_data" - loop_control: - loop_var: volume + mode: u=rwx,g=rx,o=rx + +- name: Create volume folder for PostgreSQL data + file: + name: "{{ services.mastodon.volume_folder }}/postgres_data" + state: directory + owner: "70" + mode: u=rwx,go= + +- name: Create volume folder for PostgreSQL config + file: + name: "{{ services.mastodon.volume_folder }}/postgres_config" + state: directory + owner: root + mode: u=rwx,g=rx,o=rx + +- name: Create volume folder for Redis data + file: + name: "{{ services.mastodon.volume_folder }}/redis_data" + state: directory + owner: "999" + group: "1000" + mode: u=rwx,g=rx,o=rx - name: Copy mastodon environment file template: From 1ebaef9f591bfb3ba69d521ddd4ccf916b94fed4 Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Tue, 11 Jul 2023 22:52:59 +0200 Subject: [PATCH 6/8] Fix cron job... --- roles/docker/tasks/services/mastodon.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/docker/tasks/services/mastodon.yml b/roles/docker/tasks/services/mastodon.yml index 3faf488c..d96e0bf1 100644 --- a/roles/docker/tasks/services/mastodon.yml +++ b/roles/docker/tasks/services/mastodon.yml @@ -216,7 +216,7 @@ cron: name: Clean Mastodon preview card data older than two weeks cron_file: ansible_mastodon_clean_preview_cards - job: docker exec mastodon_web_1 tootctl media remove --days 14 + job: docker exec mastodon_web_1 tootctl preview_cards remove --days 14 special_time: daily user: root state: present From fc74fa0a3b6d76933058ca69e5dd94c341beb9d9 Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Wed, 19 Jul 2023 19:35:28 +0200 Subject: [PATCH 7/8] Upgrade Gitea to 1.20, close #165 --- roles/docker/defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml index 4ca41b05..da366d2e 100644 --- a/roles/docker/defaults/main.yml +++ b/roles/docker/defaults/main.yml @@ -80,7 +80,7 @@ services: file: gitea.yml domain: "git.{{ base_domain }}" volume_folder: "{{ volume_root_folder }}/gitea" - version: 1.18 + version: "1.20" allowed_sender_domain: true passit: From 9126fd8d61b5c14353f81dfda47442eb9cf447a3 Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Wed, 19 Jul 2023 19:38:31 +0200 Subject: [PATCH 8/8] Quote number-like version numbers --- roles/docker/defaults/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml index da366d2e..1f34ddb6 100644 --- a/roles/docker/defaults/main.yml +++ b/roles/docker/defaults/main.yml @@ -110,7 +110,7 @@ services: file: privatebin.yml domain: "paste.{{ base_domain }}" volume_folder: "{{ volume_root_folder }}/privatebin" - version: 20221009 + version: "20221009" codimd: file: codimd.yml @@ -174,11 +174,11 @@ services: file: drone.yml domain: "drone.{{ base_domain }}" volume_folder: "{{ volume_root_folder }}/drone" - version: 1 + version: "1" mailu: file: mailu.yml - version: 1.9 + version: "1.9" domain: "mail.{{ base_domain }}" dns: 192.168.203.254 subnet: 192.168.203.0/24 @@ -218,4 +218,4 @@ services: watchtower: file: watchtower.yml - version: amd64-1.5.3 + version: "1.5.3"