enable persistent storage / persistent volume
guidonofrio-lab
HOBBYOP

a month 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:

  1. Confirm whether my service currently has persistent storage enabled

  2. Enable a persistent volume for this project (or guide me to the correct setting if I’m missing it)

  3. 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!

$10 Bounty

1 Replies

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)


Loading...