homeserver/docker-compose/nextcloud/docker-compose.yml.j2

152 lines
5.5 KiB
Text
Raw Normal View History

2024-05-31 14:06:00 +02:00
version: '3.3'
services:
######## Datenbank ########
2024-05-31 15:06:41 +02:00
nextcloud-db:
2024-05-31 14:06:00 +02:00
image: "mariadb:11.3.2"
2024-05-31 15:06:41 +02:00
container_name: nextcloud-db
2024-05-31 14:06:00 +02:00
command: --transaction-isolation=READ-COMMITTED --log-bin=ROW --innodb_read_only_compressed=OFF
restart: unless-stopped
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
2024-05-31 15:06:41 +02:00
- db:/var/lib/mysql
2024-05-31 14:06:00 +02:00
environment:
MYSQL_ROOT_PASSWORD: "{{ lookup('keepass', 'nextcloud_mysql_root_password', 'password') }}"
MYSQL_PASSWORD: "{{ lookup('keepass', 'nextcloud_mysql_password', 'password') }}"
MYSQL_DATABASE: nextcloud
MYSQL_USER: nextcloud
MYSQL_INITDB_SKIP_TZINFO: 1
networks:
- intern
healthcheck:
interval: 30s
retries: 3
test:
[
"CMD",
"healthcheck.sh",
"--su-mysql",
"--connect"
]
timeout: 30s
# Error
## [ERROR] Incorrect definition of table mysql.column_stats: expected column 'histogram' at position 10 to have type longblob, found type varbinary(255).
## [ERROR] Incorrect definition of table mysql.column_stats: expected column 'hist_type' at position 9 to have type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB'), found type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB').
# Fix
2024-05-31 15:06:41 +02:00
## docker exec nextcloud-db mysql nextcloud -p<MySQL-Root-Pw> -e "ALTER TABLE mysql.column_stats MODIFY histogram longblob;"
## docker exec nextcloud-db mysql nextcloud -p<MySQL-Root-Pw> -e "ALTER TABLE mysql.column_stats MODIFY hist_type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB');"
2024-05-31 14:06:00 +02:00
######## Redis ########
2024-05-31 15:06:41 +02:00
nextcloud-redis:
2024-05-31 14:06:00 +02:00
image: "redis:7.2.5"
2024-05-31 15:06:41 +02:00
container_name: nextcloud-redis
hostname: nextcloud-redis
2024-05-31 14:06:00 +02:00
networks:
- intern
restart: unless-stopped
command: "redis-server --requirepass {{ lookup('keepass', 'nextcloud_redis_host_password', 'password') }}"
healthcheck:
test: ["CMD", "redis-cli", "--pass", "{{ lookup('keepass', 'nextcloud_redis_host_password', 'password') }}", "--no-auth-warning", "ping"]
interval: 5s
timeout: 2s
retries: 3
######## cron ########
2024-05-31 15:06:41 +02:00
nextcloud-cron:
container_name: nextcloud-cron
2024-05-31 14:09:24 +02:00
image: "registry.mgrote.net/nextcloud-cronjob:latest"
2024-05-31 14:06:00 +02:00
restart: unless-stopped
network_mode: none
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /etc/localtime:/etc/localtime:ro
environment:
2024-05-31 15:06:41 +02:00
NEXTCLOUD_CONTAINER_NAME: nextcloud-app
2024-05-31 14:06:00 +02:00
NEXTCLOUD_CRON_MINUTE_INTERVAL: 1
######## Nextcloud ########
2024-05-31 15:06:41 +02:00
nextcloud-app:
2024-05-31 14:06:00 +02:00
image: "nextcloud:29.0.0"
2024-05-31 15:06:41 +02:00
container_name: nextcloud-app
2024-05-31 14:06:00 +02:00
restart: unless-stopped
depends_on:
2024-05-31 15:06:41 +02:00
- nextcloud-db
- nextcloud-redis
- nextcloud-cron
2024-05-31 14:06:00 +02:00
environment:
2024-05-31 14:15:35 +02:00
# redis
2024-05-31 15:06:41 +02:00
REDIS_HOST: nextcloud-redis
2024-05-31 14:06:00 +02:00
REDIS_HOST_PASSWORD: "{{ lookup('keepass', 'nextcloud_redis_host_password', 'password') }}"
2024-05-31 14:15:35 +02:00
# mysql
2024-05-31 14:06:00 +02:00
MYSQL_DATABASE: nextcloud
MYSQL_USER: nextcloud
MYSQL_PASSWORD: "{{ lookup('keepass', 'nextcloud_mysql_password', 'password') }}"
2024-05-31 15:06:41 +02:00
MYSQL_HOST: nextcloud-db
2024-05-31 14:15:35 +02:00
# mail
2024-05-31 14:06:00 +02:00
SMTP_HOST: mail-relay
SMTP_PORT: 25
SMTP_NAME: info@mgrote.net
2024-05-31 14:15:53 +02:00
MAIL_FROM_ADDRESS: nextcloud@mgrote.net
2024-05-31 14:15:35 +02:00
# admin
NEXTCLOUD_ADMIN_USER: n-admin
NEXTCLOUD_ADMIN_PASSWORD: "{{ lookup('keepass', 'nextcloud_admin_user_password', 'password') }}"
# misc
2024-05-31 15:08:09 +02:00
NEXTCLOUD_TRUSTED_DOMAINS: "nextcloud.mgrote.net"
2024-05-31 14:06:00 +02:00
PHP_MEMORY_LIMIT: 1024M
PHP_UPLOAD_LIMIT: 10G
APACHE_DISABLE_REWRITE_IP: 1
2024-05-31 22:52:42 +02:00
TRUSTED_PROXIES: "172.18.0.0/24" # Subnetz in dem sich traefik befindet
2024-05-31 14:06:00 +02:00
NEXTCLOUD_UPLOAD_LIMIT: 10G
NEXTCLOUD_MAX_TIME: 3600
APACHE_BODY_LIMIT: 0 # unlimited, https://github.com/nextcloud/docker/issues/1796
volumes:
2024-05-31 15:06:41 +02:00
- app:/var/www/html
- data:/var/www/html/data
2024-05-31 14:52:51 +02:00
# hook-script nach install welches die ldap-config setzt, je einmal nach install und vor starten
2024-05-31 14:33:33 +02:00
- ./ldap.sh:/docker-entrypoint-hooks.d/post-installation/ldap.sh
2024-05-31 14:52:51 +02:00
- ./ldap.sh:/docker-entrypoint-hooks.d/before-starting/ldap.sh
2024-05-31 14:41:15 +02:00
# weitere scripte
- ./misc.sh:/docker-entrypoint-hooks.d/post-installation/misc.sh
2024-05-31 14:52:51 +02:00
- ./misc.sh:/docker-entrypoint-hooks.d/before-starting/misc.sh
2024-05-31 14:06:00 +02:00
networks:
- intern
- traefik
- mail-relay
healthcheck:
test: ["CMD", "curl", "-f", "--insecure", "http://localhost:80"]
interval: 30s
timeout: 10s
retries: 3
labels:
2024-05-31 15:06:41 +02:00
traefik.http.routers.nextcloud.rule: Host(`nextcloud.mgrote.net`)
2024-05-31 14:06:00 +02:00
traefik.enable: true
traefik.http.routers.nextcloud.tls: true
traefik.http.routers.nextcloud.tls.certresolver: resolver_letsencrypt
traefik.http.routers.nextcloud.entrypoints: entry_https
traefik.http.services.nextcloud.loadbalancer.server.port: 80
traefik.http.middlewares.nextcloud-webdav.replacepathregex.regex: "^/.well-known/ca(l|rd)dav"
traefik.http.middlewares.nextcloud-webdav.replacepathregex.replacement: "/remote.php/dav/"
traefik.http.middlewares.nextcloud-hsts.headers.stsincludesubdomains: false
traefik.http.middlewares.nextcloud-hsts.headers.stspreload: true
traefik.http.middlewares.nextcloud-hsts.headers.stsseconds: 15552001
traefik.http.middlewares.nextcloud-hsts.headers.isdevelopment: false
traefik.http.routers.nextcloud.middlewares: nextcloud-hsts,nextcloud-webdav
######## Networks ########
networks:
intern:
driver: bridge
traefik:
external: true
mail-relay:
external: true
######## Volumes ########
volumes:
2024-05-31 15:06:41 +02:00
db:
app:
data: