capistrano解决了错误的服务器

时间:2014-06-19 13:50:36

标签: ruby-on-rails ruby capistrano

这是我的剧本

require "bundler/capistrano"  
set :bundle_without, [:development, :test, :deployment]  
require "delayed/recipes" unless exists?(:ip)  
set :stages, %w(production staging dev)  
set :default_stage, "staging"  
require "capistrano/ext/multistage"  
set :rvm_type, :user  
require "rvm/capistrano"  

load "config/recipes/nginx"  
load "config/recipes/passenger"  
load "config/recipes/deploy"  
load "config/recipes/symlink"  

set :application, "dev"  
set :keep_releases, 5  
set :deploy_server,  'IP'    
  role :web,            deploy_server  
  role :app,            deploy_server  
  role :db,             deploy_server, :primary => true  
set :port, 222  
set :user, "user"  
set :use_sudo, false  


set :scm, :git  
set :repository, "git@github.com:a/b.git"  
set :branch, "master" unless exists?(:branch)  
set :deploy_via, :remote_cache  
set :copy_exclude, [ '.git' ]  
set :deploy_to, "/var/www/#{application}"  
set :rails_env, "production" unless exists?(:rails_env)  

set :normalize_asset_timestamps, false  

ssh_options[:forward_agent] = true  
on :start do  
  `ssh-add`  
end  

和控制台的输出是:

% cap deploy  
    triggering load callbacks  
  * 2014-06-19 17:40:13 executing `staging'  
    triggering start callbacks for `deploy'  
  * 2014-06-19 17:40:13 executing `multistage:ensure'  
Enter passphrase for /Users/password123/.ssh/id_rsa:  
Identity added: /Users/password123/.ssh/id_rsa (/Users/password123/.ssh/id_rsa)  
  * 2014-06-19 17:40:16 executing `deploy'  
    triggering before callbacks for `deploy'  
  * 2014-06-19 17:40:16 executing `deploy:setup'  
  * executing "mkdir -p /var/www/core.dev /var/www/core.dev/releases /var/www/core.dev/shared /var/www/core.dev/shared/system /var/www/core.dev/shared/log /var/www/core.dev/shared/pids"  
    servers: ["IP", "193.84.22.52"]
Password:  
connection failed for: 193.84.22.52 (Errno::ETIMEDOUT: Operation timed out - connect(2))  

我找不到它的位置。

并且不知道它出现在哪里。此脚本中加载的文件包含inserver操作。你能帮我解决这个问题吗?

1 个答案:

答案 0 :(得分:1)

您的默认阶段设置为staging,请查看config/deploy/staging.rb