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" domain: "cryptohagen.dk"
mailu: mailu:
domain: "mail.{{ base_domain }}"
dns: 192.168.203.254
subnet: 192.168.203.0/24 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 - name: create mailu volume folders
file: file:
name: "{{ mailu.volume_folder }}/{{ volume }}" name: "{{ mailu.volume_folder }}/{{ volume }}"
@ -23,99 +17,128 @@
loop_control: loop_control:
loop_var: volume 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 - name: upload mailu.env file
template: template:
src: mailu.env.j2 src: mailu.env.j2
dest: "{{ mailu.volume_folder}}/mailu.env" dest: "{{ mailu.volume_folder}}/mailu.env"
- name: mailu front container - name: run mail server containers
docker_container: docker_service:
name: mailu_front project_name: mail_server
image: mailu/nginx:1.6 pull: yes
env_file: "{{ mailu.volume_folder}}/mailu.env" definition:
volumes: version: '3.6'
- "{{ mailu.volume_folder }}/certs:/certs" services:
- "{{ mailu.volume_folder }}/overrides/nginx:/overrides" redis:
image: redis:alpine
restart: always
volumes:
- "{{ mailu.volume_folder }}/redis:/data"
- name: mailu admin container postgresql:
docker_container: image: mailu/postgresql:1.6
image: mailu/admin:1.6 restart: always
restart_policy: always env_file: "{{ mailu.volume_folder}}/mailu.env"
env_file: "{{ mailu.volume_folder}}/mailu.env" volumes:
volumes: - "{{ mailu.volume_folder }}/data/psql_db:/data"
- "{{ mailu.volume_folder}}/data:/data" - "{{ mailu.volume_folder }}/data/psql_backup:/backup"
- "{{ mailu.volume_folder}}/dkim:/dkim" networks:
- name: mailu
- name: mailu imap container front:
docker_container: image: mailu/nginx:{{ mail_server_mailu_version }}
image: mailu/dovecot:1.6 restart: always
restart_policy: always env_file: "{{ mailu.volume_folder}}/mailu.env"
env_file: "{{ mailu.volume_folder}}/mailu.env" environment:
volumes: VIRTUAL_HOST: "{{ mailu.domain }}"
- "{{ mailu.volume_folder}}/mail:/mail" LETSENCRYPT_HOST: "{{ mailu.domain }}"
- "{{ mailu.volume_folder}}/overrides:/overrides" 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 smtp container resolver:
docker_container: image: mailu/unbound:{{ mail_server_mailu_version }}
image: mailu/postfix:1.6 restart: always
restart_policy: always env_file: "{{ mailu.volume_folder}}/mailu.env"
env_file: "{{ mailu.volume_folder}}/mailu.env" networks:
volumes: default:
- "{{ mailu.volume_folder}}/overrides:/overrides" ipv4_address: "{{ mailu.dns }}"
- name: mailu antispam container admin:
docker_container: image: mailu/admin:{{ mail_server_mailu_version }}
image: mailu/rspamd:1.6 restart: always
restart_policy: always env_file: "{{ mailu.volume_folder}}/mailu.env"
env_file: "{{ mailu.volume_folder}}/mailu.env" volumes:
volumes: - "{{ mailu.volume_folder }}/data:/data"
- "{{ mailu.volume_folder}}/filter:/var/lib/rspamd" - "{{ mailu.volume_folder }}/dkim:/dkim"
- "{{ mailu.volume_folder}}/dkim:/dkim" depends_on:
- "{{ mailu.volume_folder}}/overrides/rspamd:/etc/rspamd/override.d" - redis
- name: mailu antivirus container imap:
docker_container: image: mailu/dovecot:{{ mail_server_mailu_version }}
image: mailu/clamav:1.6 restart: always
restart_policy: always env_file: "{{ mailu.volume_folder}}/mailu.env"
env_file: "{{ mailu.volume_folder}}/mailu.env" volumes:
volumes: - "{{ mailu.volume_folder }}/mail:/mail"
- "{{ mailu.volume_folder}}/filter:/data" - "{{ mailu.volume_folder }}/overrides:/overrides"
depends_on:
- front
- name: mailu webdav container smtp:
docker_container: image: mailu/postfix:{{ mail_server_mailu_version }}
image: mailu/radicale:1.6 restart: always
restart_policy: always env_file: "{{ mailu.volume_folder}}/mailu.env"
env_file: "{{ mailu.volume_folder}}/mailu.env" volumes:
volumes: - "{{ mailu.volume_folder }}/overrides:/overrides"
- "{{ mailu.volume_folder}}/dav:/data" depends_on:
- front
- resolver
dns:
- "{{ mailu.dns }}"
- name: mailu fetchmail container antispam:
docker_container: image: mailu/rspamd:{{ mail_server_mailu_version }}
image: mailu/fetchmail:1.6 restart: always
restart_policy: always env_file: "{{ mailu.volume_folder}}/mailu.env"
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 webmail container webmail:
docker_container: image: mailu/rainloop:1.6
image: mailu/rainloop:1.6 restart: always
restart_policy: always env_file: "{{ mailu.volume_folder}}/mailu.env"
env_file: "{{ mailu.volume_folder}}/mailu.env" volumes:
volumes: - "{{ mailu.volume_folder }}/webmail:/data"
- "{{ 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