60.13 Nextcloud Primary Storage S3


An object store can be used as the primary storage so that all users’ files are hosted externally to the nextcloud host on a separate object store server. After the initial setup of the Nextcloud server described in Section 60.1 we can replace the primary storage maintained on a local volume with an external S3 object store as described below. If instead you simply require a new folder to be added that is hosted by an external object store see Section 60.9. As of Nextcloud Hub 3 (Nextcloud version 25 onward) S3 stores can be server-side encrypted.

After setting up your Nextcloud server as described in Section 60.1, and creating a S3 bucket on Linode’s management console, under Object Storage, with an access and secret key, edit /var/snap/nextcloud/current/nextcloud/config/config.php to add the following just before the 'supportedDatabases' entry. Change the bucket name, key, secret, hostname and region to match your setup.

'objectstore' => [
        'class' => '\\OC\\Files\\ObjectStore\\S3',
        'arguments' => [
                'bucket' => 'cloud-example-net-12345',
                'autocreate' => true,
                'key'    => 'YX98TKKH676LOGLOLL7P',
                'secret' => 'ykjflkdulkj84932r88tgmv565578ffhb5tRg4fo',
                'hostname' => 'ap-south-1.linodeobjects.com',
                'port' => 443,
                'use_ssl' => true,
                'region' => 'ap-south-1',

To clear out any pre-existing S3 buckets on your Linode account (assuming none are wanted to be retained):

linode-cli object-storage cancel

To create a new S3 bucket:

linode-cli obj mb --cluster ap-south-1 cloud-example-com-${RANDOM}

The access and secret keys are written to ~/.config/linode-cli.

Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0