capistrano的部署问题

OVE*_*ONE 3 ruby apache gem capistrano ruby-on-rails

在这里听了一个很好的教程,它确实帮助我解决了一些问题.Rails apache和rvm都可以很好地协同工作.我差不多完成了,但最后还是陷入困境.

基本上我有类似于他的部署文件,但似乎无法调试他正在寻找的东西.deploy.rb文件如下所示:

#RVM Bootstrap
$:.unshift(File.expand_path('./lib',ENV['rvm_path']))

require 'rvm/capistrano'
set :rvm_ruby_string, '1.9.2-p318'


#bundler bootstrap
require 'bundler/capistrano'

#main details
set :application , "test"
role :web, "test"
role :app, "test"
role :db, "test", :primary => true

#server Details
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
set :deploy_to, "/var/www/test/"
set :deploy_via, :remote_cache
set :user, "passenger"
set :use_sudo, false


# repo details
set :scm, :git
set :scm_username, "passenger"
set :repository, "git@gitserver:test.git"
set :branch, "master"
set :git_enable_submodules, 1

# tasks
namespace :deploy do
  task :start, :roles => :app do
    run "touch #{current_path}/tmp/restart.txt"
  end

  task :stop, :roles => :app do
    # Do nothing.
  end
  desc "Restart Application"
  task :restart, :roles => :app do
    run "touch #{current_path}/tmp/restart.txt"
  end
end
Run Code Online (Sandbox Code Playgroud)

当我尝试使用带cap caprano的capistrano部署应用程序时:我收到以下错误:

  * executing `deploy:setup'
  * executing "mkdir -p /var/www/test/ /var/www/test/releases /var/www/test/shared /var/www/test/shared/system /var/www/test/shared/log /var/www/test/shared/pids"
    servers: ["test"]
connection failed for: test (SocketError: getaddrinfo: Name or service not known)
Run Code Online (Sandbox Code Playgroud)

我有点修补它.我们在启动rails应用程序时没有任何问题,所以它必须与我部署到apache有关.需要注意的一点是应用程序名称"app"(因为测试是在rails中保留的),域名是"test".

这种不匹配可能会导致问题,但我几乎没有经验,所以我不确定.

任何人都可以指出我在哪里调试或它可能是什么?

小智 6

角色Web,应用程序和数据库需要是您要部署到的服务器的URL或IP.像这样的东西:

task :staging do
  set :rails_env, 'staging'
  role :app, "example.com"
  role :web, "example.com"
  role :db,  "example.com", :primary => true
end
Run Code Online (Sandbox Code Playgroud)