NextCloud architecture and scaling

Production-Ready Cloud Storage Infrastructure with NextCloud

NextCloud is the most well known alternative to Dropbox, Microsoft OneDrive, or Google Drive for individuals & organizations who prefer to control their own cloud storage infrastructure. Whether hosting data on-premises on physical machines at your own office/datacenter, or on virtualized infrastructure with a cloud provider, administrators benefit from far greater control over user privileges, data protection, and security compared to going with commercial solution.

Although it’s relatively simple to set up a single NextCloud instance for personal use, more planning is required to deploy NextCloud as a robust, enterprise file sync & share solution. This page outlines NextCloud deployment recommendations for a production roll-out in a medium to large sized organization.

The common requirements of a cloud storage administrator in a typical enterprise include:

  • Availability – The data stored within the system should be available to all users on an uninterrupted basis, with few exceptions for unplanned maintenance.
  • Scalability – The storage capacity and concurrent users should be able to grow by scaling out to additional application and storage servers, while the system is in operation.
  • Data Replication – User and metadata should be stored on RAID disks with inherent redundancy against hardware failure. Additionally, data should be replicated in near-real-time to a secondary storage node for failover.
  • Data Backup – User and metadata should be replicated periodically (hourly or daily) to an off-site datacenter, on a data-consistent basis to facilitate disaster recovery from a catastrophic event.
  • Security – User and metadata should be encrypted in-transit and at-rest with SSL/TLS connections and full-disk encryption. Access control and revocation should be controlled from a centralized admin dashboard.

NextCloud as a cloud storage solution can meet all the above requirements, with the minimum cluster specifications below for high availability and horizontal scaling (scale-out) support.

Sample Network Topology

Recommended Operating System: CentOS 7.6 or Ubuntu 18.04 x64

Mid-Sized Enterprise NextCloud Deployment

Image credit: NextCloud documentation contributors, used under CC-BY 3.0 Unported License.

  • 2 x HAProxy Load Balancers as Primary/Secondary
  • 2 x Application Servers with Apache/Nginx and NextCloud
  • 1 x Memory Caching Server with Redis
  • 2 x DB Servers configured with Master/Slave replication with MariaDB
  • 2 x Storage Servers configured as Primary/Secondary replicas with NFS
  • 1 x Backup Server in separate datacenter with rsync

If integrating Collabora Online with NextCloud, 1 x Docker Host should be provisioned to serve the Collabora container behind an Nginx container.

Minimum Hardware Requirements and Costs (DigitalOcean – 150 Users)

For 150 NextCloud users, the minimum hardware requirements for the servers should be:

  • 2 x HAProxy Load Balancers – $20/mo
  • 2 x Application Servers: 4GB / 2 vCPUs – $40/mo
  • 1 x Memory Caching Server: 4GB / 2 vCPUs – $20/mo
  • 2 x DB Servers: 8GB / 4 vCPUs – $80/mo
  • 2 x Storage Servers: 4GB / 2 vCPUs – $40/mo
  • 1 x Backup Server: 4GB / 2 vCPUs – $20/mo
  • 1 x Collabora Online Server: 4GB / 2 vCPUs – $20/mo

First open document in Collabora consumes ~150MB RAM, each subsequent document ~50MB RAM

Note that the free version of Collabora, Collabora Online Development Edition (CODE), is limited to 20 concurrent users and 10 open documents; after a license of $18/user/year is required. With > 20 NextCloud users you can use the free edition of Collabora, as long as < 20 users are editing < 10 documents at any given time.

* Indicative prices based on DigitalOcean pricing (Jun 2019)

With a cloud provider such as DigitalOcean, it costs around $230/mo in compute costs to host this cluster + $0.10/GB/mo of block storage provisioned. The load balancer is a flat rate $10/mo for up to 1,000 concurrent connections. Every $5/mo spent on DigitalOcean VMs adds 1TB to your monthly bandwidth pool, meaning this setup would be entitled to 40TB of egress (upload) traffic from the servers — downloads from the NextCloud clients.

AWS or Azure charge $0.09-$0.11/GB of egress traffic to Internet from most regions, making them significantly more expensive for a NextCloud deployment where users are regularly syncing data to their PCs and mobile devices.

