Forem Creators and Builders 🌱

Varhal
Varhal

Posted on

How does Amazons s3 work on Forem?

I set up Amazons s3 on Forem, reloaded the service. For the test, I created a test post. The editor shows a link to the images on Amazons s3:

Image description

But, when I publish the article - the link leads to the local image, what's wrong? Or I don't understand how it works.

https://mydomain.cc/images/P1U78KWx78Dk540UQ2fRwaRMLA-4qBEU4XWzDVsSlNc/w:880/mb:500000/ar:1/aHR0cHM6Ly9wdWIt/d3AuczMuYW1hem9u/YXdzLmNvbS91cGxv/YWRzL2FydGljbGVz/L2VwZnk2emxwcm80/eDJpa20xMXgzLnBu/Zw

Top comments (8)

Collapse
 
varhal profile image
Varhal

@akhil I saw your site app.leewardslope.com and it's all good with the image links, they lead to amazon bucket. How did you do that?

Collapse
 
akhil profile image
Akhil Naidu

you can configure the required env variables in the .env file. I'm not sure how you are hosting your Forem but if you are using t2d, you can use the inbuit add ENV varibles options to add extra ENV variables.

Collapse
 
varhal profile image
Varhal

Hi! I install Forem on digitalocean without t2d and i configure env variables in the .env file:

AWS_ID=
AWS_SECRET=
AWS_BUCKET_NAME=
AWS_UPLOAD_REGION=

Images uploading to amazon, but in frontend images links references to local images.

Thread Thread
 
akhil profile image
Akhil Naidu

If updated the ENV and restart the server.

  1. All the old images which were saved in local docker instance will be deleted
  2. But from now, any uploaded mages will be stored in s3 cloud
Thread Thread
 
varhal profile image
Varhal

If updated the ENV and restart the server.

After edit the ENV i restart server with this command:

'sudo systemctl restart forem.service
sudo systemctl restart forem-traefik.service'

Is this correct or I need another command to restart server?

Thread Thread
 
ellativity profile image
Ella (she/her/elle)

sudo systemctl restart should restart your Forem instance, and I believe that you can restart your server via your DO portal.

Did either of those work for you?

Thread Thread
 
varhal profile image
Varhal

I tried rebooting the server in different ways, the problem is not solved. When uploading an image to the site - it is uploaded to amazon, but is displayed locally on the site.

Thread Thread
 
ellativity profile image
Ella (she/her/elle)

That's right. We haven't changed this since I last spoke to you about it.

@jeremyf tells me that issue you're running into appears to live in this part of the code, so the next step would be for you to open a GitHub Discussion for it πŸ˜‰