Taking Charge of Your Cloud: Running a Nextcloud Server

Oct 26, 2023 by Atulpriya Sharma
icon link to Twittericon link to Linkedin
Taking Charge of Your Cloud: Running a Nextcloud Server

The demand for autonomy and control over our data is at an all-time high thanks to the unprecedented pace at which the digital landscape is evolving. Most commercial cloud offerings often leave us questioning the security and privacy of our digital lives.

And that’s why the call for self-hosting is gaining momentum. It has gained substantial popularity in recent years as individuals and organizations seek to break free from the shackles of commercial cloud offerings.

In this blog post, we introduce Nextcloud, a leading open-source, self-hosted cloud solution that gives you full control over your data. We’ll go over the benefits of Nextcloud and how to host it on Acorn.

Nextcloud - Your Self-Hosted Solution

Nextcloud is a popular, open source, self-hosted cloud storage platforms, making it a good alternative to commercial cloud storage solutions like Dropbox or Google Drive. Nextcloud actually goes beyond just file sharing, by providing a wide range of features that enable you to store, manage, collaborate, and communicate while having everything under your control. This makes it a good choice for organizations who want to collaborate with their teams and still have control over their data.

Let us look at some of the features of Nextcloud that make it popular:

  • File Storage and Synchronization: Nextcloud serves as the central hub for file storage and synchronization. It allows users to upload and organize files just as they do with any other cloud offering. Users can also share files with others using configurable share links making sharing a breeze.
  • Office Apps: Nextcloud also comes with a suite of tools such as documents, spreadsheets, and presentations as part of Nextcloud Office that allow real-time collaboration. This makes it a comprehensive platform for collaboration.
  • Chat and Social: Nextcloud allows users to chat with each other just like they do on any other application. Not just chatting, but users can also get on a video call without compromising on security and privacy.
  • 3rd Party Integration: Nextcloud allows users to integrate third-party applications they use with Nextcloud. If you’re an enterprise, you can integrate your LDAP/Active Directory with Nextcloud and allow your users to log in using their existing credentials. As individuals, you can integrate tools like Dropbox, and Google Drive to name a few.

Running Nextcloud - Multiple Ways

When it comes to running Nextcloud, there are multiple options that users can choose from

  1. Self-hosting on your own server
  2. Using a hosting provider
  3. Buying a device that is pre-installed with Nextcloud

Depending on your use case and requirements, you can choose one of the options. Our focus for this post will be self-hosting on your own server.

Even when it comes to running Nextcloud on your server, there are multiple ways users can install Nextcloud. One of the most popular and recommended ways to install Nextcloud using their all-in-one Docker image and deploying it as a container.

In this post, we are going to deploy Nextcloud on Acorn. Acorn is a fully managed cloud hosting platform that includes a fantastic cloud sandbox where you can run any containerized apps for up to two hours at no cost. It's perfect for evaluating a product like Nextcloud without having to provide a credit card or set up a home lab.

The other great thing about Acorn, is that even complex deployments like Nextcloud, that require a container working with a database, and a storage volume can be packaged as an Acorn image and deployed by anyone. I've created a Nextcloud Acorn that you can launch by just clicking this link. Acorn will ask you to create an account, but all you need to provide is your GitHub id, and you'll have access to the sandbox.

Deploying Nextcloud on Acorn

If you'd rather build your own Acornfile for Nextcloud I've documented the steps below. First let's get the Acorn CLI configured. The CLI allows you to interact with the Acorn Runtime as well as Acorn to deploy and manage your applications. Refer to the Installation documentation to install Acorn CLI for your environment.

The key step in deploying any application on Acorn is creating an Acornfile. An Acornfile describes how to build, develop, and run containerized applications. The best part about authoring an Acornfile is that you don’t need to learn anything new as it is similar to a YAML file.

Below is the Acornfile file that we’ve created to deploy Nextcloud on Acorn. You can also find this file in this repo.

services: mariadb: { image: "ghcr.io/acorn-io/mariadb:v10.11.#-#" } containers: { nextcloud: { image: "nextcloud:apache" env: { "MYSQL_HOST": "@{services.mariadb.address}" "MYSQL_DATABASE": "@{services.mariadb.data.dbName}" "MYSQL_USER": "@{services.mariadb.secrets.user.username}" "MYSQL_PASSWORD": "@{services.mariadb.secrets.user.password}" "PHP_UPLOAD_LIMIT": "1G" } dependsOn: ["mariadb"] ports: publish: "80/http" dirs: "/var/www/html": "volume://nextcloud-data" } } volumes: "nextcloud-data": size: "2G"

