Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mailu #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 65 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ COMPOSE_PATH_SEPARATOR=:
COMPOSE_FILE=docker-compose.yml:docker-compose.dev.yml

DOCKER_SYNC_STRATEGY=native_osx
DATA_PATH_HOST=~/.raildock/data

WORKSPACE_RUBY_VERSION=2.4.3
WORKSPACE_INSTALL_NODE=true
Expand All @@ -15,7 +16,7 @@ WORKSPACE_INSTALL_PYTHON=true
WORKSPACE_INSTALL_IMAGEMAGICK=false
WORKSPACE_PUID=1000
WORKSPACE_PGID=1000
WORKSPACE_NODE_VERSION=stable
WORKSPACE_NODE_VERSION=lts_carbon
WORKSPACE_YARN_VERSION=latest
WORKSPACE_TIMEZONE=Asia/Tokyo
WORKSPACE_SSH_PORT=2222
Expand All @@ -31,3 +32,66 @@ NGINX_HOST_HTTP_PORT=80
NGINX_HOST_HTTPS_PORT=443
NGINX_HOST_LOG_PATH=./logs/nginx/
NGINX_SITES_PATH=./nginx/sites/

### MAILU ###############################################
MAILU_VERSION=latest
MAILU_RECAPTCHA_PUBLIC_KEY=<YOUR_RECAPTCHA_PUBLIC_KEY>
MAILU_RECAPTCHA_PRIVATE_KEY=<YOUR_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

REDIS_PORT=6379
172 changes: 172 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ services:
- "dockerhost:${DOCKER_HOST_IP}"
ports:
- "${WORKSPACE_SSH_PORT}:22"
- "3000:3000"
tty: true
networks:
- frontend
Expand Down Expand Up @@ -57,6 +58,177 @@ services:
networks:
- frontend
- backend
### Redis ################################################
redis:
build: ./redis
volumes:
- ${DATA_PATH_HOST}/redis:/data
ports:
- "${REDIS_PORT}:6379"
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

networks:
frontend:
Expand Down
6 changes: 1 addition & 5 deletions nginx/sites/default.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
upstream app {
server unix:/var/www/tmp/sockets/puma.sock fail_timeout=0;
}

server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
Expand All @@ -15,7 +11,7 @@ server {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded_Proto $scheme;
proxy_redirect off;
proxy_pass http://app;
proxy_pass http://workspace:3000;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
}
Expand Down
15 changes: 15 additions & 0 deletions redis/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM redis:latest

LABEL maintainer="Mahmoud Zalt <mahmoud@zalt.me>"

## For security settings uncomment, make the dir, copy conf, and also start with the conf, to use it
#RUN mkdir -p /usr/local/etc/redis
#COPY redis.conf /usr/local/etc/redis/redis.conf

VOLUME /data

EXPOSE 6379

#CMD ["redis-server", "/usr/local/etc/redis/redis.conf"]
CMD ["redis-server"]