From 5a9f01d47358c15a039b4706053a7bf6e183b54e Mon Sep 17 00:00:00 2001
From: kaiyou
Date: Sun, 22 Apr 2018 11:53:18 +0200
Subject: [PATCH] Provide some first configuration items
---
config/flavors/compose/docker-compose.yml | 124 ++++++++++++++++++++++
config/flavors/compose/mailu.env | 108 +++++++++++++++++++
config/flavors/compose/setup.html | 10 +-
config/templates/steps/expose.html | 6 +-
config/templates/wizard.html | 2 +-
5 files changed, 241 insertions(+), 9 deletions(-)
diff --git a/config/flavors/compose/docker-compose.yml b/config/flavors/compose/docker-compose.yml
index e69de29b..fcf0c092 100644
--- a/config/flavors/compose/docker-compose.yml
+++ b/config/flavors/compose/docker-compose.yml
@@ -0,0 +1,124 @@
+{% set env='mailu.env' %}
+# This file is auto-generated by the Mailu configuration wizard.
+# Please read the documentation before attempting any change.
+
+version: '2'
+
+services:
+
+ # External dependencies
+ redis:
+ image: redis:alpine
+ restart: always
+ volumes:
+ - "$ROOT/redis:/data"
+
+ # Core services
+ front:
+ image: mailu/nginx:{{ version }}
+ restart: always
+ env_file: {{ env }}
+ env:
+ - TLS_FLAVOR={{ tls_flavor or 'letsencrypt' }}
+ - ADMIN={{ expose_admin or 'no' }}
+ ports:
+ {% for port in (80, 443, 25, 465, 587, 110, 995, 143, 993) %}
+ {% if bind4 %}
+ - "$PUBLIC_IPV4:{{ port }}:{{ port }}"
+ {% endif %}
+ {% if bind6 %}
+ - "$PUBLIC_IPV6:{{ port }}:{{ port }}"
+ {% endif %}
+ {% endfor %}
+ {% if flavor in ('cert', 'mail') %}
+ volumes:
+ - "$ROOT/certs:/certs"
+ {% endif %}
+
+ admin:
+ image: mailu/admin:{{ version }}
+ restart: always
+ env_file: {{ env }}
+ {% if not expose_admin %}
+ ports:
+ - 127.0.0.1:8080:80
+ {% endif %}
+ volumes:
+ - "$ROOT/data:/data"
+ - "$ROOT/dkim:/dkim"
+ depends_on:
+ - redis
+
+ imap:
+ image: mailu/dovecot:{{ version }}
+ restart: always
+ env_file: {{ env }}
+ volumes:
+ - "$ROOT/data:/data"
+ - "$ROOT/mail:/mail"
+ - "$ROOT/overrides:/overrides"
+ depends_on:
+ - front
+
+ smtp:
+ image: mailu/postfix:{{ version }}
+ restart: always
+ env_file: {{ env }}
+ volumes:
+ - "$ROOT/data:/data"
+ - "$ROOT/overrides:/overrides"
+ depends_on:
+ - front
+
+ # Optional services
+ {% if enable_antispam %}
+ antispam:
+ image: mailu/rspamd:{{ version }}
+ restart: always
+ env_file: {{ env }}
+ volumes:
+ - "$ROOT/filter:/var/lib/rspamd"
+ - "$ROOT/dkim:/dkim"
+ - "$ROOT/overrides/rspamd:/etc/rspamd/override.d"
+ depends_on:
+ - front
+ {% endif %}
+
+ {% if enable_antivirus %}
+ antivirus:
+ image: mailu/clamav:{{ version }}
+ restart: always
+ env_file: {{ env }}
+ volumes:
+ - "$ROOT/filter:/data"
+ {% endif %}
+
+ {% if enable_webdav %}
+ webdav:
+ image: mailu/radivale:{{ version }}
+ restart: always
+ env_file: {{ env }}
+ volumes:
+ - "$ROOT/dav:/data"
+ {% endif %}
+
+ {% if enable_fetchmail %}
+ fetchmail:
+ image: mailu/fetchmail:{{ version }}
+ restart: always
+ env_file: {{ env }}
+ volumes:
+ - "$ROOT/data:/data"
+ {% endif %}
+
+ # Webmail
+ {% if enable_webmail %}
+ webmail:
+ image: mailu/{{ webmail }}:{{ version }}
+ restart: always
+ env_file: {{ env }}
+ volumes:
+ - "$ROOT/webmail:/data"
+ depends_on:
+ - imap
+ {% endif %}
diff --git a/config/flavors/compose/mailu.env b/config/flavors/compose/mailu.env
index e69de29b..24d7b247 100644
--- a/config/flavors/compose/mailu.env
+++ b/config/flavors/compose/mailu.env
@@ -0,0 +1,108 @@
+# Mailu main configuration file
+#
+# This file is autogenerated by the configuration management wizard.
+# For a detailed list of configuration variables, see the documentation at
+# https://mailu.io
+
+###################################
+# Common configuration variables
+###################################
+
+# Set this to the path where Mailu data and configuration is stored
+ROOT=/mailu
+
+# Set to a randomly generated 16 bytes string
+SECRET_KEY={{ secret(16) }}
+
+# Address where listening ports should bind
+{% if bind4 %}PUBLIC_IPV4={{ bind4 }}{% endif %}
+{% if bind6 %}PUBLIC_IPV6={{ bind6 }}{% endif %}
+
+# Mail address of the postmaster
+POSTMASTER={{ postmaster }}
+
+# Hostnames for this server, separated with comas
+HOSTNAMES={{ hostnames }}
+
+# Authentication rate limit (per source IP address)
+AUTH_RATELIMIT={{ auth_ratelimit }}
+
+# Opt-out of statistics, replace with "True" to opt out
+DISABLE_STATISTICS={{ disable_statistics }}
+
+###################################
+# Server behavior
+###################################
+
+# Message size limit in bytes
+# Default: accept messages up to 50MB
+MESSAGE_SIZE_LIMIT={{ message_size_limit }}
+
+# Networks granted relay permissions, make sure that you include your Docker
+# internal network (default to 172.17.0.0/16)
+RELAYNETS={{ relaynets }}
+
+# Will relay all outgoing mails if configured
+RELAYHOST={{ relayhost }}
+
+# Fetchmail delay
+FETCHMAIL_DELAY={{ fetchmail_delay }}
+
+# Recipient delimiter, character used to delimiter localpart from custom address part
+RECIPIENT_DELIMITER={{ recipient_delimiter }}
+
+{% if dmarc_rua or dmarc_ruf %}
+# DMARC rua and ruf email
+{% if dmarc_rua %}DMARC_RUA={{ dmarc_rua }}{% endif %}
+{% if dmarc_ruf %}DMARC_RUF={{ dmarc_ruf }}{% endif %}
+{% endif %}
+
+{% if welcome_enabled %}
+# Welcome email, enable and set a topic and body if you wish to send welcome
+# emails to all users.
+WELCOME={{ welcome_enable }}
+WELCOME_SUBJECT={{ welcome_subject }}
+WELCOME_BODY={{ welcome_body }}
+{% endif %}
+
+{% if domain_registration %}
+# Domain registration (remove to disable)
+DOMAIN_REGISTRATION=true
+{% endif %}
+
+###################################
+# Web settings
+###################################
+
+# Path to the admin interface if enabled
+WEB_ADMIN=/admin
+
+# Path to the webmail if enabled
+WEB_WEBMAIL=/webmail
+
+# Website name
+SITENAME=Mailu
+
+# Linked Website URL
+WEBSITE=https://mailu.io
+
+{% if recaptcha_public_key and recaptcha_private_key %}
+# Registration reCaptcha settings (warning, this has some privacy impact)
+# RECAPTCHA_PUBLIC_KEY={{ recaptcha_public_key }}
+# RECAPTCHA_PRIVATE_KEY={{ recaptcha_private_key }}
+{% endif %}
+
+###################################
+# Advanced settings
+###################################
+
+{% if password_scheme %}
+# Specific password storage scheme
+PASSWORD_SCHEME={{ password_scheme }}
+{% endif %}
+
+# Header to take the real ip from
+REAL_IP_HEADER={{ real_ip_header }}
+
+# IPs for nginx set_real_ip_from (CIDR list separated by commas)
+REAL_IP_FROM={{ real_ip_from }}
diff --git a/config/flavors/compose/setup.html b/config/flavors/compose/setup.html
index b136250e..e4506e6d 100644
--- a/config/flavors/compose/setup.html
+++ b/config/flavors/compose/setup.html
@@ -4,15 +4,15 @@
Docker Compose expects a project file, named docker-compose.yml
in a project directory. First create your project directory.
-mkdir /path/to/project
+mkdir /mailu
Then download the project file. A side configuration file makes it easier
to read and check the configuration variables generated by the wizard.
-cd /path/to/project
-wget https://...
-wget https://...
+cd /mailu
+wget {{ url_for('.file', uid=uid, filepath='docker-compose.yml', _external=True) }}
+wget {{ url_for('.file', uid=uid, filepath='mailu.env', _external=True) }}
{% endcall %}
@@ -30,7 +30,7 @@ files before going any further.
To start your compose project, simply run the Docker Compose up
command.
-cd /path/to/project
+cd /mailu
docker-compose up -d
{% endcall %}
diff --git a/config/templates/steps/expose.html b/config/templates/steps/expose.html
index c712de63..a87d8979 100644
--- a/config/templates/steps/expose.html
+++ b/config/templates/steps/expose.html
@@ -10,16 +10,16 @@ IP addresses in order to expose its public services. You must at least setup
an IPv4 or an IPv6 address if you wish to access Mailu.
Warning You must use specific addresses, please
-avoid generic all-interfaces addresses like 0.0.0.0 or :: .
+avoid generic all-interfaces addresses like 0.0.0.0
or ::
.
IPv4 listen address
-
+
IPv6 listen address
-
+
{% endcall %}
diff --git a/config/templates/wizard.html b/config/templates/wizard.html
index ff3a8800..c5ac3ebf 100644
--- a/config/templates/wizard.html
+++ b/config/templates/wizard.html
@@ -11,7 +11,7 @@
ready when using this wizard.
{% endcall %}
-