Using Object Storage as the primary storage for Nextcloud
I want to use Linode’s Object Storage as the primary storage for Nextcloud - how do I do that?
1 Reply
This post will cover how to configure a Linode Object Storage Bucket as the primary storage for your Nextcloud deployment. With this you'll 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. All without having to worry about ACLs, Bucket Policies, or the Command Line. The goal of this project is to provide users a secure alternative method for interacting with Linode Object Storage.
It's important to note that when an OBJ Bucket is used as primary storage, no metadata (names, directory structures, etc) is stored in the OBJ Bucket. The metadata is only stored in the database and the OBJ Bucket only holds the file content by unique identifier. Because of this anything saved to the OBJ Bucket can not be accessed from outside of Nextcloud.
Before we begin I recommend creating a set of Access Keys and an OBJ Bucket specifically for this project. This is not required but if any security concerns arise you'll have the flexibility to revoke keys and delete the bucket without disturbing any of your other projects. For help with these steps please refer to the links below.
It would also be helpful to have a domain name that you can point at this Nextcloud deployment. Our Nextcloud OCA has the option to automatically configure DNS records, so all you'll need to do is make sure your domain is pointed at the Linode Name Servers. If needed, you can find a list of them below. Keep in mind 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
To get started, pull up the Nextcloud OCA companion guide and follow along until you reach the section titled "Getting Started after Deployment". When you reach this point try loading the Nextcloud setup page shown in that guide. If you can see that page we know the installation was successful. At this point we are 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 please do not 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, go back 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 setup is completed.
If everything worked correctly you should see the Nextcloud hub page as shown in step 4 of the "Getting Started after Deployment" section. Congratulations, you know 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.
Breezy Dark - https://apps.nextcloud.com/apps/breezedark
Group Folders - https://apps.nextcloud.com/apps/groupfolders
User Usage Report - https://apps.nextcloud.com/apps/user_usage_report
Impersonate - https://apps.nextcloud.com/apps/impersonate
Set storage quotas for users - https://docs.nextcloud.com/server/latest/user_manual/files/quota.html