Configured the db connection and deployed to the Kubernetes.
At first I used postgresql. The problem was whenever a pod restrarts, the db fields for the contents gets deleted. Which was weird.
Then I though maybe there is a problem with postgres so I tried sqlite and mounted the db file to a persistence volume. Still the same problem.
However I noticed that when I add content it add some files to src/api/<content-name>/.
And since those files are not in the persistent part, they are deleted on a restart.
At this point I am confused. Like should I mount another volume to here? Is there any step I am missing?
Hi @Furkan_Aksoy and welcome to the Strapi Community.
If you are using a docker container and SQLLite then you will loose your data.
Reason is it’s inside the container so when you destroy the container the file gets destroyed to.
When it comes to files. Unless you mounted or bind-mounted the files then it still gets removed.
Best thing to do is use your localhost to BUILD the environment then build and deploy a docker image.
If it’s for production use Postgres or Mysql etc to store data persistent. SQLite is meant to be used for local development and testing only.
Strapi removes content that for some unknown reason he does not like. It looks fantastic, if you inserted a table into the database that you need and this table is not registered in the strap, then the system deletes it.
I’m guessing this is because Strapi has a health check where it checks the tables.
Tables that are generated not by strapi should not be in the same database as strapi can’t control it.
Again make sure you are running it with postgres. or any other external database.
So check that example you might be using postgres in production but strapi is running in developer mode, which then will cause this issue.
This just happened to me. I was building a custom route endpoint + service and suddently I lost all data of 2 tables that had relationships and the draft system enabled. But the worst was that I also lost all the permissions of the authenticated role. I don’t know exactly what happened except that suddently my endpoint was giving a 403 and that’s when I found out that data was removed.
I’m running strapi in AWS via ECS (service) + ECR + RDS (postgres).
I run my container via the following commands:
export NODE_ENV="production".
strapi start
I’m doing a test where I moved the db from prod to qa and my container is ran via the above commands. What i’m noticing is that prior to the container starting, my table - spotlight_articles is present and has data. However, after the container is up and running, that table is dropped.
@Eventyret
I am running my Strapi Production on k8s cluster, it is backed with RDS PSQL.
I lost all my data (currently restoring from 1 day old backup)
My NODE_ENV is production
I only have config/database.ts
I have made changes to the database.ts with the database name to change based on the NODE_ENV. Had a discussion on discord and found this insight among others.
However I facing another issue now where I my header is not reaching the middleware only on the production server. Creating another question on the forum