We define a few things in this Acornfile:

  • Containers: These are the containers that will be deployed for running Nextcloud. We have a single Nextcloud container for which we are setting the environment variables returned from the MariaDB Acorn service.
  • Services: Services in Acron are external services that your application can utilize. In this case, we are using the MariaDB Acorn service.
  • Volumes: The disk we want to store our data on for Nextcloud.

The MariaDB service that we are using in this can be used with any other Acorn that you create. Similarly, you can use any external storage service or configure a volume for the data to persist. You can read about running Nextcloud using Acorn on a home lab setup for a more advanced and personalized setup.

Read more about Acornfiles and the various components that make up an Acornfile.

To deploy the application to Acorn, first log in to Acorn using the following command:

acorn login acorn.io Navigate your browser to https://acorn.io/auth/login?p=pbfld5wf768qc5wjp298hxhngt67b4klzmrlb66jh8vmk4zgct9k2c and login Gtk-Message: 17:28:46.029: Not loading module "atk-bridge": The functionality is provided by GTK natively. Please try to not load it. • Setting default project to acorn.io/techmaharaj/acorn ✔ Login to beta.acorn.io as techmaharaj succeeded

This will open the Acorn portal where you can log in using your GitHub account. Once logged in, the control will return to the terminal and you should have successfully configured Acorn CLI on your system which is now connected to Acorn.

To deploy Nextcloud on Acorn, navigate to the directory with the Acorn file and execute the following command

acorn run -n nextcloud .

This will start the deployment process and Nextcloud will be deployed on Acorn. By default, all applications are deployed to Acorn’s Free sandbox mode which allows you to try and run applications for up to 2 hours after which it will be shutdown. You can upgrade to a pro account if you'd like to run the workload longer and pay for cloud resources as you use them.

Navigate to the Acorn portal to see the application

nextcloud-mariabd-service.png

We can see that the Nextcloud is successfully deployed to Acorn along with the MariaDB service as well. To access the Nextcloud dashboard, click on the arrow next to the running status.

nextcloud-acron-deployed.png

With this, we have successfully deployed Nextcloud to Acorn. With just two commands and an Acornfile we were able to deploy Nextcloud. That’s the beauty of Acron. It makes deploying and managing applications simpler.

If you want to try Nextcloud, just launch this one-click Acorn link. All you need is a GitHub account and Acorn will spin up a Nextcloud instance for you to try.

Best Practices For Using Nextcloud

To leverage the full benefits of Nextcloud, one needs to pay attention to critical aspects like storage, networking, security, and the like. Below are some best practices that can transform your Nextcloud setup from a simple file-sharing application to a robust platform. These are especially applicable if you're hosting your own Nextcloud server in a home lab or private server.

  • Storage: Use external storage solutions like NFS, S3, or Ceph to scale storage capacity. Optimize file handling for external storage and implement automated backups to prevent data loss.
  • Networking: Employ a reverse proxy server for improved web server performance and SSL termination. Consider using a Content Delivery Network (CDN) for global content distribution.
  • Security: Secure file sharing with strong passwords, use two-factor authentication. Always use HTTPS encryption with valid SSL certificates. Implement a firewall and intrusion detection system.
  • Reliability: Implement high availability (HA) and load balancing for uninterrupted service. Ensure redundancy in power supplies, network connections, and storage. Set up comprehensive logging and monitoring. Configure automated failover mechanisms.
  • Scalability/Performance: Fine-tune server parameters, including PHP, database, and web server settings. Use load balancing for traffic distribution. Implement caching for improved performance and set up a dedicated and scalable database server.

Optimizing your Nextcloud instance on Acorn is easier thanks to the Acorn file. This single file is easy to use and allows you to configure everything from network to security, storage, and scalability. Refer to Nextcloud’s configuration settings to learn more about how you can fine-tune your setup.

Summary

In this blog post, we saw how Nextcloud, with its robust features and unwavering focus on privacy, offers a compelling option for secure data management and collaboration. From file sharing to office suite and chat, Nextcloud serves as a great alternative to commercial cloud services for enterprises and individuals.

Deploying Nextcloud with Acorn CLI is a breeze but it's even easier with the One-click installation option. It’s time to embrace true digital autonomy with self-hosting Nextcloud on Acorn.

icon link to Twittericon link to Linkedin