ReinerNippes / nextcloud_on_docker

Run Nextcloud in Docker Container on various Linux Hosts
MIT License
203 stars 48 forks source link

Multiple nextclouds - hints welcome #32

Closed james-cook closed 4 years ago

james-cook commented 4 years ago

Hallo Reiner, I have everything up and running on a test droplet - and had great fun on the way. I even have traefik passing certain other fqdns to the host to be served there. Full imagemagick and facerecognition is compiled in too.

A "set" of containers are all working together to provide "nextcloud" (nginx,redis,nextcloud, nextcloud-db...).

My next question is - based on using your setup - how would you recommend hosting multiple nextclouds? (each reached by different sub-domains: nc1.example.com, nc2.example.com etc. ). BTW I am just hoping for some tips and pointers here and not a full blown solution(!)

It looks (from a docker newbie point of view) that docker-compose would be useful here(?) To reuse the containers I'd need to ensure state is made extrinsic in Volumes.

My goal is on the one hand to get going quite quickly in production. On the other hand I'd like in an ideal world to be able e.g. to vary the nextcloud version from nc1.example.com to nc2.example.com etc. and also be free to add/not add additional compiled in "abilities" such as full imagemagick, facerecognition (pdlib,dlib) (i.e. some nextcloud containers would have less reuse) On the other hand still(!) I have no idea about the memory/resource implications of this approach.

ReinerNippes commented 4 years ago

That would be this playbook: https://github.com/ReinerNippes/selfhosted_on_docker

I realized too late that it's a bad idea to hardcode the names of the container in the playbook

https://github.com/ReinerNippes/nextcloud_on_docker/blob/f7a88d8099ade0e6f4699f6a2eb9e41d875ba309/roles/docker_container/tasks/nextcloud.yml#L33

and that it's possible to loop roles

https://github.com/ReinerNippes/selfhosted_on_docker/blob/477537a555e4faf03ca37f4b96b321e3e6c17c61/prepare_site.yml#L25

In the selfhosted_on_docker playbook it's possible to define a list of nextclouds and start them on one server.

https://github.com/ReinerNippes/selfhosted_on_docker#some-more-apps

But. Each nextcloud will have it's own redis, postgres, nginx, php-fpm. That might not be ressource friendly.

In my approch ansible should replace docker-compose. Of course you can use docker-compose files to add container. You can also use Portainer. Or Docker Swarm, Ranger, Kubernetes. To name just some orchestration tools for docker.

james-cook commented 4 years ago

For multiple nextclouds with or without the same config selfhosted_on_docker is the way to go!

For orchestration ansible works really well in building the containers.

I was looking for single commands to e.g. stop all containers for "nextcloud instance no.2" but this can be easily done with "docker ps grep awk" combinations.

I still wonder if single stateless containers could be used across many docker nextclouds(!)... would be interesting to try