Assets (images) uploaded via app to service cointainer - how persistent are they?
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?
6 Replies
Project ID:
54522a2f-6430-4dff-9578-eeb13637c4f5
54522a2f-6430-4dff-9578-eeb13637c4f5
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
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?
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?
oh! Just did another hard refresh and the image is gone now.
So it must have been gone all along. This is good to know.
Will implement the volume storage now