Search code examples
deploymentdevelopment-environmentproduction-environmentstrapi

Developing Strapi locally and deploy on production server


I am using Strapi as a headless cms for my website. First I have started one version only on the production environment and there was no other environment like development or staging. So when I wanted to change the models (collections and single types or etc.) I had to switch the server to run in development mode to be able to do changes. So while doing these kinds of changes, the production environment also ran out of service. After a few days, the app crashed while trying to update the database and it never started again.
So now I highly need to separate the development environment from production. But I have some questions about how to do this, and can't find solutions:

  1. If I develop the app locally or in a separate development environment, how should I transfer the new models to the server?
  2. Does production environment data survive from migration process?
  3. Should I create a backup from production environment data every time I do the deployment (migration) process?

Solution

  • After a long time to read the docs and follow previously asked questions, I have found that this question was already asked before here: Running Strapi in production and version control sync issues and had no accepting answer and also discussed on https://github.com/strapi/strapi/issues/1986 and finally every one waiting for strapi migrate feature which is not even planned for future. There was another way which was a little hopeful to dump and restore configuration on dev and prod environments in https://strapi.io/documentation/developer-docs/latest/developer-resources/cli/CLI.html#strapi-configuration-dump although I haven't tested it. I continued reading about headless CMSs and found that solutions like Keystonejs and Payloadjs which let the developer define models in the code is more stable, maintainable and extendable so I have switched into Keystonejs right now.