Assets (images) uploaded via app to service cointainer - how persistent are they?

2 years ago

Hi, I'm playing around with node.js app, it has a frontend with a CMS, and in there I can upload images that will be served for end users on a different frontend. The app builds based on a dockerfile, and some npm scripts. I would expect it to build from clean slate each time, but I just did an experiment, where I uploaded an asset, then redeployed the backend, and the asset was still servers after the deploy has finished. I tried clearing page chace before refreshing yes.

The files are put in /statis/assets/*

Can I count on disk persistence? Or should I implement a 3rd party assest storage solution?

7 Replies

2 years ago

54522a2f-6430-4dff-9578-eeb13637c4f5


2 years ago

you can count on persistence as long as you have a volume mounted to the correct location and you are writing to the correct location


2 years ago

Hey Brody. The thing is I do not have a volume mounted on this project (yet), so I am trying to understand where these image files live.
When running the project locally, they are put in project root /static/assets.
So by intution, I would assume that when running on railway, they would be where ever the published build image is. But I would expect them to be gone after next deploy, since the app would be rebuilt. But this was not the outcome of my experiment, the images seemed to still exist after i redeployed the service - so do they already somehow live outside the service? or is some part of the service kept intact or cached when redeploying? How can I tell where they live?


2 years ago

That’s very interesting. You’re saying that although you don’t have a volume, your images stuck around after a redeploy? Are those images in Github?


2 years ago

Yes, unless there's some chaching going on on the network that I didn't manage to clear properly. I redeployed by clicking this button

1236377991836336000


2 years ago

oh! Just did another hard refresh and the image is gone now.


2 years ago

So it must have been gone all along. This is good to know.
Will implement the volume storage now


Loading...