I'm wondering what the best practice is for running Strapi in production. I noticed that Strapi generates new files when a content type is added. This means that the production environment's files will become out of sync with version control. Is there a recommended deployment process? Am I supposed to commit changes from production to my git repo after making changes in the admin?
There are no known nor recommended workarounds for this. Strapi deployments are closely coupled with source control and we strongly recommend that you do development locally, push that code into staging with atomic test data, then if everything looks good you deploy that code in production. Thank you. Thats great information for a noob
At this time and in the future there is no plan to allow model creating or updating while in a production environment, and there is currently no plans to move model settings into the database. There are no known nor recommended workarounds for this. Does Strapi handle deploying or migrating of content?
I noticed that Strapi generates new files when a content type is added. This means that the production environment's files will become out of sync with version control. Is there a recommended deployment process?
Generally your “flow” of development would follow the following path: Development - Develop your Strapi application locally on your host machine, then push changes into source control Staging - Deploy changes from source control to a “production-like” environment for testing Production - If no other changes are needed, deploy into production
The file generation which is made primarily by content-type-builder
and other settings are disabled in production mode NODE_ENV=production
The admin panel is supposed to be already built on prod, so you only add necessary data into DB based on the given data structure.
TLTR:
Summarizing answer to your question in from github.com/strapi/strapi/issues/1986:
emadicio commented on 20 Sep 2018
If you run your app with NODE_ENV=production you'll notice that plugins that actually edit or create files are disabled. So that means you cannot create or edit content types in prod
Downloaddave commented on 22 Sep 2018:
I had deployed Strapi locally then to a Prod environment, and was confused since I didn't see the content-type-builder in the production CMS.
I'm trying to understand the deployment and update process as well...
I understand that making changes to the content-type-builder reboots the service, and we don't want production to go down during the rebuild, but it seems like data would get really out of sync between production and development.
Aurelsicoko commented on 2 Oct 2018
You're right! The Content-Type Builder is a development plugin. His goal is to speed up the development of your project. It should not be used in production. We didn't design this plugin like for this usage.
The real pain is to migrate the development configuration to production, and vice-versa. We plan to offer a new command with the CLI called strapi migrate
to easily migrate from an environment to another. I can't give you a release date though...
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