S3, Assets & CDN Error

,

Hi, I’m facing a strange issue, regarding to: S3 (DigitalOcean), Assets (over S3) and CDN Endpoint.

Description of the Problem:

In the case of an error, I’m only seeing the loading animation, and the errors are displayed as shown in the image below:

This is the error sceme:

/ CDN Endpoint “normal” Endpoint
DISCOURSE_S3_BUCKET SET :x: Pic1 :white_check_mark:
DISCOURSE_S3_BUCKET NOT SET :white_check_mark: :white_check_mark:
  • CDN Endpoint: https://<bucket>.fra1.cdn.digitaloceanspaces.com
  • “normal” Endpoint: https://<bucket>.fra1.digitaloceanspaces.com

Current Configuration:

  DISCOURSE_USE_S3: true

  DISCOURSE_S3_ACCESS_KEY_ID: <token>
  DISCOURSE_S3_SECRET_ACCESS_KEY: <secret>
  DISCOURSE_S3_ENDPOINT: https://fra1.digitaloceanspaces.com
  DISCOURSE_S3_CDN_URL: https://<bucket>.fra1.cdn.digitaloceanspaces.com
  #DISCOURSE_S3_BUCKET: '<bucket>' # for assets
  DISCOURSE_S3_UPLOAD_BUCKET: '<bucket>'
  DISCOURSE_S3_REGION: fra1
  DISCOURSE_BACKUP_LOCATION: s3
  DISCOURSE_S3_BACKUP_BUCKET: '<bucket>/backups '
  DISCOURSE_S3_INSTALL_CORS_RULE: false

I have also set the following hook (if I use the DISCOURSE_S3_BUCKET variable):

hooks:
  after_assets_precompile:
    - exec:
        cd: $home
        cmd:
          - sudo -E -u discourse bundle exec rake s3:upload_assets

I only encounter the error with the ‘right’ combination of configs. Any Ideas? I can also provide more information if needed.

You need a different CDN. Bunny.net is easy.

2 Likes

I agree that Bunny works well and is easy to configure.

I changed from Stackpath (Their CDN price has tripled last year :scream_cat:) to Bunny on my forum recently.

As a bonus, it was also beneficial for a Chinese user:

3 Likes

Thank you for the suggestion!

I’m part of an open source project and the traffic at the moment wouldn’t justify using a different CDN :sweat_smile:. The reason we’re using DigitalOcean is that they have a free sponsorship program for open source projects.

The thing is: It’s now kind of working with DO (pictures and uploaded stuff get’s syncronized). I set the DISCOURSE_S3_UPLOAD_BUCKET, but not the DISCOURSE_S3_BUCKET. So can you explain “awfully broken” a bit more?

The annoing thing is:

  • commands like rake uploads:s3_migration_status do not work, because they rely on DISCOURSE_S3_BUCKET
  • I can’t use the CDN for assets