4 months ago
Hi Railway Support team,
I’m running a Node.js application that uses SQLite (better-sqlite3) for persistent data storage.
The database file (database.sqlite) is being created correctly and works as expected when I restart the deployment, but data is lost when a new deployment is triggered via git commit, which suggests the filesystem is currently ephemeral.
I would like to enable persistent storage / persistent volume for this service so the SQLite database file is preserved across deployments.
Could you please:
- Confirm whether my service currently has persistent storage enabled
- Enable a persistent volume for this project (or guide me to the correct setting if I’m missing it)
- Let me know the correct directory path that should be used for persistent storage
My application stores the database at:
./src/database/database.sqlite
Thank you!
Pinned Solution
4 months ago
You can right click your project canvas, create a new volume, and mount it to your service to use persistent volume. I'd mount it to /data (it's usually what people do).
To access the volume in Node.js, you'd just create the volume under /data. (Eg, /data/database.sqlite)
1 Replies
4 months ago
You can right click your project canvas, create a new volume, and mount it to your service to use persistent volume. I'd mount it to /data (it's usually what people do).
To access the volume in Node.js, you'd just create the volume under /data. (Eg, /data/database.sqlite)
Status changed to Solved 0x5b62656e5d • 2 months ago