在生产和版本控制同步问题中运行 Strapi [英] Running Strapi in production and version control sync issues

查看:44
本文介绍了在生产和版本控制同步问题中运行 Strapi的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道在生产中运行 Strapi 的最佳实践是什么.我注意到当添加内容类型时 Strapi 会生成新文件.这意味着生产环境的文件将与版本控制不同步.有推荐的部署流程吗?在管理员中进行更改后,我是否应该将生产中的更改提交到我的 git 存储库?

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?

推荐答案

主要由 content-type-builder 生成的文件生成和其他设置在生产模式下被禁用 NODE_ENV=生产

The file generation which is made primarily by content-type-builder and other settings are disabled in production mode NODE_ENV=production

管理面板应该已经建立在 prod 上,因此您只需根据给定的数据结构将必要的数据添加到数据库中.

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:

从 github.com/strapi/strapi/issues/1986 总结您的问题的答案:

Summarizing answer to your question in from github.com/strapi/strapi/issues/1986:

emadicio 评论于 2018 年 9 月 20 日

如果您使用 NODE_ENV=production 运行您的应用,您会注意到实际编辑或创建文件的插件被禁用.所以这意味着你不能在 prod 中创建或编辑内容类型

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

Downloaddave2018 年 9 月 22 日评论:

我在本地将 Strapi 部署到 Prod 环境中,但很困惑,因为我没有在生产 CMS 中看到 content-type-builder.

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...

  • 开发者在本地设置 Strapi
  • 使用内容类型构建器创建内容类型
  • Strapi 在本地和本地 MongoDB 上更新文件结构
  • 在生产中,我们必须同时推送代码和数据库更新吗?

我知道对 content-type-builder 进行更改会重新启动服务,我们不希望在重建期间生产中断,但似乎数据在生产和生产之间真的不同步发展.

Aurelsicoko 评论于 2 Oct 2018

你说得对!Content-Type Builder 是一个开发插件.他的目标是加快您项目的开发.它不应该用于生产.我们没有为这种用途设计这个插件.

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.

真正的痛苦是将开发配置迁移到生产,反之亦然.我们计划在 CLI 中提供一个名为 strapi migrate 的新命令,以便轻松地从一个环境迁移到另一个环境.不过我不能给你发布日期...

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...

这篇关于在生产和版本控制同步问题中运行 Strapi的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