nextcloud/compose.yml

148 lines
4.1 KiB
YAML

version: "3.8"
services:
web:
image: nginx:1.20.0
configs:
- source: nginx_conf
target: /etc/nginx/nginx.conf
environment:
- DOMAIN
- STACK_NAME
volumes:
- nextcloud:/var/www/html/
- nextapps:/var/www/html/custom_apps:cached
- nextdata:/var/www/html/data:cached
- nextconfig:/var/www/html/config:cached
- ${EXTRA_VOLUME}
networks:
- proxy
- internal
deploy:
update_config:
failure_action: rollback
order: start-first
labels:
- "traefik.enable=true"
- "traefik.docker.network=proxy"
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=80"
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS})"
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect"
- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLForceHost=true"
- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLHost=${DOMAIN}"
app:
image: nextcloud:22.1.0-fpm
depends_on:
- db
secrets:
- db_password
- admin_password
environment:
- DOMAIN
- STACK_NAME
- MYSQL_HOST=db
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_PASSWORD_FILE=/run/secrets/db_password
- NEXTCLOUD_ADMIN_USER=${ADMIN_USER}
- NEXTCLOUD_ADMIN_PASSWORD_FILE=/run/secrets/admin_password
- NEXTCLOUD_TRUSTED_DOMAINS=${DOMAIN}
- TRUSTED_PROXIES=traefik
- REDIS_HOST=cache
- SMTP_HOST
- MAIL_FROM_ADDRESS
- MAIL_DOMAIN
- SMTP_AUTHTYPE=PLAIN
- OVERWRITEPROTOCOL=https
volumes:
- nextcloud:/var/www/html/
- nextapps:/var/www/html/custom_apps:cached
- nextdata:/var/www/html/data:cached
- nextconfig:/var/www/html/config:cached
- ${EXTRA_VOLUME}
networks:
- internal
# healthcheck:
# test: ["CMD", "curl", "-f", "http://localhost"]
# interval: 30s
# timeout: 10s
# retries: 10
# start_period: 1m
deploy:
update_config:
failure_action: rollback
order: start-first
db:
image: "mariadb:10.5"
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
environment:
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_PASSWORD_FILE=/run/secrets/db_password
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db_root_password
secrets:
- db_root_password
- db_password
volumes:
- "mariadb:/var/lib/mysql"
networks:
- internal
# healthcheck:
# test: 'mysql -p"$$(tr -d "\n" < /run/secrets/db_root_password)"'
# interval: 20s
# timeout: 2s
# retries: 3
# start_period: 30s
deploy:
labels: ["coop-cloud.${STACK_NAME}.db.version=10.5-9c681cef"]
# cron:
# image: nextcloud:22.1.0
# volumes:
# - nextcloud:/var/www/html/
# - nextapps:/var/www/html/custom_apps:cached
# - nextdata:/var/www/html/data:cached
# - nextconfig:/var/www/html/config:cached
# - ${EXTRA_VOLUME}
# networks:
# - internal
# entrypoint: /cron.sh
# deploy:
# labels: ['coop-cloud.${STACK_NAME}.cron.version=22.1.0-89d9ab98']
cache:
image: redis:6.2.5-alpine
networks:
- internal
deploy:
labels:
- coop-cloud.${STACK_NAME}.cache.version=6.2.5-alpine-b658aeb0
secrets:
db_root_password:
external: true
name: ${STACK_NAME}_db_root_password_${SECRET_DB_ROOT_PASSWORD_VERSION}
db_password:
external: true
name: ${STACK_NAME}_db_password_${SECRET_DB_ROOT_PASSWORD_VERSION}
admin_password:
external: true
name: ${STACK_NAME}_admin_password_${SECRET_ADMIN_PASSWORD_VERSION}
volumes:
nextcloud:
nextapps:
nextdata:
nextconfig:
mariadb:
configs:
nginx_conf:
name: ${STACK_NAME}_nginx_${NGINX_CONF_VERSION}
file: nginx.conf.tmpl
template_driver: golang
networks:
proxy:
external: true
internal: