Files
computer-playbook/roles/web-app-mailu/templates/compose.yml.j2

170 lines
6.8 KiB
Django/Jinja

{% include 'roles/sys-svc-compose/templates/base.yml.j2' %}
{% set service_name = MAILU_FRONT_SERVICE %}
{{ service_name }}:
{{ lookup('compose_only', 'container_name', MAILU_FRONT_CONTAINER_ADDRESS) }}
{{ lookup('container_image', application_id, 'front', image=MAILU_DOCKER_FLAVOR ~ '/nginx', version=MAILU_VERSION) }}
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
{% if MAILU_ACTIVE_PROVIDER | bool %}
{{ lookup('container_ports_mailu') | indent(4) }}
{% else %}
{{ lookup('container_ports', ['mailu', 'http', DOCKER_BIND_HOST]) | indent(4) }}
{% endif %}
{{ lookup('container_volumes', service_name) | indent(4) }}
{{ lookup('container_depends_on', application_id) | indent(4) }}
{{ lookup('container_networks') | indent(4) }}
{% if DEPLOYMENT_MODE == 'compose' %}
webmail:
radicale:
dns:
- {{ MAILU_DNS_RESOLVER }}
{% endif %}
{% set service_name = 'admin' %}
{{ service_name }}:
{{ lookup('compose_only', 'container_name', MAILU_ADMIN_CONTAINER_ADDRESS) }}
{{ lookup('container_image', application_id, 'admin', image=MAILU_DOCKER_FLAVOR ~ '/admin', version=MAILU_VERSION) }}
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
{{ lookup('container_volumes', service_name) | indent(4) }}
{{ lookup('container_depends_on', application_id, extra={
'front': {'condition': 'service_started'},
}) | indent(4) }}
{% if DEPLOYMENT_MODE == 'compose' %}
dns:
- {{ MAILU_DNS_RESOLVER }}
{% else %}
dns:
{% for resolver in NETWORK_PUBLIC_DNS_RESOLVERS %}
- {{ resolver }}
{% endfor %}
{% endif %}
{{ lookup('container_extra_hosts', extra_hosts=MAILU_EXTRA_HOSTS) | indent(4) }}
{{ lookup('container_networks') | indent(4) }}
{% set service_name = 'imap' %}
{{ service_name }}:
{{ lookup('compose_only', 'container_name', MAILU_IMAP_CONTAINER_ADDRESS) }}
{{ lookup('container_image', application_id, 'imap', image=MAILU_DOCKER_FLAVOR ~ '/dovecot', version=MAILU_VERSION) }}
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
{{ lookup('container_volumes', service_name) | indent(4) }}
{{ lookup('depends_on', ['front']) }}
{% if DEPLOYMENT_MODE == 'compose' %}
dns:
- {{ MAILU_DNS_RESOLVER }}
{% endif %}
{{ lookup('container_networks') | indent(4) }}
{% set service_name = 'smtp' %}
{{ service_name }}:
{{ lookup('compose_only', 'container_name', MAILU_SMTP_CONTAINER_ADDRESS) }}
{{ lookup('container_image', application_id, 'smtp', image=MAILU_DOCKER_FLAVOR ~ '/postfix', version=MAILU_VERSION) }}
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
{{ lookup('container_volumes', service_name) | indent(4) }}
{{ lookup('depends_on', ['front']) }}
{% if DEPLOYMENT_MODE == 'compose' %}
dns:
- {{ MAILU_DNS_RESOLVER }}
{% endif %}
{{ lookup('container_networks') | indent(4) }}
{% set service_name = 'oletools' %}
{{ service_name }}:
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
{{ lookup('compose_only', 'container_name', MAILU_OLETOOLS_CONTAINER_ADDRESS) }}
{{ lookup('container_image', application_id, 'oletools', image=MAILU_DOCKER_FLAVOR ~ '/oletools', version=MAILU_VERSION) }}
hostname: oletools
{% if DEPLOYMENT_MODE == 'compose' %}
dns:
- {{ MAILU_DNS_RESOLVER }}
{% endif %}
{{ lookup('container_networks') | indent(4) }}
{% if DEPLOYMENT_MODE == 'compose' %}
noinet:
{% endif %}
{% set service_name = 'antispam' %}
{{ service_name }}:
{{ lookup('compose_only', 'container_name', MAILU_ANTISPAM_CONTAINER_ADDRESS) }}
{{ lookup('container_image', application_id, 'antispam', image=MAILU_DOCKER_FLAVOR ~ '/rspamd', version=MAILU_VERSION) }}
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
{{ lookup('container_volumes', service_name) | indent(4) }}
{{ lookup('depends_on', ['front', 'antivirus'] + (['redis'] if lookup('engine', 'redis', application_id, 'local') else [])) }}
{% if DEPLOYMENT_MODE == 'compose' %}
dns:
- {{ MAILU_DNS_RESOLVER }}
{% endif %}
{{ lookup('container_networks') | indent(4) }}
{% if DEPLOYMENT_MODE == 'compose' %}
noinet:
{% endif %}
{% set service_name = 'antivirus' %}
{{ service_name }}:
{{ lookup('compose_only', 'container_name', MAILU_ANTIVIRUS_CONTAINER_ADDRESS) }}
{{ lookup('container_image', application_id, 'antivirus') }}
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
{{ lookup('container_volumes', service_name) | indent(4) }}
{% if DEPLOYMENT_MODE == 'compose' %}
dns:
- {{ MAILU_DNS_RESOLVER }}
{% endif %}
{{ lookup('container_networks') | indent(4) }}
{% set service_name = 'webdav' %}
{{ service_name }}:
{{ lookup('compose_only', 'container_name', MAILU_WEBDAV_CONTAINER_ADDRESS) }}
{{ lookup('container_image', application_id, 'webdav', image=MAILU_DOCKER_FLAVOR ~ '/radicale', version=MAILU_VERSION) }}
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
{{ lookup('container_volumes', service_name) | indent(4) }}
{% if DEPLOYMENT_MODE == 'compose' %}
dns:
- {{ MAILU_DNS_RESOLVER }}
{% endif %}
{{ lookup('container_networks') | indent(4) }}
{% if DEPLOYMENT_MODE == 'compose' %}
radicale:
{% endif %}
{% set service_name = 'fetchmail' %}
{{ service_name }}:
{{ lookup('compose_only', 'container_name', MAILU_FETCHMAIL_CONTAINER_ADDRESS) }}
{{ lookup('container_image', application_id, 'fetchmail', image=MAILU_DOCKER_FLAVOR ~ '/fetchmail', version=MAILU_VERSION) }}
{{ lookup('container_volumes', service_name) | indent(4) }}
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
{{ lookup('depends_on', ['admin', 'smtp', 'imap']) }}
{% if DEPLOYMENT_MODE == 'compose' %}
dns:
- {{ MAILU_DNS_RESOLVER }}
{% endif %}
{{ lookup('container_networks') | indent(4) }}
{% set service_name = 'webmail' %}
{{ service_name }}:
{{ lookup('compose_only', 'container_name', MAILU_WEBMAIL_CONTAINER_ADDRESS) }}
{{ lookup('container_image', application_id, 'webmail', image=MAILU_DOCKER_FLAVOR ~ '/webmail', version=MAILU_VERSION) }}
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
{{ lookup('container_volumes', service_name) | indent(4) }}
{{ lookup('depends_on', ['imap', 'front']) }}
{% if DEPLOYMENT_MODE == 'compose' %}
dns:
- {{ MAILU_DNS_RESOLVER }}
{% endif %}
{{ lookup('container_networks') | indent(4) }}
{% if DEPLOYMENT_MODE == 'compose' %}
webmail:
{% endif %}
{{ lookup('compose_volumes') }}
{{ lookup('compose_networks') }}
{% if DEPLOYMENT_MODE == 'compose' %}
radicale:
driver: bridge
webmail:
driver: bridge
noinet:
driver: bridge
internal: true
{% endif %}