computer-playbook/roles/docker-mailu/templates/docker-compose.yml.j2

137 lines
3.3 KiB
Django/Jinja

version: '2.2'
services:
# External dependencies
redis:
image: redis:alpine
restart: always
env_file: mailu.env
volumes:
- "redis_data:/data"
database:
image: mariadb
restart: always
environment:
MYSQL_DATABASE: "mailu"
MYSQL_USER: "mailu"
MYSQL_PASSWORD: "{{mailu_database_password}}"
MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
volumes:
- database:/var/lib/mysql
healthcheck:
test: "/usr/bin/mysql --user=mailu --password={{mailu_database_password}} --execute \"SHOW DATABASES;\""
interval: 3s
timeout: 1s
retries: 5
# Core services
front:
image: ${DOCKER_ORG:-mailu}/${DOCKER_PREFIX:-}nginx:${MAILU_VERSION:-1.8}
restart: always
env_file: mailu.env
logging:
driver: json-file
ports:
- "127.0.0.1:{{ http_port }}:80"
- "{{ ip4_address }}:25:25"
- "{{ ip4_address }}:465:465"
- "{{ ip4_address }}:587:587"
- "{{ ip4_address }}:110:110"
- "{{ ip4_address }}:995:995"
- "{{ ip4_address }}:143:143"
- "{{ ip4_address }}:993:993"
volumes:
- "/etc/mailu/overrides/nginx:/overrides"
- "/etc/mailu/certs:/certs"
depends_on:
database:
condition: service_healthy
admin:
image: ${DOCKER_ORG:-mailu}/${DOCKER_PREFIX:-}admin:${MAILU_VERSION:-1.8}
restart: always
env_file: mailu.env
volumes:
- "admin_data:/data"
- "dkim:/dkim"
depends_on:
- front
imap:
image: ${DOCKER_ORG:-mailu}/${DOCKER_PREFIX:-}dovecot:${MAILU_VERSION:-1.8}
restart: always
env_file: mailu.env
volumes:
- "dovecot_mail:/mail"
- "/etc/mailu/overrides:/overrides"
depends_on:
- front
smtp:
image: ${DOCKER_ORG:-mailu}/${DOCKER_PREFIX:-}postfix:${MAILU_VERSION:-1.8}
restart: always
env_file: mailu.env
volumes:
- "/etc/mailu/overrides:/overrides"
- "smtp_queue:/queue"
depends_on:
- front
antispam:
image: ${DOCKER_ORG:-mailu}/${DOCKER_PREFIX:-}rspamd:${MAILU_VERSION:-1.8}
restart: always
env_file: mailu.env
volumes:
- "filter:/var/lib/rspamd"
- "dkim:/dkim"
- "/etc/mailu/overrides/rspamd:/etc/rspamd/override.d"
depends_on:
- front
# Optional services
antivirus:
image: ${DOCKER_ORG:-mailu}/${DOCKER_PREFIX:-}clamav:${MAILU_VERSION:-1.8}
restart: always
env_file: mailu.env
volumes:
- "filter:/data"
webdav:
image: ${DOCKER_ORG:-mailu}/${DOCKER_PREFIX:-}radicale:${MAILU_VERSION:-1.8}
restart: always
env_file: mailu.env
volumes:
- "webdav_data:/data"
# Deactivated, because service leads to slowing down of webservices.
# Checkout the readme.md for more information
# fetchmail:
# image: ${DOCKER_ORG:-mailu}/${DOCKER_PREFIX:-}fetchmail:${MAILU_VERSION:-1.8}
# restart: always
# env_file: mailu.env
# Webmail
webmail:
image: ${DOCKER_ORG:-mailu}/${DOCKER_PREFIX:-}roundcube:${MAILU_VERSION:-1.8}
restart: always
env_file: mailu.env
volumes:
- "webmail_data:/data"
depends_on:
- imap
volumes:
database:
smtp_queue:
admin_data:
webdav_data:
webmail_data:
filter:
dkim:
dovecot_mail:
redis_data:
networks:
default:
driver: bridge
ipam:
driver: default
config:
- subnet: {{mailu_subnet}}