简体   繁体   English

在开发,登台和生产之间同步Drupal站点

[英]Syncing Drupal site between dev, staging and production

Often after a Drupal (6.x) site is launched, I have people starting to sign up and enter their own content. 通常在Drupal(6.x)网站启动后,我会让人们开始注册并输入自己的内容。 Whenever there is need for an upgrade, the database on production is copied to dev and then the development is done on dev, later get pushed to staging for client's approval. 无论何时需要升级,生产中的数据库都会复制到dev,然后开发在dev上完成,之后会被推送到staging以获得客户的批准。

When the site is eventually ready to go live, there is a problem. 当网站最终准备好上线时,就会出现问题。 Production server has the latest user inputted content, dev and staging have the latest functionality. 生产服务器具有最新的用户输入内容,开发和升级具有最新功能。 Simply overwriting the database on production won't work. 简单地覆盖生产数据库是行不通的。 What I usually do is to write down what has been done to dev and than follow the steps to go though the implementations again on production. 我通常做的是写下已经对dev做了什么,而不是按照步骤在生产中再次执行实现。 As the system grows bigger, one single mistake on production may cause lost of business. 随着系统变得越来越大,生产中的一个错误可能会导致业务损失。 I can't shutdown the site for several hours. 我无法关闭该网站几个小时。 I can't tell how many people are using the site at a given time, even so it's impossible to wait for a time where nobody is on the site to make the upgrade. 我不知道在给定时间有多少人在使用该网站,即使如此也无法等待网站上没有人进行升级的时间。

Has anyone have any good idea? 有没有人有任何好主意?

Thanks in advance. 提前致谢。

There are two concepts you need to look into: The first is " Exportables " which is generally a way of exporting all the configuration of a given module. 您需要了解两个概念:第一个是“ Exportables ”,它通常是导出给定模块的所有配置的一种方式。 The second is " Features " (terribly named, yes) which is a way of grouping a set of Exportables into a given changeset for version control, updating, deployment, rollback, etc. 第二个是“ 功能 ”(非常名称,是),这是一种将一组Exportables分组到给定的变更集中以进行版本控制,更新,部署,回滚等的方法。

For clarification, many modules implement their own "Exportables" methodology what I linked to above was the Exportables module. 为了澄清,许多模块实现了他们自己的“可导出”方法,我上面链接的是Exportables模块。 Here's a wider strategy for it - http://www.sthlmconnection.se/tips-and-tweaks/exportable-configuration-your-drupal-module-ctools 这是一个更广泛的战略 - http://www.sthlmconnection.se/tips-and-tweaks/exportable-configuration-your-drupal-module-ctools

It's the million dollar question: How to transfer code, configuration and content between different Drupal sites? 这是百万美元的问题:如何在不同的Drupal站点之间传输代码,配置和内容? In Drupal, code is stored in files (or at least it should be) while configuration and content are usually in the database. 在Drupal中,代码存储在文件中(或者至少应该存在),而配置和内容通常存储在数据库中。

Taking your code from one server to another isn't that hard, and code has another advantage: it's easy to store and manage in a version control system like SVN or GIT. 将代码从一个服务器转移到另一个服务器并不难,代码还有另一个优点:它可以在SVN或GIT等版本控制系统中轻松存储和管理。 That's why most solutions focus on taking stuff out of the database and putting it into code. 这就是为什么大多数解决方案都专注于从数据库中取出内容并将其放入代码中。

Already mentioned by CaseySoftware, the Features module is what you need to store configuration in code. CaseySoftware已经提到过, 功能模块是您在代码中存储配置所需的功能 Features has a stable release since a couple of weeks and the community seems to agree that Features is the way forward. 功能有几个星期的稳定发布,社区似乎同意功能是前进的方向。

Moving content between sites is a little harder, because content can be added or changed on dev, staging and production simultaneously. 在站点之间移动内容有点困难,因为可以同时在开发,登台和制作上添加或更改内容。 Exportables is an attempt to solve that, but it's not the only one. Exportables试图解决这个问题,但它并不是唯一的解决方案。 Make sure you also check out Deploy and the Features-based UUID Features Integration modules. 确保您还查看了Deploy和基于功能的UUID功能集成模块。 None of those modules is stable yet and time will tell which one is the best solution. 这些模块中没有一个是稳定的,时间会告诉哪一个是最好的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM