首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Webistrano部署到多个主机

使用Webistrano部署到多个主机
EN

Drupal用户
提问于 2012-03-19 22:33:17
回答 1查看 876关注 0票数 0

我们使用Webistrano将Drupal站点部署到测试和生产中。

我们正在使用的配方如下:

代码语言:javascript
复制
namespace :drupal do
  desc "symlink_files"
  task :symlink_files do
    invoke_command "ln -s #{deploy_to}/shared/files #{deploy_to}/current/drupal/sites/default/"
    invoke_command "ln -s #{deploy_to}/shared/settings.php #{deploy_to}/current/drupal/sites/default/"
  end

  desc "refresh_configuration"
  task :refresh_configuration do
    invoke_command "cd #{deploy_to}/current/drupal; drush #{drush_options} -y fr-all"
    invoke_command "cd #{deploy_to}/current/drupal; drush #{drush_options} -y updb"
    invoke_command "cd #{deploy_to}/current/drupal; drush #{drush_options} cc all"
  end
end

after 'deploy:symlink','drupal:symlink_files','drupal:refresh_configuration'

这种方法对于单主机部署非常有效,但对于多主机部署却失败了。原因是refresh_configuration任务将在每个主机上运行,导致各种争用条件和中央数据库服务器上的损坏。

我的问题是,有人能建议一种方法来修复Webistrano设置,只在一台服务器上运行refresh_configuration任务吗?

PS。我不想将部署系统更改为Aegir或其他任何东西。

EN

回答 1

Drupal用户

回答已采纳

发布于 2012-03-25 23:49:51

根据这个卡皮斯特拉诺Wiki页面,可以将任务和单个命令限制为特定的:roles:only属性:

代码语言:javascript
复制
task :migrate, :roles => :db, :only => { :master => true } do
  # ...
end

task :other do
  run "migrate", :roles => :db, :only => { :master => true }
end

使用它,我能够在具有特定属性的服务器上运行refresh_configuration任务。

票数 0
EN
页面原文内容由Drupal提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://drupal.stackexchange.com/questions/25959

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档