R2 for Nextcloud backend?

Has anyone tried to use R2 for backend to Nextcloud?
Does the S2-backend in Nextcloud support connecting to R2?

Hi there,
Thanks for reaching out to the Cloudflare community!
At this time, I found no practical cases of integrating R2 and Nextcloud
I found a related topic on Reddit here that might be useful: https://www.reddit.com/r/backblaze/comments/keeqqp/nextcloud_b2_and_cloudflare/

Nevertheless, if you do experiment with this please let us know the outcome!

Kind regards.

1 Like

mmm. that looks a bit too complicated for me, but if someone wants to work on this with me let me know!

I just got mine working. Using these instructions:

The only change I had to make was the Region, which I set to “Auto” to get it to work with R2.

The Folder Name is where external storage will show up in any account that has access to this feature.

3 Likes

DANGER ZONE

Following these instructions:
https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/primary_storage.html

If you want to use R2 as your primary storage on a new Nextcloud setup, put this in config.php:

    'objectstore' => [
        'class' => '\\OC\\Files\\ObjectStore\\S3',
        'arguments' => [
                'bucket' => 'BUCKET',
                'autocreate' => true,
                'key'    => 'KEY',
                'secret' => 'SECRET',
                'hostname' => 'ACCOUNT_ID.r2.cloudflarestorage.com',
                'port' => 443,
                'use_ssl' => true,
                'region' => 'auto',
                ],
        ],

Please note that I am still experimenting with this part of the setup on an experimental Nextcloud installation.

And please know that this will replace your /data directory with empty content. (it won’t empty the /data directory on your server, but that’s how it will appear in Nextcloud – no more user data)

If you do this on a running Nextcloud installation, you will no longer be able to access any of your old data.

* If in doubt, back everything up before attempting this.

Do not use this if you already have data in Nextcloud

3 Likes

I got it to work!!
Thank you @sdayman

1 Like

correction. it kinda works.
as “external storage” it works on web, but can’t sync the files to my computer.
as storage backend it connects but the files doesn’t work at all. Can’t upload files on web and sync doesn’t work at all.
i tried with linode object storage now, and that works without any issues, so i’m guessing there’s something with how r2 works. if anyone have any tips to test this more, i’ll gladly give it a shot, but for now i’ll just stick to linode.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.