Nextcloud Object Storage in Linode

·

Nextcloud is a really neat web platform that is a bit like if you self-hosted Google Drive. It has file storage, a word processor, a photo editor, a calendar, an instant messenger, and more. I’ve often used it as a feature-rich NAS alternative but I ran into trouble this weekend with storage space.

I’m running my Nextcloud server in Linode in a tiny nanode instance. Everything was running good until it ran out of space! Nanodes only get 25gb of storage space, which is plenty, but not enough for a file server. I could have increased the instance size or added a volume but I opted for Linode’s S3-Compatible object storage.

By default, Nextcloud saves everything to the local file system. Setting up the Object Storage backend is really easy. You simply edit the config.php file with a few keys:

  'objectstore' => 
  array (
    'class' => '\\OC\\Files\\ObjectStore\\S3',
    'arguments' => 
    array (
      'bucket' => 'my_nextcloud_bucket',
      'key' => 'my_access_key',
      'secret' => 'my_key_secret',
      'hostname' => 'my_bucket.us-sea-1.linodeobjects.com',
      'use_ssl' => true,
      'use_path_style' => true,
    ),
  ),

Double check the official docs as the code above may go out of date in a later version. The code above worked good for me with Nextcloud 29.

One gotcha though: Nextcloud does not appear to magically transfer your existing files to object storage. I had to re-upload my files to move them there. All subsequent files land in the newly configured storage engine so it would have been handy for me to set this up when I deployed my instance. 🤓

Also – since I’m running an under-powered instance, object storage actually increased performance because it turns an I/O operation of reading and writing files to the file system to REST requests handled entirely through the network. Neat!