I have successfully made a proof of concept of high availability, easy maintenance, highest file integrity (preventing loss of data from corruption or damaged disks) and high security, using only Open source and proven tools.
Here is list of tools involved:
- OpenZFS as file system
- Apache2 as webserver for each node
- PHP 8.2 FPM for each node
- Redis for file locking and cross node caching
- PostgreSQL for excellent tuning and stream replication (native loadbalancing and replication)
- HAProxy as reverse proxy
This is excellent for mirrored discs. Furthermore it adds features perfect for load balanced/high availability setups. Not only is OpenZFS replication order of magnitudes faster than tools like rsync, it also natively supports snapshots. What it also adds, is the OpenZFS encryption. This allows for encryption of your datasets (not the ZFS structure though), without any inconveniencies to all the nice features of OIpenZFS. This allows for an extra read-only mirror in a public cloud somewhere, for the ultimate backup location.
By using mirrored discs on independant machines, I successfully made it possible for each machine to allow local LXC containers, use the same dataset/pool. So when creating new nodes of nextcloud PHP-FPM and apache servers, they simply attached the LXC host data pool, and my central Redis is expanded with this new node, and file locking and caching is now activated.
It is ridicoulessly simple to setup, however it is not a setup for beginners. I do - however - recommend this approach for further enterprise level setup, as so far it seems to perform very well, and there is less moving parts and more native features that handles the tricky parts.
The more I explores from OpenZFS and the more cool features I unveils, the more I am confident that OpenZFS is the best filesystem to use for Nextcloud.
With the stream replication features and supreme tuning offered by PostgreSQL, I have so far been able to perform better, more solid and with fewer errors, than I did with MariaDB. And yes, I did try for a few years to constantly tweak, tune and improve performance of MariaDB.