English 中文(简体)
在Capistrano,我能否从角色象征中检索服务器?
原标题:In capistrano, can I retrieve server info from a role symbol?

我正在使用Capistrano以非标准方式部署申请,我有一大批文件,通过网关向多个服务器上载。 我不想把这一档案从部署机器上上载到名单上的每个服务器,而是将其上载到网关服务器上,然后从那里把它放在局域网上(当我用手对它进行测试时,这种速度要快得多)。

我感到麻烦的是找到一种办法,让独角兽部队这样做。 我可以这样说:

myservers = find_servers_for_task(current_task)
myservers.each do |server|
  run "scp HARDCODED_GATEWAY:/remote/file /local/file", :hosts => server.host
end

我不喜欢硬编码的网关;我转而采用上述定义,其作用是:gate。 是否有办法从:门槛值中提取东道名称? 我知道,可以确定多个服务器的作用,但我感到满意的是,只有第一个服务器在功能阵列——或最后一个服务器上拥有服务器信息;为了我的目的,该服务器中只有一个服务器,但WHICH服务器可以改变。

问题回答

我 new新,因此我可能读到这个错误,但我认为,你可以让东道国发挥<条码>的作用。 这似乎回答了你提出的问题。

你们可以通过电离晶体异构体确定特定变量。

set :gateway, "HARDCODED_GATEWAY:/remote/file"

其后使用:

myservers = find_servers_for_task(current_task)
myservers.each do |server|
  run "scp #{gateway} /local/file", :hosts => server.host
end

如果你想在日常工作中投入,则使用如下:

set(:gateway) { Capistrano::CLI.ui.ask("gateway: ") }

详情见capistrano wiki





相关问题
Is there a Perl or Lua alternative to Capistrano?

For a number of web-applications I need something like Capistrano to automate deployment. I know Capistrano can be used to deploy non-ruby applications but I m not familiar with Ruby, so I expect ...

Capistrano not restarting

Capistrano is deploying cold, deploying updates and uploading the symlink fine. It will not however restart. I notice that permission is denied on the /script/process/reaper file. I have found a ...

How to build task gems:install

I am deploying my rails app to a linux server and i have some of the rake tasks missing inlcuding rake gems:install and rake db I am running rails 2.3.4 from GEM. Why is this? How do I fix this? ...

Multiple webs on a server using capistrano

Is there any way to configure Capistrano for deploying many webs on a server? I would like to have a project on port 80 an other project on port 1000 and manage each one with different dbs.

Starting delayed_job at startup

I m using delayed_job with capistrano and would like a way to start delayed_job on startup of the web application using the script/delayed_job start . This way capistrano can restart it on deploy. ...

热门标签