role_podman_nextcloud/templates/docker-compose.yml.j2
2025-12-09 17:06:06 -05:00

94 lines
2.6 KiB
Django/Jinja

services:
db:
# Note: Check the recommend version here: https://docs.nextcloud.com/server/latest/admin_manual/installation/system_requirements.html#server
image: postgres:alpine
restart: always
volumes:
- db:/var/lib/postgresql/data:Z
env_file:
- .db.env
redis:
image: redis:alpine
restart: always
app:
image: nextcloud:stable-fpm
hostname: app
restart: always
ports:
- "9000:9000"
volumes:
- /home/{{ user.name }}/webroot:/var/www/html
environment:
- NEXTCLOUD_ADMIN_USER=admin
- POSTGRES_DATABASE=nextcloud
- POSTGRES_HOST=db:5432
- REDIS_HOST=redis
- NEXTCLOUD_TRUSTED_DOMAINS={{ inventory_hostname | default('ansible_undefined_host') }}
env_file:
- .db.env
networks:
podman:
aliases:
- "nextcloud.local"
depends_on:
- db
- redis
- proxy
web:
image: nginx:alpine-slim
restart: always
volumes:
# https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html
- /home/{{ user.name }}/web/nginx.conf:/etc/nginx/nginx.conf:ro
# NOTE: The `volumes` included below should match those of the `app` container (unless you know what you're doing)
- /home/{{ user.name }}/webroot:/var/www/html:z,ro
environment:
- VIRTUAL_HOST={{ inventory_hostname | default('ansible_undefined_host') }}
- LETSENCRYPT_HOST={{ inventory_hostname | default('ansible_undefined_host') }}
- LETSENCRYPT_EMAIL="admin@libre.audio"
depends_on:
- app
networks:
- proxy-tier
- podman
cron:
image: nextcloud:fpm-alpine
restart: always
volumes:
- /home/{{ user.name }}/webroot:/var/www/html:z
# NOTE: The `volumes` config of the `cron` and `app` containers must match
entrypoint: /cron.sh
depends_on:
- db
- redis
# Warning: Do not use :latest tags of nginx-proxy unless absolutely sure about the consequences.
proxy:
image: nginxproxy/nginx-proxy:1.7-alpine
restart: always
ports:
- 8080:80
- 4443:443
labels:
- "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy"
volumes:
- /home/{{ user.name }}/proxy/certs:/etc/nginx/certs:z,ro
- /home/{{ user.name }}/proxy/conf.d:/etc/nginx/conf.d:z
- /home/{{ user.name }}/proxy/vhost.d:/etc/nginx/vhost.d:z
- proxy_html:/usr/share/nginx/html:z
- /run/user/{{ getent_passwd[user.name][2] }}/podman/podman.sock:/tmp/docker.sock:ro
networks:
- proxy-tier
volumes:
db:
proxy_html:
networks:
proxy-tier:
podman: