Dockerfile based Template deletes volume on redeploy.
I have a working template that deploys my app and creates a volume to store data in.
I am seeing the volume get deleted when I click redeploy on the application. I'm doing this when the application code changes or I update the dockerfile. Is there a way to protect the volume from being deleted? Am I going about this in the wrong way?
I am seeing the volume get deleted when I click redeploy on the application. I'm doing this when the application code changes or I update the dockerfile. Is there a way to protect the volume from being deleted? Am I going about this in the wrong way?
12 Replies
Project ID:
48a6a018-c24e-4001-b030-33c5da1ff3bd
48a6a018-c24e-4001-b030-33c5da1ff3bd
do you mean the contents of the volume is being deleted?
yes, the db is deleted wehn I redeploy the app
then the volume is not being used to store the data
what path are you using in code and what path is the volume mounted to?
hmm it is writing to the locaiton.. well unless I have the location wrong of course... I am writing to ./app/data and the volume was created as /data
I got from the help doc that everythig runs in /app ?
sot eh volume would be under that?
yes so your mount point would need to account for that
volumes are not mounted to the project folder, they are mounted at the root of the container
ohh so the volume path would be ./data? while the app si running at ./app ?
nope, please read the docs - https://docs.railway.app/guides/volumes#relative-paths
ok checking it out
ahh I believe I ahve it backwards! so in the volumes mount path I would want to specify that as /app/data and in my app I would reference it as simply ./data
assuming you have your
WORKDIR
set to /app
yesOK, awesome I'll update and see if I get it now. Thank for the help!!