ansible-role-docker_nextcloud/templates/docker-compose.yml

58 lines
1.8 KiB
YAML

# {{ ansible_managed }}
version: '3.1'
services:
nextcloud:
image: nextcloud:{{ docker_nextcloud_version }}
volumes:
- {{ docker_nextcloud_data_dir }}/{{ docker_nextcloud_service_id }}/nextcloud:/var/www/html
- ./php.ini:/usr/local/etc/php/php.ini
{% if docker_nextcloud_custom_volumes is defined %}
{% for volume in docker_nextcloud_custom_volumes %}
- {{ volume.volume }}:{{ volume.target }}
{% endfor %}
{% endif %}
restart: always
depends_on:
db:
condition: service_healthy
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik"
- "traefik.http.routers.{{ docker_nextcloud_service_id }}.entrypoints=web"
- "traefik.http.routers.{{ docker_nextcloud_service_id }}.rule=Host(`{{ docker_nextcloud_fqdn }}`)"
- "traefik.http.services.{{ docker_nextcloud_service_id }}.loadbalancer.server.port=80"
networks:
- nextcloud
- traefik
environment:
- POSTGRES_HOST=db
- POSTGRES_DB={{ docker_nextcloud_db }}
- POSTGRES_USER={{ docker_nextcloud_db_user }}
- POSTGRES_PASSWORD={{ docker_nextcloud_db_password }}
- SMTP_HOST={{ docker_nextcloud_smtp_host }}
- OVERWRITEPROTOCOL=https
- OVERWRITECLIURL=https://{{ docker_nextcloud_fqdn }}
- TRUSTED_PROXIES={{ docker_nextcloud_trusted_proxies }}
db:
image: postgres:14
restart: always
shm_size: 256mb
networks:
- nextcloud
healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres']
volumes:
- {{ docker_nextcloud_data_dir }}/{{ docker_nextcloud_service_id }}/db:/var/lib/postgresql/data
environment:
- POSTGRES_DB={{ docker_nextcloud_db }}
- POSTGRES_USER={{ docker_nextcloud_db_user }}
- POSTGRES_PASSWORD={{ docker_nextcloud_db_password }}
networks:
traefik:
external: true
nextcloud:
internal: true