Files
ntbops-ansible/roles/arr/templates/compose.yaml.j2
T

32 lines
1.2 KiB
Django/Jinja

services:
{% for name, service in arr_services.items() %}
{{ name }}:
image: {{ service.image }}
restart: unless-stopped
env_file: .env
{% if arr_routing_mode in ["host", "traefik_file"] %}
ports:
- "{{ nbops_traefik_file_bind_address if arr_routing_mode == 'traefik_file' else '0.0.0.0' }}:{{ service.port }}:{{ service.port }}"
{% endif %}
{% if arr_routing_mode == "traefik" %}
# internal service port: {{ service.port }}; not published on the Docker host
labels:
- traefik.enable=true
- traefik.http.routers.{{ name }}.rule=Host(`{{ service.domain }}`)
- traefik.http.routers.{{ name }}.entrypoints={{ arr_traefik_entrypoint }}
- traefik.http.routers.{{ name }}.tls={{ arr_traefik_tls | bool | ternary('true', 'false') }}
- traefik.http.services.{{ name }}.loadbalancer.server.port={{ service.port }}
networks:
- {{ arr_traefik_network }}
{% endif %}
volumes:
- {{ arr_config_root }}/{{ name }}:/config
- {{ arr_media_root }}:/media
- {{ arr_downloads_root }}:/downloads
{% endfor %}
{% if arr_routing_mode == "traefik" %}
networks:
{{ arr_traefik_network }}:
external: true
{% endif %}