Deploy / Install Nextcloud on Docker Swarm behind Traefik Proxy | Self-hosted Storage Server

Опубликовано: 29 Сентябрь 2024
на канале: TUNEIT
2,879
21

How to deploy / install Nextcloud container (Docker Swarm) behind Traefik with automatic SSL certificate using Lets-encrypt.

Your own storage Nextcloud server in docker swarm using Docker-compose with MariaDB as back-end database - Super simple and easy to host Nextcloud Instance quickly.

Alternative to Dropbox, Google Cloud and Microsoft One Drive.

#Nextcloud
#NextcloudDocker
#NextcloudTraefik

Use Traefik in front of Nextcloud to reverse proxy / load balance and also get automatic SSL Certificate from Letsencrypt.

Full blog post here: https://rb.gy/ags398

Useful referral links
=========================================
Digital ocean - https://m.do.co/c/4fc5bb284d41

Rasberry Pi - https://uk.pi-supply.com/?ref=cjv78_u...

Create beautiful social media graphics - https://www.canva.com/join/wqj-rnt-rtx

Learn more about Nextcloud using below links
=========================================
https://nextcloud.com/

https://en.wikipedia.org/wiki/Nextcloud

==Please setup Docker Swarm Cluster; setup Glusterfs Replicated Volume in it and deploy Traefik before deploying MariaDB. Please find below videos for the same==

Setup Docker Swarm in Azure on Ubuntu 20.04
=========================================
   • Setup Docker Swarm Cluster on Ubuntu ...  

Full blog post here: https://rb.gy/lbcj6e

Setup Glusterfs Replicated volume in Docker Swarm
=========================================
   • Install GlusterFS as Replicated Stora...  

Full blog post here: https://rb.gy/lbcj6e

Deploy Traefik v2.0 in Docker Swarm as a reverse proxy
=========================================
   • Deploy Traefik v2.0 - Cloud Native Ed...  

Full blog post here: https://rb.gy/ayr4f9

Deploy MariaDB in Docker Swarm
=========================================
   • Deploy MariaDB 10.5.5 in Docker Swarm...  

Full blog post here: https://rb.gy/lwqbgs

/=========================================/
Please find the full list of commands below.
/=========================================/

Create local glusterfs folder to map Nextcloud container volumes
=========================================
cd /mnt
sudo mkdir -p nextcloud
sudo mkdir -p nextappls
sudo mkdir -p nextdata
sudo mkdir -p nextconfig

Give permissions for glusterfs folder
=========================================
sudo chown -R www-data:www-data nextcloud nextapps nextdata nextconfig

Nextcloud Configuration - docker compose
=========================================
version: "3.7"

services:
nextcloud:
image: nextcloud:latest
depends_on:
- maindb
secrets:
- mysql_db_password
environment:
- MYSQL_HOST=maindb:3306
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=username
- MYSQL_DB_PASSWORD_FILE=/run/secrets/mysql_db_password
volumes:
- /mnt/nextcloud:/var/www/html:cached
- /mnt/nextcloud:/var/www/html/custom-apps:cached
- /mnt/nextcloud:/var/www/html/data/cached
- /mnt/nextcloud:/var/www/html/config:cached
networks:
- proxy
deploy:
placement:
constraints: [node.role == worker]
replicas: 1
update_config:
parallelism: 2
delay: 10s
restart_policy:
condition: on-failure
labels:
- "traefik.enable=true"
- "traefik.docker.network=proxy"
- "traefik.http.routers.nextcloud.rule=Host(`nextcloud.example.com`)"
- "traefik.http.routers.nextcloud.tls=true"
- "traefik.http.routers.nextcloud.tls.certresolver=default"
- "traefik.http.routers.nextcloud.entrypoints=websecure"
- "traefik.http.services.nextcloud.loadbalancer.server.port=80"
secrets:
mysql_db_password:
external: true
volumes:
mariadb:
driver: "local"
nextcloud:
driver: "local"
nextapps:
driver: "local"
nextconfig:
driver: "local"
networks:
proxy:
external: true

Deploy Nextcloud using docker stack deploy
=========================================
sudo docker stack deploy --compose-file next.yml nextcloud

Check Nextcloud stack status and service logs
=========================================
docker stack ps nextcloud
docker service logs nextcloud_nextcloud

/=========================================/
Remember to leave a comment or like on this video and subscribe if you want to see more!
/=========================================/