1

I'm facing a problem that I don't know how to solve. Basically, when my app is running live on Heroku, I can upload pictures in the platform: those pictures are saved in a directory of my Angular app : /public/images.

But then, everytime I update my app like this:

git add .
git commit -m 'my message'
git push heroku master

My pictures in /public/images just disappears.

Do you know how I could update my app without deleting the pictures? I also tried to pull before, but it tells me that everything is up to date.

PS: To be more specific, it's when I use git push heroku master to deploy my app that my file /public/images is removed and replaced.

Nisse Engström
  • 4,738
  • 23
  • 27
  • 42

1 Answers1

2

When you say /public/images I presume it is in your heroku dyno filesystem itself and not in any external storage like S3 bucket. Please be aware that Heroku dyno's filesystem is ephemeral one which should not be used for any permanent storage (in your case, storing pictures). It is expected to go off when the dyno is restarted typically when you deploy new code or approximately once a day as part of normal dyno management.

Quote from other SO answer on external storage for Heroku apps

Any files that require permanence should be written to S3, or a similar durable store. S3 is preferred as Heroku runs on AWS and S3 offers some performance advantages. Any files that can be recreated at will can be stored on the dyno's ephemeral store.

Ram
  • 1,743
  • 2
  • 18
  • 40