From e101e4d5b2d6f548dfffbdad01c267d2f9d5a126 Mon Sep 17 00:00:00 2001 From: ahkui <14049597+ahkui@users.noreply.github.com> Date: Sun, 16 Sep 2018 17:44:18 +0800 Subject: [PATCH] Add mail services(mailu) (#1775) * add mail service --- DOCUMENTATION/content/documentation/index.md | 22 +++ DOCUMENTATION/content/introduction/index.md | 2 +- docker-compose.yml | 164 +++++++++++++++++++ env-example | 61 +++++++ 4 files changed, 248 insertions(+), 1 deletion(-) diff --git a/DOCUMENTATION/content/documentation/index.md b/DOCUMENTATION/content/documentation/index.md index b3e22943..c3668d19 100644 --- a/DOCUMENTATION/content/documentation/index.md +++ b/DOCUMENTATION/content/documentation/index.md @@ -565,6 +565,28 @@ docker-compose up -d php-worker +
+ +## Use Mailu + +1 - You need register a domain. + +2 - Required RECAPTCHA for signup email [HERE](https://www.google.com/recaptcha/admin) + +2 - modify following environment variable in `.env` file + +``` +MAILU_RECAPTCHA_PUBLIC_KEY= +MAILU_RECAPTCHA_PRIVATE_KEY= +MAILU_DOMAIN=laradock.io +MAILU_HOSTNAMES=mail.laradock.io +``` + +2 - Open your browser and visit `http://YOUR_DOMAIN`. + + + +
## Use NetData diff --git a/DOCUMENTATION/content/introduction/index.md b/DOCUMENTATION/content/introduction/index.md index a8ccf260..4e15223f 100644 --- a/DOCUMENTATION/content/introduction/index.md +++ b/DOCUMENTATION/content/introduction/index.md @@ -97,7 +97,7 @@ Beanstalkd - RabbitMQ - PHP Worker - **Queueing Management:** Beanstalkd Console - RabbitMQ Console - **Random Tools:** -HAProxy - Certbot - Blackfire - Selenium - Jenkins - ElasticSearch - Kibana - Grafana - Gitlab - Mailhog - MailDev - Minio - Varnish - Swoole - NetData - Portainer - Laravel Echo... +Mailu - HAProxy - Certbot - Blackfire - Selenium - Jenkins - ElasticSearch - Kibana - Grafana - Gitlab - Mailhog - MailDev - Minio - Varnish - Swoole - NetData - Portainer - Laravel Echo... Laradock introduces the **Workspace** Image, as a development environment. It contains a rich set of helpful tools, all pre-configured to work and integrate with almost any combination of Containers and tools you may choose. diff --git a/docker-compose.yml b/docker-compose.yml index a944795d..990506c9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -952,3 +952,167 @@ services: - "${IDE_ICECODER_PORT}:8080" networks: - backend + + +### MAILU ################################################ + mailu: + image: mailu/admin:${MAILU_VERSION} + volumes: + - "${DATA_PATH_HOST}/mailu/data:/data" + - "${DATA_PATH_HOST}/mailu/dkim:/dkim" + - "${DATA_PATH_HOST}/mailu/webmail:/webmail" + - /var/run/docker.sock:/var/run/docker.sock:ro + depends_on: + - mailu-front + - mailu-imap + - mailu-smtp + - mailu-antispam + - mailu-antivirus + - mailu-webdav + - mailu-admin + - mailu-webmail + - mailu-fetchmail + command: ["sh", "-c", "echo ${MAILU_INIT_ADMIN_USERNAME}@${MAILU_DOMAIN} ${MAILU_INIT_ADMIN_PASSWORD} ;python manage.py advertise ; python manage.py db upgrade ; python manage.py admin ${MAILU_INIT_ADMIN_USERNAME} ${MAILU_DOMAIN} ${MAILU_INIT_ADMIN_PASSWORD} || true;sed -i -- \"s/= Off/= On/g\" /webmail/_data_/_default_/configs/config.ini || true;if grep -Fq \"registration_link_url\" /webmail/_data_/_default_/configs/config.ini;then echo Already set!;else echo \"\" >> /webmail/_data_/_default_/configs/config.ini; echo \"[login]\" >> /webmail/_data_/_default_/configs/config.ini;echo \"registration_link_url = '${MAILU_WEBSITE}${MAILU_WEB_ADMIN}/ui/user/signup'\" >> /webmail/_data_/_default_/configs/config.ini;fi"] + networks: + - backend + mailu-front: + image: mailu/nginx:${MAILU_VERSION} + environment: + - ADMIN=${MAILU_ADMIN} + - WEB_ADMIN=${MAILU_WEB_ADMIN} + - WEB_WEBMAIL=${MAILU_WEB_WEBMAIL} + - WEBDAV=${MAILU_WEBDAV} + - HOSTNAMES=${MAILU_HOSTNAMES} + - TLS_FLAVOR=${MAILU_TLS_FLAVOR} + - MESSAGE_SIZE_LIMIT=${MAILU_MESSAGE_SIZE_LIMIT} + ports: + - "${MAILU_HTTP_PORT}:80" + - "${MAILU_HTTPS_PORT}:443" + - "110:110" + - "143:143" + - "993:993" + - "995:995" + - "25:25" + - "465:465" + - "587:587" + volumes: + - "${DATA_PATH_HOST}/mailu/certs:/certs" + networks: + backend: + aliases: + - front + mailu-imap: + image: mailu/dovecot:${MAILU_VERSION} + environment: + - DOMAIN=${MAILU_DOMAIN} + - HOSTNAMES=${MAILU_HOSTNAMES} + - POSTMASTER=${MAILU_POSTMASTER} + - WEBMAIL=${MAILU_WEBMAIL} + - RECIPIENT_DELIMITER=${MAILU_RECIPIENT_DELIMITER} + volumes: + - "${DATA_PATH_HOST}/mailu/data:/data" + - "${DATA_PATH_HOST}/mailu/mail:/mail" + - "${DATA_PATH_HOST}/mailu/overrides:/overrides" + depends_on: + - mailu-front + networks: + backend: + aliases: + - imap + mailu-smtp: + image: mailu/postfix:${MAILU_VERSION} + environment: + - DOMAIN=${MAILU_DOMAIN} + - HOSTNAMES=${MAILU_HOSTNAMES} + - RELAYHOST=${MAILU_RELAYHOST} + - RELAYNETS=${MAILU_RELAYNETS} + - RECIPIENT_DELIMITER=${MAILU_RECIPIENT_DELIMITER} + - MESSAGE_SIZE_LIMIT=${MAILU_MESSAGE_SIZE_LIMIT} + volumes: + - "${DATA_PATH_HOST}/mailu/data:/data" + - "${DATA_PATH_HOST}/mailu/overrides:/overrides" + depends_on: + - mailu-front + networks: + backend: + aliases: + - smtp + mailu-antispam: + image: mailu/rspamd:${MAILU_VERSION} + volumes: + - "${DATA_PATH_HOST}/mailu/filter:/var/lib/rspamd" + - "${DATA_PATH_HOST}/mailu/dkim:/dkim" + - "${DATA_PATH_HOST}/mailu/overrides/rspamd:/etc/rspamd/override.d" + depends_on: + - mailu-front + networks: + backend: + aliases: + - antispam + mailu-antivirus: + image: mailu/clamav:${MAILU_VERSION} + volumes: + - "${DATA_PATH_HOST}/mailu/filter:/data" + networks: + backend: + aliases: + - antivirus + mailu-webdav: + image: mailu/${MAILU_WEBDAV}:${MAILU_VERSION} + volumes: + - "${DATA_PATH_HOST}/mailu/dav:/data" + networks: + backend: + aliases: + - webdav + mailu-admin: + image: mailu/admin:${MAILU_VERSION} + environment: + - DOMAIN=${MAILU_DOMAIN} + - HOSTNAMES=${MAILU_HOSTNAMES} + - POSTMASTER=${MAILU_POSTMASTER} + - SECRET_KEY=${MAILU_SECRET_KEY} + - AUTH_RATELIMIT=${MAILU_AUTH_RATELIMIT} + - TLS_FLAVOR=${MAILU_TLS_FLAVOR} + - DISABLE_STATISTICS=${MAILU_DISABLE_STATISTICS} + - DMARC_RUA=${MAILU_DMARC_RUA} + - DMARC_RUF=${MAILU_DMARC_RUF} + - WELCOME=${MAILU_WELCOME} + - WELCOME_SUBJECT=${MAILU_WELCOME_SUBJECT} + - WELCOME_BODY=${MAILU_WELCOME_BODY} + - WEB_ADMIN=${MAILU_WEB_ADMIN} + - WEB_WEBMAIL=${MAILU_WEB_WEBMAIL} + - WEBSITE=${MAILU_WEBSITE} + - WEBMAIL=${MAILU_WEBMAIL} + - SITENAME=${MAILU_SITENAME} + - PASSWORD_SCHEME=${MAILU_PASSWORD_SCHEME} + - RECAPTCHA_PUBLIC_KEY=${MAILU_RECAPTCHA_PUBLIC_KEY} + - RECAPTCHA_PRIVATE_KEY=${MAILU_RECAPTCHA_PRIVATE_KEY} + volumes: + - "${DATA_PATH_HOST}/mailu/data:/data" + - "${DATA_PATH_HOST}/mailu/dkim:/dkim" + - /var/run/docker.sock:/var/run/docker.sock:ro + depends_on: + - redis + networks: + backend: + aliases: + - admin + mailu-webmail: + image: "mailu/${MAILU_WEBMAIL}:${MAILU_VERSION}" + volumes: + - "${DATA_PATH_HOST}/mailu/webmail:/data" + networks: + backend: + aliases: + - webmail + mailu-fetchmail: + image: mailu/fetchmail:${MAILU_VERSION} + environment: + - FETCHMAIL_DELAY=${MAILU_FETCHMAIL_DELAY} + volumes: + - "${DATA_PATH_HOST}/mailu/data:/data" + networks: + backend: + aliases: + - fetchmail diff --git a/env-example b/env-example index b1810809..aa16e5f8 100644 --- a/env-example +++ b/env-example @@ -422,3 +422,64 @@ IDE_THEIA_PORT=987 IDE_WEBIDE_PORT=984 IDE_CODIAD_PORT=985 IDE_ICECODER_PORT=986 + +### MAILU ############################################### +MAILU_VERSION=latest +MAILU_RECAPTCHA_PUBLIC_KEY= +MAILU_RECAPTCHA_PRIVATE_KEY= +# Main mail domain +MAILU_HTTP_PORT=6080 +MAILU_HTTPS_PORT=60443 +MAILU_DOMAIN=example.com +MAILU_INIT_ADMIN_USERNAME=laradock +MAILU_INIT_ADMIN_PASSWORD=laradock +# Hostnames for this server, separated with comas +MAILU_HOSTNAMES=mail.example.com,alternative.example.com,yetanother.example.com +# Postmaster local part (will append the main mail domain) +MAILU_POSTMASTER=admin +# Set to a randomly generated 16 bytes string +MAILU_SECRET_KEY=ChangeMeChangeMe +# Choose how secure connections will behave (value: letsencrypt, cert, notls, mail) +MAILU_TLS_FLAVOR=cert +# Authentication rate limit (per source IP address) +MAILU_AUTH_RATELIMIT=10/minute;1000/hour +# Opt-out of statistics, replace with "True" to opt out +MAILU_DISABLE_STATISTICS=False +# Message size limit in bytes +# Default: accept messages up to 50MB +MAILU_MESSAGE_SIZE_LIMIT=50000000 +# Will relay all outgoing mails if configured +MAILU_RELAYHOST= +# Networks granted relay permissions, make sure that you include your Docker +# internal network (default to 172.17.0.0/16) +MAILU_RELAYNETS=172.16.0.0/12 +# Fetchmail delay +MAILU_FETCHMAIL_DELAY=600 +# Recipient delimiter, character used to delimiter localpart from custom address part +# e.g. localpart+custom@domain;tld +MAILU_RECIPIENT_DELIMITER=+ +# DMARC rua and ruf email +MAILU_DMARC_RUA=admin +MAILU_DMARC_RUF=admin +# Weclome email, enable and set a topic and body if you wish to send welcome +# emails to all users. +MAILU_WELCOME=True +MAILU_WELCOME_SUBJECT=Welcome to your new email account +MAILU_WELCOME_BODY=Welcome to your new email account, if you can read this, then it is configured properly! +# Path to the admin interface if enabled +MAILU_WEB_ADMIN=/admin +# Path to the webmail if enabled +MAILU_WEB_WEBMAIL=/webmail +# Website name +MAILU_SITENAME=Example Mail +# Linked Website URL +MAILU_WEBSITE=http://mail.example.com +# Default password scheme used for newly created accounts and changed passwords +# (value: SHA512-CRYPT, SHA256-CRYPT, MD5-CRYPT, CRYPT) +MAILU_PASSWORD_SCHEME=SHA512-CRYPT +# Expose the admin interface (value: true, false) +MAILU_ADMIN=true +# Choose which webmail to run if any (values: roundcube, rainloop, none) +MAILU_WEBMAIL=rainloop +# Dav server implementation (value: radicale, none) +MAILU_WEBDAV=radicale