Ruby on rails 4 带有rails 4的capistrano 3无法部署应用程序
我正在使用rails 4.0.2、ruby 2.0.0p247和capistrano 3.1.0将rails应用程序部署到VPS服务器 deploy.rb文件是这样的Ruby on rails 4 带有rails 4的capistrano 3无法部署应用程序,ruby-on-rails-4,ruby-2.0,capistrano3,Ruby On Rails 4,Ruby 2.0,Capistrano3,我正在使用rails 4.0.2、ruby 2.0.0p247和capistrano 3.1.0将rails应用程序部署到VPS服务器 deploy.rb文件是这样的 set :application, "rails4test" set :repository, "git@github.com:projectname.git" set :keep_releases, 2 set :scm, :git set :stages, %w(production staging) set :defau
set :application, "rails4test"
set :repository, "git@github.com:projectname.git"
set :keep_releases, 2
set :scm, :git
set :stages, %w(production staging)
set :default_stage, "staging"
set :deploy_to, "/var/www/website.com/public_html"
set :user, "username"
set :use_sudo, false
set :copy_exclude, ['.git']
task :deploy_production do
set :branch, "master"
set :rails_env, 'production'
set :host, "serverip"
role :web, "#{host}"
role :app, "#{host}"
role :db, "#{host}", :primary => true
set :stage, "production"
system("bundle exec cap production deploy")
end
set :ssh_options, {
verbose: :debug,
user: fetch(:user)
}
set :branch, "master"
set :rails_env, 'production'
set :host, "server ip"
role :web, "server ip"
role :app, "server ip"
role :db, "server ip", :primary => true
server "server ip", roles: %w{web app db}, ssh_options: {
user: "username",
forward_agent: true,
}
production.rb文件是这样的
set :application, "rails4test"
set :repository, "git@github.com:projectname.git"
set :keep_releases, 2
set :scm, :git
set :stages, %w(production staging)
set :default_stage, "staging"
set :deploy_to, "/var/www/website.com/public_html"
set :user, "username"
set :use_sudo, false
set :copy_exclude, ['.git']
task :deploy_production do
set :branch, "master"
set :rails_env, 'production'
set :host, "serverip"
role :web, "#{host}"
role :app, "#{host}"
role :db, "#{host}", :primary => true
set :stage, "production"
system("bundle exec cap production deploy")
end
set :ssh_options, {
verbose: :debug,
user: fetch(:user)
}
set :branch, "master"
set :rails_env, 'production'
set :host, "server ip"
role :web, "server ip"
role :app, "server ip"
role :db, "server ip", :primary => true
server "server ip", roles: %w{web app db}, ssh_options: {
user: "username",
forward_agent: true,
}
当我运行命令cap production deploy时。下面是我面临的错误
INFO [eccddf96] Running /usr/bin/env mkdir -p /tmp/rails4test/ on someip
DEBUG [eccddf96] Command: /usr/bin/env mkdir -p /tmp/rails4test/
cap aborted!
Authentication failed for user username@23.227.162.62
/home/rails/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.8.0/lib/net/ssh.rb:217:in `start'
/home/rails/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.3.0/lib/sshkit/backends /connection_pool.rb:25:in `create_or_reuse_connection'
/home/rails/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.3.0/lib/sshkit/backends /netssh.rb:173:in `ssh'
/home/rails/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.3.0/lib/sshkit/backends /netssh.rb:126:in `block in _execute'
/home/rails/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:123:in `tap'
/home/rails/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:123:in `_execute'
/home/rails/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:66:in `execute'
/home/rails/.rvm/gems/ruby-2.0.0-p247/gems/capistrano-3.1.0/lib/capistrano/tasks/git.rake:17:in `block (3 levels) in <top (required)>'
/home/rails/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/home/rails/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:54:in `run'
/home/rails/.rvm/gems/ruby-2.0.0-p247/gems/sshkit-1.3.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => git:check => git:wrapper
(See full trace by running task with --trace)
The deploy has failed with an error: #<Net::SSH::AuthenticationFailed: Authentication failed for user username@someip>
在放置这些gems之后,出现了以下错误:我刚刚安装了gems
INFO [4f498013] Running /usr/bin/env mkdir -p /tmp/rails4test/ on some ip
cap aborted!
Connection refused - connect(2)
/home/rails/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh- 2.8.0/lib/net/ssh/transport/session.rb:70:in `initialize'
/home/rails/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.8.0/lib/net/ssh/transport/session.rb:70:in `open'
/home/rails/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh- 2.8.0/lib/net/ssh/transport/session.rb:70:in `block in initialize'
(See full trace by running task with --trace)
The deploy has failed with an error: #<Errno::ECONNREFUSED: Connection refused - connect(2)>
INFO[4f498013]在某些ip上运行/usr/bin/env mkdir-p/tmp/rails4test/
帽子流产了!
连接被拒绝-连接(2)
/home/rails/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.8.0/lib/net/ssh/transport/session.rb:70:在“初始化”中
/home/rails/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.8.0/lib/net/ssh/transport/session.rb:70:在“打开”中
/home/rails/.rvm/gems/ruby-2.0.0-p247/gems/net-ssh-2.8.0/lib/net/ssh/transport/session.rb:70:在“初始化中的块”中
(通过使用--trace运行任务查看完整跟踪)
部署失败,出现错误:#
你在用哪个ssh
gem?@KirtiThorat:gem“sshkit”,“~>1.3.0”