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:
So when you're talking about migration in the development lifecycle of a project there are two things to take in to account:
Schema migrations are handled by strapi automatically. You can just update the schema files locally and move them to production (like Shekhar suggested).
The other thing is content migrations. Strapi suggested a long overdue migrate CLI. I couldn't wait for this any longer so I've built this feature myself through a plugin called config-sync.
This plugin can be used with Strapi v4 to export/import data through the CLI or GUI and migrate them across environments.
Hope this helps you construct a reliable development workflow in Strapi.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With