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: https://github.com/render-examples/strapi-sqlite/blob/master/render.yaml

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.

Hi,

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.