I am working on my first Drupal project on XAMPP in my MacBook. It's a prototype and receives positive feedback from my client.
我正在我的MacBook上研究我在XAMPP上的第一个Drupal项目。这是一个原型,并从我的客户收到积极的反馈。
I am going to deploy the project on a Linux VPS two weeks later. Is there a better way than 're-do'ing everything on the server from scratch?
我将在两周后在Linux VPS上部署该项目。有没有比从头开始重新处理服务器上的所有内容更好的方法?
- install Drupal
- download modules (CCK, Views, Date, Calendar)
- create the Contents
- ...
下载模块(CCK,视图,日期,日历)
创建内容
Thanks
9 个解决方案
#1
A couple of tips:
一些提示:
-
Use source control, NOT FTP/etc., for the files. It doesn't matter what you use; we tend to spin up an Unfuddle.com subversion account for each client so they have a place to log bugs as well, but the critical first step is getting the full source tree of your site into version control. When changes are made on the testing server or staging server, you see if they work, you commit, then you update on the live server. Rollbacks and deployment gets a lot, lot simpler. For clusters of multiple webheads you can repeat the process, or rsync from a single 'canonical' server.
对文件使用源代码管理,而不是FTP /等。你使用什么并不重要;我们倾向于为每个客户端启动一个Unfuddle.com subversion帐户,以便他们也可以记录错误,但关键的第一步是将站点的完整源代码树转换为版本控制。在测试服务器或登台服务器上进行更改时,您会看到它们是否正常工作,您是否提交,然后在实时服务器上进行更新。回滚和部署得到了很多,更简单。对于多个Webhead的集群,您可以从单个“规范”服务器重复该过程或rsync。
-
If you use SVN, though, you can also use CVS checkouts of Drupal and other modules/themes and the SVN/CVS metadata will be able to live beside each other happily.
但是,如果您使用SVN,您还可以使用Drupal和其他模块/主题的CVS签出,并且SVN / CVS元数据将能够愉快地彼此相邻。
-
For bulky folders like the files directory, use a symlink in the 'proper' location to point to a server-side directory outside of the webroot. That lets your source control repo include all the code and a symlink, instead of all the code and all the files users have uploaded.
对于像文件目录这样的大文件夹,请使用“正确”位置的符号链接指向webroot之外的服务器端目录。这使得源代码控制repo包含所有代码和符号链接,而不是所有代码和用户上传的所有文件。
-
Databases are trickier; cleaning up the dev/staging DB and pushing it to live is easiest for the initial rollout but there are a few wrinkles when doing incremental DB updates if users on the live site are also generating content.
数据库比较棘手;清理开发/暂存数据库并将其推送到最初是最容易的,但如果实时站点上的用户也在生成内容,那么在进行增量数据库更新时会有一些问题。
I did a presentation on Drupal deployment best practices last year. Feel free to check the slides out.
去年我做了关于Drupal部署最佳实践的演讲。随意检查幻灯片。
#2
Features.module is an extremely powerful tool for managing Drupal configuration changes.
Features.module是一个非常强大的工具,用于管理Drupal配置更改。
Content Types, CCK settings, Views, Drupal Variables, Contexts, Imagecache presets, Menus, Taxonomies, and Permissions can all be rolled into a feature, which can be checked into version control. From there, deploying a new site, or pushing changes to an existing one, is easily managed with the Features UI or Drush.
内容类型,CCK设置,视图,Drupal变量,上下文,图像缓存预设,菜单,分类和权限都可以转换为功能,可以将其检入版本控制。从那里,使用功能UI或Drush可以轻松管理部署新站点或将更改推送到现有站点。
Make sure you install Strongarm.module for exporting drupal config that gets stored in your Variables table. You can also static content/nodes (ie: about us, faqs, etc) into Features by installing uuid_features.module.
确保安装Strongarm.module以导出存储在Variables表中的drupal配置。您还可以通过安装uuid_features.module将静态内容/节点(即:about us,faqs等)添加到Features中。
Hands down, this is the best way to work with other developers on the same site, and to move your site from Development to Testing to Staging and Production.
请放手,这是与同一站点上的其他开发人员合作的最佳方式,并将您的站点从开发转移到测试再到分段和生产。
#3
We've had an extensive discussion on this at my workplace, and the way we finally settled on was pushing code updates (including modules and themes) from development to staging to production. We're using Subversion for this, and it's working well so far.
我们在我的工作场所对此进行了广泛的讨论,我们最终确定的方式是将代码更新(包括模块和主题)从开发推广到生产。我们正在使用Subversion,到目前为止它运行良好。
What's particularly important is that you automate a process for pushing the database back from production, so that your developers can keep their copies of the database as close to production as possible. In a mission-critical environment, you want to be absolutely certain a module update isn't going to hose your database. The process we use is as follows:
特别重要的是,您可以自动化将数据库从生产中推回的过程,以便您的开发人员可以尽可能地保持数据库副本尽可能接近生产。在任务关键型环境中,您希望绝对确定模块更新不会影响您的数据库。我们使用的过程如下:
- Install a module on the development server.
- Take note of whatever changes and updates were necessary. If there are any hitches, revert and do again until you have a solid, error-free process.
- Test your changes! Repeat your testing process as a normal, logged-in user, and again as an anonymous user.
- If the update process involved anything other than running update.php, then write a script to do it.
- Copy the production database to your staging server, and perform the same steps immediately. If it fails, diagnose the failure and return to step 1. Otherwise, continue.
- Test your changes!
- BACK UP YOUR PRODUCTION DATABASE and TAKE NOTE OF THE REVISION YOU HAVE CHECKED OUT FROM SVN.
- Put your production Drupal in maintenance mode, run "svn update" on your production tree, and go through your update process.
- Take Drupal out of maintenance mode and test everything (as admin, regular user, and anonymous)
在开发服务器上安装模块。
记下必要的更改和更新。如果有任何故障,请恢复并再次执行,直到您有一个稳固,无错误的过程。
测试你的变化!以普通登录用户身份重复测试过程,并再次以匿名用户身份重复测试过程。
如果更新过程涉及除运行update.php以外的任何内容,则编写脚本来执行此操作。
将生产数据库复制到临时服务器,并立即执行相同的步骤。如果失败,请诊断故障并返回步骤1.否则,继续。
测试你的变化!
备份您的生产数据库并记录您已从SVN检查的修订。
将生产Drupal置于维护模式,在生产树上运行“svn update”,然后完成更新过程。
将Drupal退出维护模式并测试所有内容(作为管理员,普通用户和匿名用户)
And that's it. One thing you can never really expect for a community framework such as Drupal is to be able to move your database from testing to production after you go live. From then on, all database moves are from production to testing, which complicates the deployment process somewhat. Be careful! :)
就是这样。对于像Drupal这样的社区框架,你永远不能期望的一件事就是能够在你上线后将你的数据库从测试转移到生产。从那时起,所有数据库移动都是从生产到测试,这使得部署过程有些复杂化。小心! :)
#4
We use the Features module extensively to capture features and then install them easily at the production site.
我们广泛使用Features模块来捕获功能,然后在生产站点轻松安装它们。
#5
I'm surprised that no one mentioned the Deployment module. Here is an excerpt from its project page:
我很惊讶没有人提到部署模块。以下是其项目页面的摘录:
... designed to allow users to easily stage content from one Drupal site to another. Deploy automatically manages dependencies between entities (like node references). It is designed to have a rich API which can be easily extended to be used in a variety of content staging situations.
...旨在让用户轻松地将内容从一个Drupal站点转移到另一个站点。 Deploy自动管理实体之间的依赖关系(如节点引用)。它设计为具有丰富的API,可以轻松扩展以用于各种内容登台情况。
#6
I don't work with Drupal, but I do work with Joomla a lot. I deploy by archiving all the files in the web root (tar and gzip in my case, but you could use zip) and then uploading and expanding that archive on the production server. I then take a SQL dump (mysqldump -u user -h host -p databasename > dump.sql), upload that, and use the reverse command to insert the data (mysql -u produser -h prodDBserver -p prodDatabase < dump.sql). If you don't have shell access you can upload the files one at a time and write a PHP script to import dump.sql.
我不和Drupal合作,但我和Joomla合作很多。我通过归档web根目录中的所有文件进行部署(在我的情况下是tar和gzip,但你可以使用zip),然后在生产服务器上上传和扩展该归档。然后我进行SQL转储(mysqldump -u user -h host -p databasename> dump.sql),上传,然后使用reverse命令插入数据(mysql -u produser -h prodDBserver -p prodDatabase
#7
Any version control system (GIT, SVN) + Features module to deploy Drupal code + custom settings (content types, custom fields, module dependencies, views etc.).
任何版本控制系统(GIT,SVN)+ Features模块,用于部署Drupal代码+自定义设置(内容类型,自定义字段,模块依赖关系,视图等)。
As Deploy module is still in development mode, so you may like to use Node export module in Drupal 7 to deploy your content / nodes.
由于Deploy模块仍处于开发模式,因此您可能希望使用Drupal 7中的节点导出模块来部署您的内容/节点。
#8
If you're new to deployment (and or Drupal) then be sure to do everything in one lump. You have to be quite careful once there are users effecting content while you are working on another copy.
如果您是部署(和/或Drupal)的新手,那么一定要一劳永逸。一旦有用户在处理另一个副本时影响内容,您必须非常小心。
It is possible to leave the tables that relate to actual content, taxonomy, users, etc. rather than their structure. Then push the ones relating to configuration. However, this add an order of magnitude of complexity.
可以保留与实际内容,分类,用户等相关的表而不是其结构。然后推送与配置相关的那些。然而,这增加了一个数量级的复杂性。
Apologies if deployment is something old hat to you, thus this is vaguely insulting.
道歉,如果部署对你来说是件老事,那么这就是模糊的侮辱。
#9
A good strategy that I have found and am currently implementing is to use a combination of the deploy module to migrate my content, and then drush along with dbscripts to merge and update the core and modules. It takes care of database merging even if you have live content, security and module updates, and I currently have mine set up to work with svn.
我发现并且正在实施的一个好策略是使用部署模块的组合来迁移我的内容,然后与dbscripts一起钻取以合并和更新核心和模块。即使您有实时内容,安全性和模块更新,它也会处理数据库合并,并且我目前已经设置了与svn一起使用的设置。
#1
A couple of tips:
一些提示:
-
Use source control, NOT FTP/etc., for the files. It doesn't matter what you use; we tend to spin up an Unfuddle.com subversion account for each client so they have a place to log bugs as well, but the critical first step is getting the full source tree of your site into version control. When changes are made on the testing server or staging server, you see if they work, you commit, then you update on the live server. Rollbacks and deployment gets a lot, lot simpler. For clusters of multiple webheads you can repeat the process, or rsync from a single 'canonical' server.
对文件使用源代码管理,而不是FTP /等。你使用什么并不重要;我们倾向于为每个客户端启动一个Unfuddle.com subversion帐户,以便他们也可以记录错误,但关键的第一步是将站点的完整源代码树转换为版本控制。在测试服务器或登台服务器上进行更改时,您会看到它们是否正常工作,您是否提交,然后在实时服务器上进行更新。回滚和部署得到了很多,更简单。对于多个Webhead的集群,您可以从单个“规范”服务器重复该过程或rsync。
-
If you use SVN, though, you can also use CVS checkouts of Drupal and other modules/themes and the SVN/CVS metadata will be able to live beside each other happily.
但是,如果您使用SVN,您还可以使用Drupal和其他模块/主题的CVS签出,并且SVN / CVS元数据将能够愉快地彼此相邻。
-
For bulky folders like the files directory, use a symlink in the 'proper' location to point to a server-side directory outside of the webroot. That lets your source control repo include all the code and a symlink, instead of all the code and all the files users have uploaded.
对于像文件目录这样的大文件夹,请使用“正确”位置的符号链接指向webroot之外的服务器端目录。这使得源代码控制repo包含所有代码和符号链接,而不是所有代码和用户上传的所有文件。
-
Databases are trickier; cleaning up the dev/staging DB and pushing it to live is easiest for the initial rollout but there are a few wrinkles when doing incremental DB updates if users on the live site are also generating content.
数据库比较棘手;清理开发/暂存数据库并将其推送到最初是最容易的,但如果实时站点上的用户也在生成内容,那么在进行增量数据库更新时会有一些问题。
I did a presentation on Drupal deployment best practices last year. Feel free to check the slides out.
去年我做了关于Drupal部署最佳实践的演讲。随意检查幻灯片。
#2
Features.module is an extremely powerful tool for managing Drupal configuration changes.
Features.module是一个非常强大的工具,用于管理Drupal配置更改。
Content Types, CCK settings, Views, Drupal Variables, Contexts, Imagecache presets, Menus, Taxonomies, and Permissions can all be rolled into a feature, which can be checked into version control. From there, deploying a new site, or pushing changes to an existing one, is easily managed with the Features UI or Drush.
内容类型,CCK设置,视图,Drupal变量,上下文,图像缓存预设,菜单,分类和权限都可以转换为功能,可以将其检入版本控制。从那里,使用功能UI或Drush可以轻松管理部署新站点或将更改推送到现有站点。
Make sure you install Strongarm.module for exporting drupal config that gets stored in your Variables table. You can also static content/nodes (ie: about us, faqs, etc) into Features by installing uuid_features.module.
确保安装Strongarm.module以导出存储在Variables表中的drupal配置。您还可以通过安装uuid_features.module将静态内容/节点(即:about us,faqs等)添加到Features中。
Hands down, this is the best way to work with other developers on the same site, and to move your site from Development to Testing to Staging and Production.
请放手,这是与同一站点上的其他开发人员合作的最佳方式,并将您的站点从开发转移到测试再到分段和生产。
#3
We've had an extensive discussion on this at my workplace, and the way we finally settled on was pushing code updates (including modules and themes) from development to staging to production. We're using Subversion for this, and it's working well so far.
我们在我的工作场所对此进行了广泛的讨论,我们最终确定的方式是将代码更新(包括模块和主题)从开发推广到生产。我们正在使用Subversion,到目前为止它运行良好。
What's particularly important is that you automate a process for pushing the database back from production, so that your developers can keep their copies of the database as close to production as possible. In a mission-critical environment, you want to be absolutely certain a module update isn't going to hose your database. The process we use is as follows:
特别重要的是,您可以自动化将数据库从生产中推回的过程,以便您的开发人员可以尽可能地保持数据库副本尽可能接近生产。在任务关键型环境中,您希望绝对确定模块更新不会影响您的数据库。我们使用的过程如下:
- Install a module on the development server.
- Take note of whatever changes and updates were necessary. If there are any hitches, revert and do again until you have a solid, error-free process.
- Test your changes! Repeat your testing process as a normal, logged-in user, and again as an anonymous user.
- If the update process involved anything other than running update.php, then write a script to do it.
- Copy the production database to your staging server, and perform the same steps immediately. If it fails, diagnose the failure and return to step 1. Otherwise, continue.
- Test your changes!
- BACK UP YOUR PRODUCTION DATABASE and TAKE NOTE OF THE REVISION YOU HAVE CHECKED OUT FROM SVN.
- Put your production Drupal in maintenance mode, run "svn update" on your production tree, and go through your update process.
- Take Drupal out of maintenance mode and test everything (as admin, regular user, and anonymous)
在开发服务器上安装模块。
记下必要的更改和更新。如果有任何故障,请恢复并再次执行,直到您有一个稳固,无错误的过程。
测试你的变化!以普通登录用户身份重复测试过程,并再次以匿名用户身份重复测试过程。
如果更新过程涉及除运行update.php以外的任何内容,则编写脚本来执行此操作。
将生产数据库复制到临时服务器,并立即执行相同的步骤。如果失败,请诊断故障并返回步骤1.否则,继续。
测试你的变化!
备份您的生产数据库并记录您已从SVN检查的修订。
将生产Drupal置于维护模式,在生产树上运行“svn update”,然后完成更新过程。
将Drupal退出维护模式并测试所有内容(作为管理员,普通用户和匿名用户)
And that's it. One thing you can never really expect for a community framework such as Drupal is to be able to move your database from testing to production after you go live. From then on, all database moves are from production to testing, which complicates the deployment process somewhat. Be careful! :)
就是这样。对于像Drupal这样的社区框架,你永远不能期望的一件事就是能够在你上线后将你的数据库从测试转移到生产。从那时起,所有数据库移动都是从生产到测试,这使得部署过程有些复杂化。小心! :)
#4
We use the Features module extensively to capture features and then install them easily at the production site.
我们广泛使用Features模块来捕获功能,然后在生产站点轻松安装它们。
#5
I'm surprised that no one mentioned the Deployment module. Here is an excerpt from its project page:
我很惊讶没有人提到部署模块。以下是其项目页面的摘录:
... designed to allow users to easily stage content from one Drupal site to another. Deploy automatically manages dependencies between entities (like node references). It is designed to have a rich API which can be easily extended to be used in a variety of content staging situations.
...旨在让用户轻松地将内容从一个Drupal站点转移到另一个站点。 Deploy自动管理实体之间的依赖关系(如节点引用)。它设计为具有丰富的API,可以轻松扩展以用于各种内容登台情况。
#6
I don't work with Drupal, but I do work with Joomla a lot. I deploy by archiving all the files in the web root (tar and gzip in my case, but you could use zip) and then uploading and expanding that archive on the production server. I then take a SQL dump (mysqldump -u user -h host -p databasename > dump.sql), upload that, and use the reverse command to insert the data (mysql -u produser -h prodDBserver -p prodDatabase < dump.sql). If you don't have shell access you can upload the files one at a time and write a PHP script to import dump.sql.
我不和Drupal合作,但我和Joomla合作很多。我通过归档web根目录中的所有文件进行部署(在我的情况下是tar和gzip,但你可以使用zip),然后在生产服务器上上传和扩展该归档。然后我进行SQL转储(mysqldump -u user -h host -p databasename> dump.sql),上传,然后使用reverse命令插入数据(mysql -u produser -h prodDBserver -p prodDatabase
#7
Any version control system (GIT, SVN) + Features module to deploy Drupal code + custom settings (content types, custom fields, module dependencies, views etc.).
任何版本控制系统(GIT,SVN)+ Features模块,用于部署Drupal代码+自定义设置(内容类型,自定义字段,模块依赖关系,视图等)。
As Deploy module is still in development mode, so you may like to use Node export module in Drupal 7 to deploy your content / nodes.
由于Deploy模块仍处于开发模式,因此您可能希望使用Drupal 7中的节点导出模块来部署您的内容/节点。
#8
If you're new to deployment (and or Drupal) then be sure to do everything in one lump. You have to be quite careful once there are users effecting content while you are working on another copy.
如果您是部署(和/或Drupal)的新手,那么一定要一劳永逸。一旦有用户在处理另一个副本时影响内容,您必须非常小心。
It is possible to leave the tables that relate to actual content, taxonomy, users, etc. rather than their structure. Then push the ones relating to configuration. However, this add an order of magnitude of complexity.
可以保留与实际内容,分类,用户等相关的表而不是其结构。然后推送与配置相关的那些。然而,这增加了一个数量级的复杂性。
Apologies if deployment is something old hat to you, thus this is vaguely insulting.
道歉,如果部署对你来说是件老事,那么这就是模糊的侮辱。
#9
A good strategy that I have found and am currently implementing is to use a combination of the deploy module to migrate my content, and then drush along with dbscripts to merge and update the core and modules. It takes care of database merging even if you have live content, security and module updates, and I currently have mine set up to work with svn.
我发现并且正在实施的一个好策略是使用部署模块的组合来迁移我的内容,然后与dbscripts一起钻取以合并和更新核心和模块。即使您有实时内容,安全性和模块更新,它也会处理数据库合并,并且我目前已经设置了与svn一起使用的设置。