everytime i deploy my image file that i was uploaded is missing
i use filesystem to save my all images. But when i deploy again my file is gone all of the product i have upload is left me just only text..
I think because of the old one would be delete after new deploy
And how should i handle this ?
Use another file system ?
12 Replies
Project ID:
b84d9bbc-534d-4917-ae24-79121d6fb78b
b84d9bbc-534d-4917-ae24-79121d6fb78b
i have config mount volume in railway setting and fill more 2 varibles follow the docs
and try with upload new image size 3Mb and go back to check size in volume's metric
from my setting in project is when i have upload the file it will upload to 'media' folder
and i config in payload volume path is '/media'
is i correctness config ?
this is my config
Yea, keep in mind though that the
/media
folder is not in your app's root by default
I recommend you use RAILWAY_VOLUME_MOUNT_PATH
service variable to get the path of your /media
folderi try all day but still the same with it unmount sir.
when i try to redeploy all the file is gone again
i try first with '/media' because all the file will save in media folder
second i try with '/app/media' still same result
third i try with '/app' deploy was crashed
nah nah, Railway provides the
RAILWAY_VOLUME_MOUNT_PATH
themselves, you're not supposed to write that into service variablesokay one last question ;-;)
in my code i executed code to save upload files to folder 'media'
and i mount in railway to '/app/media'
it didn't mean these two directory will sync together when i redeploy and didn't mean the file i have upload will save in mount volume
correct right ?
--- sorry for my bad english, i try so hard to understand both of english and railway sir
No problem at all 🙂
If you write a file to
RAILWAY_VOLUME_MOUNT_PATH
then it'll store that file in your Volume, this Volume is attached to the docker container when the docker container starts, the volume and its contents will remain intact until you delete it
Meaning to say, anything you write to RAILWAY_VOLUME_MOUNT_PATH
will stay there and your application will be able to access it, all the files will remain there unless you delete them, naturally
( by the way, i say write to RAILWAY_VOLUME_MOUNT_PATH
only out of principal since it's better to the path the service variable gives than just a hardcoded path, but it should work fine the way you have it )Aowwww i got it !