Storage Configuration and Cost Considerations

For maximum scalability, opt for a cloud provider that offers attachable block storage for the Storage and Backup servers, so the volumes can grow as your organization accumulates more data in NextCloud. Note that keeping previous revisions of files using NextCloud’s Version History feature uses additional storage, so take this into consideration when planning the total capacity requirement.

The cloud provider should also provide high speed interconnects between their different data centers for speedy off-site backups of the DB and NFS instances to the backup server.

With 500GB of data replicated to two copies on the NFS cluster, and once to the off-site backup server, a total 1.5TB of block storage would be provisioned, costing $150/mo. In total, the operating cost of this setup costs $390/mo, working out to ~$2.60/user.

Compared to a commercial cloud storage service like Google Apps (unlimited storage) or OneDrive for Business (1TB per user) this might not seem inexpensive, but for many IT organizations, being in control of their own data governance is invaluable. For many businesses, especially ones handling sensitive data in industries such as law, healthcare, research or engineering, storing data in Google Drive or OneDrive is simply not a viable option.

Data sovereignty requirements and complying with laws such as GDPR are also pushing some organizations in the EU/EEA to adopt solutions such as NextCloud to store data in non-US data centers. With Google Apps and OneDrive for Business, you lose control where your organization’s data is stored and replicated when you sign Google or Microsoft’s terms of service.

If the data velocity (rate of change of the data) is not expected to be very high, it could make sense to backup to an object storage service such as BackBlaze B2 ($0.005/GB/mo) or Wasabi ($0.0059/GB/mo) instead of far more expensive block storage at $0.10/GB/mo. The drawback of this is slower data transfer speeds compared to rsyncing within a provider’s global backbone but the cost savings can be worth it.

Hardware Requirements and Costs (OVH Public Cloud – 300 Users)

If scaling up to 300 users or more, it might make more sense to host NextCloud with a VPS cloud provider such as OVH, with numerous regions in Europe (13 datacenters in France, 1 in Germany, Poland, and UK) and even better price/performance ratio than DigitalOcean.

In Gravelines, FR (primary) and Strasbourg, FR datacenter (for backup)

  • 1 x Managed Load Balancer (includes 2TB ingress/egress bandwidth) – €20.50/mo
  • 2 x b2-15 Application Servers: 15GB / 4 vCPUs – €84.00/mo
  • 1 x b2-7 Memory Caching Server: 7GB / 2 vCPUs – €22.00/mo
  • 2 x b2-30 DB Servers: 30GB / 8 vCPUs – €170.00/mo
  • 2 x b2-15 Storage Servers: 15GB / 4 vCPUs – €84.00/mo
  • 1 x b2-15 Backup Server: 15GB / 4 vCPUs – €42.00/mo
  • 1 x b2-7 Collabora Online Server: 7GB / 2 vCPUs – €22.00/mo

* Indicative prices based on OVH Public Cloud pricing, excl. VAT (Jun 2019)

With OVH Public Cloud, it costs around €424/mo in compute costs to host this cluster + €0.08/GB/mo of High Performance block storage provisioned. The load balancer is €20.50/mo for 2TB ingress/egress bandwidth total. Bandwidth for the cloud servers are unmetered, unless using the Singapore or Australia region of OVH.

With 1TB of data replicated to two copies on the NFS cluster, and once to the off-site backup server, a total 3TB of block storage would be provisioned, costing €240/mo. In total, the operating cost of this setup costs €684.50/mo, working out to ~€2.28/user.

White-Glove Deployment of NextCloud by Open Source Experts

If you are thinking about deploying NextCloud for your organization, get in touch with a NextCloud consultant who can recommend the most cost-effective hosting provider for your expected number of users and storage capacity required — and provide you with a tailored estimate of the monthly hosting costs.

Our team handles deploying NextCloud from end-to-end, from interviewing stakeholders in your organization to understand your requirements, provisioning the cloud resources and setting up the servers, to facilitating data upload into your NextCloud instance (if desired). We charge a one-time project fee to get a production-ready instance of NextCloud up-and-running. Thereafter, our team of NextCloud consultants can provide support on a per-incident basis, or a retainer including handling NextCloud version upgrades, with a set number of support hours per month to support your internal IT team.