Last active
December 28, 2019 02:34
-
-
Save manhhailua/57ed010779f1a3f5582675595cfcc762 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Deploy nextcloud in a swarm cluster with https enable | |
# - traefik is living outside of this stack and in public_proxy network | |
# - traefik has http and https entrypoints enabled | |
version: '3.7' | |
services: | |
db: | |
image: mariadb | |
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW | |
environment: | |
MYSQL_ROOT_PASSWORD: password | |
MYSQL_PASSWORD: password | |
MYSQL_DATABASE: nextcloud | |
MYSQL_USER: nextcloud | |
deploy: | |
restart_policy: | |
condition: on-failure | |
volumes: | |
- db:/var/lib/mysql | |
app: | |
image: nextcloud | |
environment: | |
MYSQL_HOST: db | |
deploy: | |
restart_policy: | |
condition: on-failure | |
labels: | |
- "traefik.enable=true" | |
# Routers | |
- "traefik.http.routers.nextcloud_http_router.entrypoints=http" | |
- "traefik.http.routers.nextcloud_http_router.middlewares=httpsRedirectScheme" | |
- "traefik.http.routers.nextcloud_http_router.rule=Host(`nextcloud.example.com`)" | |
- "traefik.http.routers.nextcloud_http_router.service=nextcloud_service" | |
- "traefik.http.routers.nextcloud_https_router.entrypoints=https" | |
- "traefik.http.routers.nextcloud_https_router.rule=Host(`nextcloud.example.com`)" | |
- "traefik.http.routers.nextcloud_https_router.service=nextcloud_service" | |
- "traefik.http.routers.nextcloud_https_router.tls.certresolver=httpChallenge" | |
# Services | |
- "traefik.http.services.nextcloud_service.loadbalancer.server.port=80" | |
networks: | |
- default | |
- public_proxy | |
volumes: | |
- nextcloud:/var/www/html | |
networks: | |
public_proxy: | |
external: true | |
volumes: | |
nextcloud: | |
db: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment