Skip to main content
BlogDeveloper ToolsUsing Object Storage as the Primary Storage for Nextcloud

Using Object Storage as the Primary Storage for Nextcloud

Using Object Storage as the Primary Storage for Nextcloud

This post was originally published in our Linode Community by Mike Fischler, a Linode Customer Support Specialist.

You can use Linode Object Storage as the primary storage for your Nextcloud deployment (if you’re unfamiliar with Nextcloud, it’s an open source productivity and storage management platform, similar to closed-source services like Google Drive, OneDrive and Dropbox). You’ll then be able to use Nextcloud’s extensive app library to set up group folders for different teams, assign bandwidth limitations to individual users, and much more.

Interact with Linode Object Storage in this secure, alternative method without worrying about access control lists, bucket policies, or the command line. Before we get started, it’s important to note that when you use object storage as primary storage, no metadata (names, directory structures, etc.) get stored in the bucket. The metadata only gets stored in the database, and the bucket only holds the file content by a unique identifier, so anything saved to the object storage bucket cannot be accessed from outside of Nextcloud.

First, create a set of access keys and an object storage bucket specifically for this project. While not required, if any security concerns arise, you’ll have the flexibility to revoke keys and delete the bucket without disturbing your other projects. For help with these steps, please refer to the links below.

It will also be helpful to have a domain name that you can point to for this Nextcloud deployment. Our Nextcloud One-Click App can automatically configure DNS records, so all you’ll need to do is make sure your domain gets pointed at the Linode Name Servers. If needed, you can find a list of them below. Keep in mind that it can take up to 48 hours for name server changes to propagate.

ns1.linode.com
ns2.linode.com
ns3.linode.com
ns4.linode.com
ns5.linode.com

Pull up the Nextcloud OCA companion guide and follow along until you reach the “Getting Started after Deployment” section. When you reach this point, try loading the Nextcloud setup page shown in that guide. If you can see that page, the installation was successful. We’re not ready to finish the setup process, so you can close that screen for now. Filling it in at this point will cause a lot of problems, so don’t complete it just yet.

Next, open an SSH session with the Linode and cd into the /var/www/nextcloud/config directory. Create a file inside that directory called storage.config.php and paste in the example below. Remember to fill in the appropriate fields.

<?php
$CONFIG = array(
    'objectstore' => array(
        'class' => '\\OC\\Files\\ObjectStore\\S3',
        'arguments' => array(
                'bucket'   => '<BUCKET_NAME>',
                'key'      => '<ACCESS_KEY>',
                'secret'   => '<SECRET_KEY>',
                'use_ssl'  => true,
                'hostname' => '<HOSTNAME_FOR_OBJ_REGION>',
        ),
    ),
);

Once that is complete, you can save that file, return to the Nextcloud setup page from before, and complete the setup process. In order for this to project to work, that storage.config.php file must exist before you complete the setup.

If everything worked correctly, you should see the Nextcloud hub page as shown in Step 4 of the “Getting Started after Deployment” section. You now have a Nextcloud server backed by a Linode Object Storage Bucket. From here, you can begin to install apps from the Nextcloud library and tweak this setup to meet your specific needs. To get you started, I’ve included some of my favorites below.

Join the Linode Community to post your questions. If your post is selected to to appear on the Linode Blog, we’ll send you a Linode t-shirt.


Comments (7)

  1. Author Photo

    the link to https://docs.nextcloud.com/server/latest/user_manual/files/quota.html is broken.

    any soft/hard file on a single file? I didn’t found it anywhere. I use nextcloud primary on Dedicated server, I have a lot of big > 5 GB

    another question, how to move my current data to Linode Object Storage? Any seamless way to do that without transferring data manually?

  2. Author Photo

    Many thanks for the detailed tips – much appreciated.

  3. Author Photo

    hi , I followed the above article and after creating the file , i get the below error

    Internal Server Error

    The server encountered an internal error and was unable to complete your request.
    Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
    More details can be found in the server log.

    What happens ?

  4. Author Photo

    This didn’t work for me.

    When creating the file storage.config.php, the path didn’t exist. I had to create the www/nextcloud/config directory first. Then the install completely ignored it and used /mnt/ncdata for its storage anyway.

Leave a Reply

Your email address will not be published. Required fields are marked *