Mailu service #21

Merged
valberg merged 6 commits from service/mailu into master 2019-03-05 12:14:03 +00:00
2 changed files with 114 additions and 89 deletions
Showing only changes of commit ae78c942d7 - Show all commits

View file

@ -50,4 +50,6 @@ cryptohagen_website:
domain: "cryptohagen.dk"
mailu:
domain: "mail.{{ base_domain }}"
dns: 192.168.203.254
subnet: 192.168.203.0/24

View file

@ -1,11 +1,5 @@
---
- name: setup network for mailu
docker_network:
name: mailu
ipam_options:
subnet: "{{ mailu.subnet }}"
- name: create mailu volume folders
file:
name: "{{ mailu.volume_folder }}/{{ volume }}"
@ -23,99 +17,128 @@
loop_control:
loop_var: volume
- name: mailu redis container
docker_container:
name: mailu_redis
image: redis:alpine
restart_policy: always
volumes:
- "{{ mailu.volume_folder }}/redis:/data"
- name: mailu database container
docker_container:
image: mailu/postgresql:1.6
restart_policy: always
env_file: "{{ mailu.volume_folder}}/mailu.env"
volumes:
- "{{ mailu.volume_folder }}/data/psql_db:/data"
- "{{ mailu.volume_folder }}/data/psql_backup:/backup"
- name: upload mailu.env file
template:
src: mailu.env.j2
dest: "{{ mailu.volume_folder}}/mailu.env"
- name: mailu front container
docker_container:
name: mailu_front
image: mailu/nginx:1.6
- name: run mail server containers
docker_service:
project_name: mail_server
pull: yes
definition:
version: '3.6'
services:
redis:
image: redis:alpine
restart: always
volumes:
- "{{ mailu.volume_folder }}/redis:/data"
postgresql:
image: mailu/postgresql:1.6
restart: always
env_file: "{{ mailu.volume_folder}}/mailu.env"
volumes:
- "{{ mailu.volume_folder }}/data/psql_db:/data"
- "{{ mailu.volume_folder }}/data/psql_backup:/backup"
networks:
- name: mailu
front:
image: mailu/nginx:{{ mail_server_mailu_version }}
restart: always
env_file: "{{ mailu.volume_folder}}/mailu.env"
environment:
VIRTUAL_HOST: "{{ mailu.domain }}"
LETSENCRYPT_HOST: "{{ mailu.domain }}"
LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}"
volumes:
- "{{ mailu.volume_folder }}/certs:/certs"
- "{{ mailu.volume_folder }}/overrides/nginx:/overrides"
expose:
- "80"
ports:
- "993:993"
- "25:25"
- "587:587"
networks:
- default
- external_services
- name: mailu admin container
docker_container:
image: mailu/admin:1.6
restart_policy: always
resolver:
image: mailu/unbound:{{ mail_server_mailu_version }}
restart: always
env_file: "{{ mailu.volume_folder}}/mailu.env"
networks:
default:
ipv4_address: "{{ mailu.dns }}"
admin:
image: mailu/admin:{{ mail_server_mailu_version }}
restart: always
env_file: "{{ mailu.volume_folder}}/mailu.env"
volumes:
- "{{ mailu.volume_folder }}/data:/data"
- "{{ mailu.volume_folder }}/dkim:/dkim"
depends_on:
- redis
- name: mailu imap container
docker_container:
image: mailu/dovecot:1.6
restart_policy: always
imap:
image: mailu/dovecot:{{ mail_server_mailu_version }}
restart: always
env_file: "{{ mailu.volume_folder}}/mailu.env"
volumes:
- "{{ mailu.volume_folder }}/mail:/mail"
- "{{ mailu.volume_folder }}/overrides:/overrides"
depends_on:
- front
- name: mailu smtp container
docker_container:
image: mailu/postfix:1.6
restart_policy: always
smtp:
image: mailu/postfix:{{ mail_server_mailu_version }}
restart: always
env_file: "{{ mailu.volume_folder}}/mailu.env"
volumes:
- "{{ mailu.volume_folder }}/overrides:/overrides"
depends_on:
- front
- resolver
dns:
- "{{ mailu.dns }}"
- name: mailu antispam container
docker_container:
image: mailu/rspamd:1.6
restart_policy: always
antispam:
image: mailu/rspamd:{{ mail_server_mailu_version }}
restart: always
env_file: "{{ mailu.volume_folder}}/mailu.env"
volumes:
- "{{ mailu.volume_folder }}/filter:/var/lib/rspamd"
- "{{ mailu.volume_folder }}/dkim:/dkim"
- "{{ mailu.volume_folder }}/overrides/rspamd:/etc/rspamd/override.d"
depends_on:
- front
- resolver
dns:
- "{{ mailu.dns }}"
- name: mailu antivirus container
docker_container:
image: mailu/clamav:1.6
restart_policy: always
env_file: "{{ mailu.volume_folder}}/mailu.env"
volumes:
- "{{ mailu.volume_folder}}/filter:/data"
- name: mailu webdav container
docker_container:
image: mailu/radicale:1.6
restart_policy: always
env_file: "{{ mailu.volume_folder}}/mailu.env"
volumes:
- "{{ mailu.volume_folder}}/dav:/data"
- name: mailu fetchmail container
docker_container:
image: mailu/fetchmail:1.6
restart_policy: always
env_file: "{{ mailu.volume_folder}}/mailu.env"
- name: mailu webmail container
docker_container:
webmail:
image: mailu/rainloop:1.6
restart_policy: always
restart: always
env_file: "{{ mailu.volume_folder}}/mailu.env"
volumes:
- "{{ mailu.volume_folder }}/webmail:/data"
depends_on:
- front
- resolver
dns:
- "{{ mailu.dns }}"
networks:
default:
driver: bridge
ipam:
driver: default
config:
- subnet: "{{ mailu.subnet }}"
external_services:
external:
name: external_services