deployment/stacks/nextcloud.yml

133 lines
3.4 KiB
YAML
Raw Normal View History

2022-02-14 11:11:26 +01:00
version: '3.4'
2022-02-14 11:10:14 +01:00
services:
app:
image: 'nextcloud:23.0.8-apache'
2022-02-14 11:10:14 +01:00
deploy:
mode: 'replicated'
replicas: 1
placement:
constraints:
- 'node.labels.class.nextcloud==true'
labels:
- 'traefik.enable=true'
# We create a middleware that redirects the cal/carddav
- 'traefik.http.middlewares.nextcloud-caldav.redirectregex.permanent=true'
- 'traefik.http.middlewares.nextcloud-caldav.redirectregex.regex=^https://(.*)/.well-known/(card|cal)dav'
- 'traefik.http.middlewares.nextcloud-caldav.redirectregex.replacement=https://$${1}/remote.php/dav/'
- 'traefik.http.routers.nextcloud.rule=Host(`cloud.rustybever.be`)'
# We then enable this middleware for the actual nextcloud router
- 'traefik.http.routers.nextcloud.middlewares=nextcloud-caldav@docker'
- 'traefik.http.routers.nextcloud.tls=true'
- 'traefik.http.routers.nextcloud.tls.certresolver=letsEncrypt'
2022-02-14 11:16:11 +01:00
- 'traefik.http.services.nextcloud.loadbalancer.server.port=80'
2022-02-14 11:10:14 +01:00
environment:
- 'POSTGRES_DB=nextcloud'
- 'POSTGRES_USER=nextcloud'
- 'POSTGRES_PASSWORD=nextcloud'
- 'POSTGRES_HOST=db'
- 'REDIS_HOST=redis'
- 'NEXTCLOUD_ADMIN_USER_FILE=/run/secrets/nextcloud_admin_user'
- 'NEXTCLOUD_ADMIN_PASSWORD_FILE=/run/secrets/nextcloud_admin_password'
2022-02-16 22:19:26 +01:00
- 'NEXTCLOUD_TRUSTED_DOMAINS=cloud.rustybever.be'
2022-02-14 11:10:14 +01:00
networks:
- default
- public
secrets:
- nextcloud_admin_user
- nextcloud_admin_password
volumes:
- 'config:/var/www/html/config'
- 'data:/var/www/html/data'
2022-02-16 22:19:26 +01:00
- 'root:/var/www/html'
cron:
image: 'nextcloud:23.0.8-apache'
2022-02-16 22:19:26 +01:00
entrypoint: '/cron.sh'
deploy:
mode: 'replicated'
replicas: 1
placement:
constraints:
- 'node.labels.class.nextcloud==true'
environment:
- 'POSTGRES_DB=nextcloud'
- 'POSTGRES_USER=nextcloud'
- 'POSTGRES_PASSWORD=nextcloud'
- 'POSTGRES_HOST=db'
- 'REDIS_HOST=redis'
- 'NEXTCLOUD_ADMIN_USER_FILE=/run/secrets/nextcloud_admin_user'
- 'NEXTCLOUD_ADMIN_PASSWORD_FILE=/run/secrets/nextcloud_admin_password'
- 'NEXTCLOUD_TRUSTED_DOMAINS=cloud.rustybever.be'
secrets:
- nextcloud_admin_user
- nextcloud_admin_password
volumes:
- 'config:/var/www/html/config'
- 'data:/var/www/html/data'
2022-02-14 11:10:14 +01:00
- 'root:/var/www/html'
db:
image: 'postgres:14.5-alpine'
2022-02-14 11:10:14 +01:00
healthcheck:
2022-02-14 11:24:50 +01:00
test: pg_isready -U nextcloud
2022-02-14 11:10:14 +01:00
interval: 30s
timeout: 5s
retries: 3
start_period: 15s
deploy:
mode: 'replicated'
replicas: 1
placement:
constraints:
- 'node.labels.class.nextcloud==true'
environment:
- 'POSTGRES_DB=nextcloud'
- 'POSTGRES_USER=nextcloud'
- 'POSTGRES_PASSWORD=nextcloud'
volumes:
- 'db-data:/var/lib/postgresql/data'
redis:
image: 'redis:7.0.4-alpine'
2022-02-14 11:10:14 +01:00
healthcheck:
test: 'redis-cli -h localhost ping'
interval: '10s'
timeout: '5s'
retries: 3
deploy:
mode: 'replicated'
replicas: 1
placement:
constraints:
- 'node.labels.class.nextcloud==true'
networks:
public:
external: true
secrets:
nextcloud_admin_user:
external: true
nextcloud_admin_password:
external: true
volumes:
config:
data:
root:
db-data: