I am currently trying out node.js and have therefore been looking for a host that also offers an unpaid service for testing. I find Render.com pretty great and easy to use right away. However, I am at a loss at the moment. My problem: My node js express backend uses a sqlite. The first time I start the service, a sqlite db is created once if there is no db. Locally it runs great and the database remains even if the service is interrupted. With Render, the data I enter is deleted a short time later and the database seems to be created again. Now my question. Is this because of the free account?
Thanks for reaching out.
Render instances (as well as most cloud platforms) have an ephemeral filesystem. Meaning that any files written to the instance filesystem after it’s booted will be lost the next time it restarted/deployed.
If you need to persist files, like SQLite DBs, user uploads, generated PDFs, etc. You’ll need a persistent store. A Render disk would be best for a SQLite file, however, disks are only available on paid plans.
Thank you for your answer. Ok. That make sense. It is possible to have my sqlite file inner the app which i a mirrow of my git repository. Or i have to put this file outside these app folder? I hope you understand me. Never work with disk. It is an example for that maybe?
A SQLite file in your repo would reset to the committed version on restart.
When creating a Render Disk you specify a “Mount Path” which suggests
/var/data as a default, but you can set it as you want. The Render Disk documentation has more details. You would save your SQLite file to the “Mount Path”.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.