Hello. We just migrated from Discourse EC2 to Discourse ECS (container service). When we were in EC2, S3 Uploads was not set up yet. Before the migration, we copied all images from EC2 to the S3 bucket (with public access). However, after doing the migration with S3 Uploads enabled (no CDN yet), we noticed that images (and avatars) didn’t load at all.
DISCOURSE_USE_S3: true DISCOURSE_S3_REGION: us-east-1 DISCOURSE_S3_ACCESS_KEY_ID: aws_access_key DISCOURSE_S3_SECRET_ACCESS_KEY: aws_secret_key DISCOURSE_S3_BUCKET: <uploads-bucket> DISCOURSE_S3_BACKUP_BUCKET: <backups-bucket> DISCOURSE_BACKUP_LOCATION: s3 hooks: after_assets_precompile: - exec: cd: $home cmd: - sudo -E -u discourse bundle exec rake s3:upload_assets
Running the following in the container didn’t help as well:
rake posts:rebake rake posts:missing_uploads rake avatars:refresh
We also noticed the difference between the URLs of images (Discourse still used the “local uploads in EC2" URLs).
This is the link in S3: https://[s3-bucket].s3.amazonaws.com/original/1X/831092e27d6c066c3618a587a5c378e1c794f2c6.png
Link in Discourse (URL still from EC2 uploads): https://[domain]/uploads/default/original/1X/831092e27d6c066c3618a587a5c378e1c794f2c6.png
Error in the browser is: 404 NOT FOUND
How do we configure Discourse to use the correct S3 URLs for the images?