Strapi content clears out for every deploy

Hello :wave:t3:
I deployed a CMS backend service on render using sqlite3 but for some reason the content data saved on Strapi backend clears out on every deployment.

Also tried the use of a persistent disk storage, and updated the ā€˜DATABASE_FILENAMEā€™ in the environment variables but itā€™s still clears out db on every deploy

Hi there!

Clearing out the content data on every deployment sounds like data is not being saved on the persistent disk.

For your specific service, please double check for the leading / in DATABASE_FILENAME environment variable value. I think your applicationā€™s database file is not the same as the persistent diskā€™s location (which has a leading /).

You might find our Strapi with Sqlite repo useful for seeing how our example is configured:

Thanks for the response @render_dev

On my service, I have a DATABASE_FILENAME with a value of /data/strapi.db and a persistent disk with a mount path. /data.

With this setup, the content still clears out on every deployment. Also with the example repo shared, I have a similar setup of strapi with my existing repo code.


I recommend looking through your applicationā€™s directories in the Shell tab to determine where your application is saving its SQLite database file. Can you confirm that the file is persisted inside the /data directory at /data/strapi.db? If not, where is the database file being saved and what is controlling the SQLite database configuration? Itā€™s possible that your application is not respecting the DATABASE_FILENAME environment variable.

Only changes to files in the persistent disk (mounted at /data) will persist across deployments.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.