Cloudflare R2 : Configuration initiale et gestion des erreurs de configuration

I can download backups, I’ve never had any problems with this.

With S3 uploads included?

Thanks very use full, just when I upload in copy the image from clipboard is not working, do you face this problem?, in the end was uploaded to R2 but not visible in post:

Did you look at the image URL, what does it look like?

So we still can’t configure r2 through app. yml?Only through website setting,that is DB_S3_CONFIG?

Use this method,can you upload the old local uploads to R2, via rake uploads : migrate to s3

Hey, thank you all for this.

If I understand this correctly, “DISCOURSE_CDN_URL” can be the same as “DISCOURSE_S3_CDN_URL”, which is the custom public domain linked to the bucket on Cloudflare? Or is some other configuration needed for this?

Yes, you must add the same domain name to the discourse container.yml. Here is an example of usage:

  ## The HTTP or HTTPS CDN address for this Discourse instance (configured to pull)
  ## See https://meta.discourse.org/t/14857 for details
  #DISCOURSE_CDN_URL: https://discourse-cdn.example.com
  #DISCOURSE_USE_S3: true
  DISCOURSE_S3_REGION: 'auto'
  DISCOURSE_S3_ENDPOINT: 'https://45dv544v56x****************************564564.eu.r2.cloudflarestorage.com'
  DISCOURSE_S3_ACCESS_KEY_ID: '564dfds4f54sdfs********65564545'
  DISCOURSE_S3_SECRET_ACCESS_KEY: 'sddfsdf564564**********6545sd4f54sd56f4s6d5'
  DISCOURSE_S3_CDN_URL: 'https://cdn.discourse.com.br'
  ##DISCOURSE_CDN_URL: 'https://cdn.discourse.com.br'
  #DISCOURSE_S3_BUCKET: 'cloudflarebucketname'
  #DISCOURSE_S3_BACKUP_BUCKET: 'cloudflarebackupbucketname/backups'
  #DISCOURSE_BACKUP_LOCATION: 's3'
  DISCOURSE_INCLUDE_S3_UPLOADS_IN_BACKUPS: true
  DISCOURSE_S3_INSTALL_CORS_RULE: false

The settings disabled with this character should be configured via the admin panel; examples are provided in the code. If you prefer, you can also enable these settings within the configuration section, it is up to you.

1 « J'aime »

This option will break the site when set on app.yml, as not all static files like JavaScript are hosted on R2 for some reason.

1 « J'aime »

This is great. I just followed the guide in post #39 and everything worked. I have just one suggestion and 2 questions.

Suggestion:
From what I’ve read, you should make the CDN files bucket publicly available and the backup bucket private. So I created 2 buckets and left the backup one private while making the files bucket public with a custom domain. It just meant that I had to put 2 different paths in the 2 boxes under admin.
I’ve seen a lot of folks put their backups as a path of their top level bucket, am I thinking incorrectly about this? Or is this just an idiosyncrasy with CF R2?

Q1:
I added the ‘DISCOURSE_INCLUDE_S3_UPLOADS_IN_BACKUPS: true’ in my app.yml and rebuilt, but when I go to backups and click the backup button I still get the pop up telling me that uploads won’t be included. Is that just because the pop up does not have any logic under it or is something not right?

Q2:
If I want current uploads moved to R2 what are the concise commands?
I’ve looked around and tried:

./launcher enter app
rake uploads:migrate_to_s3
rake posts:rebake_uncooked_posts

But it looks like that first rake command only works if I set the S3 options in the app.yml file. Is that correct?

If I do that, will R2 continue to work?

1 « J'aime »

Okay, tested and found wanting.
It looks like that first rake command only works for AWS.

rake aborted!
Seahorse::Client::NetworkingError: Failed to open TCP connection to exotics-unlimited.s3.auto.amazonaws.com:443 (getaddrinfo: Name or service not known) (Seahorse::Client::NetworkingError)

Is there another command that does the same thing with other S3 vendors?

1 « J'aime »

Have you done any follow up to see if we can get R2 as a fully working solution?

R2 works fine; just don’t use or set this option: DISCOURSE_CDN_URL

Right, which means it’s not fully working because some static files are not being pushed/hosted correctly.
I’m just looking to make everything work instead of just some of it working.

1 « J'aime »