nextcloud/docker-compose.yml

70 lines
2.6 KiB
YAML

version: '2'
volumes:
nextcloud:
db:
services:
db:
image: mariadb:10.6
restart: always
command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
volumes:
- db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/mysql-root-password
- MYSQL_PASSWORD_FILE=/run/secrets/mysql-password
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
networks:
- traefik-public
app:
image: nextcloud
restart: always
ports:
- 8090:80
links:
- db
volumes:
- nextcloud:/var/www/html
environment:
- MYSQL_PASSWORD_FILE=/run/secrets/mysql-password
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
- MYSQL_HOST=db
networks:
- traefik-public
labels:
- "traefik.enable=true"
- "traefik.http.routers.nextcloud.rule=Host(`drive.alice.ufsj.edu.br`)"
- "traefik.http.routers.nextcloud.service=nextcloud"
- "traefik.http.routers.nextcloud.entrypoints=websecure"
- "traefik.http.services.nextcloud.loadbalancer.server.port=80"
- "traefik.http.routers.nextcloud.tls=true"
- "traefik.http.routers.nextcloud.tls.certresolver=letsencrypt"
- "traefik.http.services.nextcloud.loadbalancer.passhostheader=true"
- "traefik.http.middlewares.nextcloud-securityheaders.headers.stsSeconds=15552000"
- "traefik.http.middlewares.nextcloud-securityheaders.headers.stsIncludeSubdomains=true"
- "traefik.http.middlewares.nextcloud-securityheaders.headers.stsPreload=true"
- "traefik.http.routers.nextcloud.middlewares=nextcloud-redirectregex1,nextcloud-redirectregex2,compresstraefik,nextcloud-securityheaders"
- "traefik.http.middlewares.nextcloud-redirectregex1.redirectregex.permanent=true"
- "traefik.http.middlewares.nextcloud-redirectregex1.redirectregex.regex=https?://([^/]*)/.well-known/(card|cal)dav"
- "traefik.http.middlewares.nextcloud-redirectregex1.redirectregex.replacement=https://$${1}/remote.php/dav/"
- "traefik.http.middlewares.nextcloud-redirectregex2.redirectregex.permanent=true"
- "traefik.http.middlewares.nextcloud-redirectregex2.redirectregex.regex=https?://([^/]*)(/.well-known[^#]*)"
- "traefik.http.middlewares.nextcloud-redirectregex2.redirectregex.replacement=https://$${1}/index.php$${2}"
- "traefik.http.middlewares.compresstraefik.compress=true"
- "traefik.docker.network=traefik-public"
networks:
traefik-public:
external: true
secrets:
mysql-root-password:
file: ./secrets/mysql-root-password
mysql-password:
file: ./secrets/mysql-password