From f627d1cf326cf7f2a0e216980034d59bc4e38592 Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Sun, 10 Dec 2023 18:04:50 +0100 Subject: [PATCH] Upgrade Mailu, close #167 --- roles/docker/defaults/main.yml | 4 +- .../templates/compose-files/mailu.yml.j2 | 55 +++++++++++-------- roles/docker/templates/mailu/env.j2 | 25 ++++++++- 3 files changed, 58 insertions(+), 26 deletions(-) diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml index f1cc168f..29371511 100644 --- a/roles/docker/defaults/main.yml +++ b/roles/docker/defaults/main.yml @@ -167,7 +167,9 @@ services: pre_deploy_tasks: true dns: 192.168.203.254 subnet: 192.168.203.0/24 - version: "1.9" + version: "2.0" + postgres_version: 14-alpine + redis_version: alpine mastodon: domain: "social.{{ base_domain }}" diff --git a/roles/docker/templates/compose-files/mailu.yml.j2 b/roles/docker/templates/compose-files/mailu.yml.j2 index eddc18a9..4e6c6eda 100644 --- a/roles/docker/templates/compose-files/mailu.yml.j2 +++ b/roles/docker/templates/compose-files/mailu.yml.j2 @@ -1,10 +1,10 @@ # vim: ft=yaml.docker-compose -version: '3.6' +version: "3.8" services: postgres: - image: postgres:14-alpine - restart: always + image: postgres:{{ services.mailu.postgres_version }} + restart: unless-stopped environment: POSTGRES_DB: mailu POSTGRES_USER: mailu @@ -15,8 +15,8 @@ services: - "{{ services.mailu.dns }}" redis: - image: redis:alpine - restart: always + image: redis:{{ services.mailu.redis_version }} + restart: unless-stopped volumes: - "./redis:/data" depends_on: @@ -26,7 +26,7 @@ services: front: image: ghcr.io/mailu/nginx:{{ services.mailu.version }} - restart: always + restart: unless-stopped env_file: mailu.env environment: VIRTUAL_HOST: "{{ services.mailu.domain }}" @@ -38,17 +38,25 @@ services: expose: - "80" ports: - - "993:993" - "25:25" - - "587:587" - "465:465" + - "587:587" + - "110:110" + - "995:995" + - "143:143" + - "993:993" networks: - default + - webmail - external_services + depends_on: + - resolver + dns: + - "{{ services.mailu.dns }}" resolver: image: ghcr.io/mailu/unbound:{{ services.mailu.version }} - restart: always + restart: unless-stopped env_file: mailu.env networks: default: @@ -56,8 +64,8 @@ services: admin: image: ghcr.io/mailu/admin:{{ services.mailu.version }} - restart: always - env_file: "{{ services.mailu.volume_folder }}/mailu.env" + restart: unless-stopped + env_file: mailu.env volumes: - "./data:/data" - "./dkim:/dkim" @@ -69,7 +77,7 @@ services: imap: image: ghcr.io/mailu/dovecot:{{ services.mailu.version }} - restart: always + restart: unless-stopped env_file: mailu.env volumes: - "./mail:/mail" @@ -82,7 +90,7 @@ services: smtp: image: ghcr.io/mailu/postfix:{{ services.mailu.version }} - restart: always + restart: unless-stopped env_file: mailu.env volumes: - "./mailqueue:/queue" @@ -93,32 +101,33 @@ services: dns: - "{{ services.mailu.dns }}" + antispam: image: ghcr.io/mailu/rspamd:{{ services.mailu.version }} hostname: antispam - restart: always + restart: unless-stopped env_file: mailu.env volumes: - "./filter:/var/lib/rspamd" - - "./overrides/rspamd:/etc/rspamd/override.d:ro" + - "./overrides/rspamd:/overrides:ro" depends_on: - front + - redis - resolver dns: - "{{ services.mailu.dns }}" webmail: - image: ghcr.io/mailu/rainloop:{{ services.mailu.version }} - restart: always + image: ghcr.io/mailu/webmail:{{ services.mailu.version }} + restart: unless-stopped env_file: mailu.env volumes: - "./webmail:/data" - - "./overrides/rainloop:/overrides:ro" + - "./overrides/snappymail:/overrides:ro" + networks: + - webmail depends_on: - - imap - - resolver - dns: - - "{{ services.mailu.dns }}" + - front networks: default: @@ -127,5 +136,7 @@ networks: driver: default config: - subnet: "{{ services.mailu.subnet }}" + webmail: + driver: bridge external_services: external: true diff --git a/roles/docker/templates/mailu/env.j2 b/roles/docker/templates/mailu/env.j2 index ad0ab16c..8826744f 100644 --- a/roles/docker/templates/mailu/env.j2 +++ b/roles/docker/templates/mailu/env.j2 @@ -43,7 +43,10 @@ DISABLE_STATISTICS=True ADMIN=true # Choose which webmail to run if any (values: roundcube, rainloop, none) -WEBMAIL=rainloop +WEBMAIL=snappymail + +# Expose the API interface (value: true, false) +API=false # Dav server implementation (value: radicale, none) WEBDAV=none @@ -51,6 +54,9 @@ WEBDAV=none # Antivirus solution (value: clamav, none) ANTIVIRUS=none +# Scan Macros solution (value: true, false) +SCAN_MACROS=false + ################################### # Mail settings ################################### @@ -70,6 +76,9 @@ RELAYNETS= # Will relay all outgoing mails if configured RELAYHOST= +# Enable fetchmail +FETCHMAIL_ENABLED=False + # Fetchmail delay FETCHMAIL_DELAY=600 @@ -108,11 +117,14 @@ WEB_ADMIN=/admin # Path to the webmail if enabled WEB_WEBMAIL=/webmail +# Path to the API interface if enabled +WEB_API=/api + # Website name SITENAME={{ base_domain }} # Linked Website URL -WEBSITE=https://{{ services.mailu.domain }} +WEBSITE=https://{{ base_domain }} @@ -147,12 +159,19 @@ LOG_LEVEL=WARNING # Timezone for the Mailu containers. See this link for all possible values https://en.wikipedia.org/wiki/List_of_tz_database_time_zones TZ=Europe/Copenhagen +# Default spam threshold used for new users +DEFAULT_SPAM_THRESHOLD=80 + +# API token required for authenticating to the RESTful API. +# This is a mandatory setting for using the RESTful API. +API_TOKEN= + ################################### # Database settings ################################### + DB_FLAVOR=postgresql DB_USER=mailu DB_PW={{ postgres_passwords.mailu }} DB_HOST=postgres DB_NAME=mailu -