akhil
(Akhil)
November 3, 2023, 1:48pm
1
Hello all!
I followed this guide to setup s3.
The only option I couldn’t find is " make sure the “Programmatic access ” checkbox is checked"
I couldn’t find any option like that.
But S3 is not working.
Notes: CDN is via CloudFront (s3 is the source of CloudFront)
Thanks
The rake task you’re running insists the specified values are in environment variables, it will not use the ones in the site settings.
2 Likes
akhil
(Akhil)
November 3, 2023, 2:21pm
3
Thanks for the response.
I used rake, thinking that image urls would be replaced with CDN link.
But the S3 setting itself is not working.
Did I miss anything in the S3 configuration?
Yes, you need to set the environment variables to run the rake task to migrate to S3.
akhil
(Akhil)
November 3, 2023, 2:29pm
5
I’m not getting. Hope you reviewed my discourse settings.
Any extra steps needed apart from this guide? Set up file and image uploads to S3
I believe you can get an overview of what environment variables you need here:
Configure an S3 compatible object storage provider for uploads
EDIT: In the context of a rake command, see the answer below
or from the error:
They must be set in the environment, not in site settings.
You can provide them at the time the rake task is run by doing e.g.:
DISCOURSE_S3_BUCKET=foo DISCOURSE_S3_REGION=us-east-1 DISCOURSE_S3_USE_IAM_PROFILE=true rake uploads:migrate_to_s3
akhil
(Akhil)
November 3, 2023, 2:35pm
8
oh okay!
So, I’ll add this to app.yml
Example:
DISCOURSE_USE_S3: true
DISCOURSE_S3_REGION: us-west-1
DISCOURSE_S3_ACCESS_KEY_ID: myaccesskey
DISCOURSE_S3_SECRET_ACCESS_KEY: mysecretkey
DISCOURSE_S3_CDN_URL: https://falcoland-files-cdn.falco.dev
DISCOURSE_S3_BUCKET: falcoland-files
DISCOURSE_S3_BACKUP_BUCKET: falcoland-files/backups
DISCOURSE_BACKUP_LOCATION: s3
Please read Michael’s answer instead!
akhil
(Akhil)
November 3, 2023, 2:42pm
10
Since my installation is fresh!
My only concern is new images. Rake, I did because the article suggested.
I thought just adding S3 settings via discource admin was enough to serve new images from S3!
pfaffman
(Jay Pfaffman)
November 3, 2023, 3:05pm
11
2 Likes
akhil
(Akhil)
November 3, 2023, 3:16pm
12
Yeah, since my setup is S3 and Cloudfront, I added the S3 code as following.
Now rebuilding. I hope S3 will work!
akhil
(Akhil)
November 3, 2023, 3:31pm
13
Didn’t work! I think something is missing related to S3 permissions!
supermathie
(Michael Brown)
November 3, 2023, 5:16pm
15
There’s 3 parts here:
can Discourse read/write/etc. on the bucket?
can anonymous users read from the bucket?
can the CDN read from the bucket?
Looks like it’s the second part not working?
4 Likes
akhil
(Akhil)
November 4, 2023, 9:34am
17
Please review my setup and kindly let me know if I missed anything: S3 and CloudFront CDN
Based on this Guide
Created two buckets:
One for CDN (Enabled ACL also)
One for Backups
Created policy by adding two buckets, attached with IAM user, and generated the access keys.
Created two CloudFront distributions:
cdn.mysite.com (origin is the cdn bucket) by configuring CNAME.
assets.mysite.com (origin is mysite.com ) (Community is on the main domain, not sub-domain) by configuring CNAME.
Based on this guide :
Added the AWS S3 code, and configuration to app.yml as follows:
Thank You.
akhil
(Akhil)
November 4, 2023, 6:00pm
19
Thanks a lot to @pfaffman
Who gave me a clue about using www in the host address . My forum was using a non-www version!
I changed to www version, and rebuilt it!
Everything now works fine including cdn and assets!
Thank You.
1 Like
pfaffman
(Jay Pfaffman)
November 5, 2023, 12:03am
20
I can’t quite see how that fixed it, but glad you got it sorted!
2 Likes
akhil
(Akhil)
November 5, 2023, 4:53am
21
As I explained here , after I did this, the site was offline. So, I was unable to see the outcome of that. But when I tried the same setup on a test sub-domain, all was working fine. Therefore, I suspect there is something wrong with the SSL.
Based on your clue of www, I changed the host address, and the issue was fixed immediately.
I also suspect that the site may have gone offline because of Cloudflare’s recent service outage .
Anyway, it got fixed.
Thank you!
1 Like
system
(system)
Closed
December 5, 2023, 4:53am
22
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.