8 months ago
I am storing certain .json and it is scheduled to be stored once in a day when load is less. But every new commit in GitHub will trigger auto-build process. I want that, .json stored shall be accessible to all deployments rather than being deleted in each build process. Is there any way to achieve on this platform. I am on hobby plan.
I am newbie on railway, so please help me out!!
Thanks!!
Pinned Solution
8 months ago
What you need is called volumes. They are persistent data storage that keep state between deployments.
What currently is happening is your app creates a file at /app/data.json. When a new deployment comes, a new container is spun up and previous container along with any data is deleted.
If you want to persist the data.json file then you need to mount the volume at /app so that when a new container is spun up, the same volume is mounted that contains any data written at /app location by previous containers.
2 Replies
8 months ago
Can you please elaborate? What type of data from deployment 1 you need for deployment 2 that you're not getting?
I mean, you can always push the JSON to a database (PostgreSQL, Redis) or a service like S3, Cloudflare R2, Supabase Storage, etc.
8 months ago
What you need is called volumes. They are persistent data storage that keep state between deployments.
What currently is happening is your app creates a file at /app/data.json. When a new deployment comes, a new container is spun up and previous container along with any data is deleted.
If you want to persist the data.json file then you need to mount the volume at /app so that when a new container is spun up, the same volume is mounted that contains any data written at /app location by previous containers.
Status changed to Solved chandrika • 8 months ago