require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/bundler'
require 'capistrano/rails'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
lock '3.1.0'
set :application, 'my application'
# set :ssh_options, {
#
#}
set :repo_url, '/home/deployer/my_app.git'
set :branch, 'master'
set :deploy_to, '/home/deployer'
set :scm, :git
set :rvm_type, :system
set :pty, true
set :linked_files, %w{config/database.yml config/secrets.yml}
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
set :keep_releases, 5
# The test task
task :whoami do
on roles(:all) do
execute :whoami
end
end
server 'mydomain.com', user: 'deployer', roles: %w{web app db}
===============================================================
The problem:
I can ssh into my remote production server without any problems (using keys, not passsword), but apparently Capistrano 3 can't authenticate: When I execute the following simple test task
task :whoami do
on roles(:all) do
execute :whoami
end
end
...I get...
$ cap production whoami --trace
** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke bundler:map_bins (first_time)
** Execute bundler:map_bins
** Invoke whoami (first_time)
** Execute whoami
INFO [fa727bad] Running /usr/bin/env whoami on mydomain.com
DEBUG [fa727bad] Command: /usr/bin/env whoami
cap aborted!
Net::SSH::AuthenticationFailed: Authentication failed for user depl...@mydomain.com
/home/my_user/.rvm/gems/ruby-2.0.0-p195@rails3213/gems/net-ssh-2.8.0/lib/net/ssh.rb:217:in `start'
/home/my_user/.rvm/gems/ruby-2.0.0-p195@rails3213/gems/sshkit-1.3.0/lib/sshkit/backends/connection_pool.rb:25:in `create_or_reuse_connection'
/home/my_user/.rvm/gems/ruby-2.0.0-p195@rails3213/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:173:in `ssh'
[...]
What is wrong here?
--
You received this message because you are subscribed to the Google Groups "Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/capistrano/f0a4e2df-fa7f-4157-97b0-002cc36410f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
After spending most of the day on this, it turns out the (my?) conclusion is:
Basically, v2.8.0 of the gem "net-ssh" was borked, so you'll need 2.8.1 (which is NOT yet on rubygems.org). So:
1. Uninstall all available net-ssh gems:
gem uninstall net-ssh
(then confirm "all"...)
2. Put this in your Gemfile:
gem 'net-ssh', '~> 2.8.1', :git => "https://github.com/net-ssh/net-ssh"
3. Run:
bundle install
bundle update net-ssh
Lovells-MacBook-Pro:online_community lovell$ gem list net-ssh
*** LOCAL GEMS ***
Lovells-MacBook-Pro:online_community lovell$ irb
2.0.0-p451 :001 > require 'net/ssh'
LoadError: cannot load such file -- net/ssh
weird.
On Wednesday, April 2, 2014 2:05:46 PM UTC-4, John wrote:OK. I compiled manually since I needed this outside of my bundler folder. Steps below for anyone else that needs them.
- git clone https://github.com/net-ssh/net-ssh
- cd net-ssh
- gem install jeweler #this was a dependency needed
- gem build net-ssh.gemspec
- gem install net-ssh-2.8.1.gem
Thanks John for the workaround.
--
You received this message because you are subscribed to the Google Groups "Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/capistrano/121eba9a-b31d-4011-8ef9-970256c4ad64%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+unsubscribe@googlegroups.com.
** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke bundler:map_bins (first_time)
** Execute bundler:map_bins
** Invoke deploy:set_rails_env (first_time)
** Execute deploy:set_rails_env
** Invoke deploy:set_linked_dirs (first_time)
** Execute deploy:set_linked_dirs
** Invoke deploy:set_rails_env
** Invoke rvm:hook (first_time)
** Execute rvm:hook
cap aborted!
Net::SSH::AuthenticationFailed: Authentication failed for user dep...@myserver.com
/Users/myuser/.rvm/gems/ruby-2.3.1/gems/net-ssh-3.2.0/lib/net/ssh.rb:249:in `start'
/Users/myuser/.rvm/gems/ruby-2.3.1/gems/sshkit-1.11.2/lib/sshkit/backends/connection_pool.rb:59:in `call'
/Users/myuser/.rvm/gems/ruby-2.3.1/gems/sshkit-1.11.2/lib/sshkit/backends/connection_pool.rb:59:in `with'
/Users/myuser/.rvm/gems/ruby-2.3.1/gems/sshkit-1.11.2/lib/sshkit/backends/netssh.rb:155:in `with_ssh'
/Users/myuser/.rvm/gems/ruby-2.3.1/gems/sshkit-1.11.2/lib/sshkit/backends/netssh.rb:108:in `execute_command'
/Users/myuser/.rvm/gems/ruby-2.3.1/gems/sshkit-1.11.2/lib/sshkit/backends/abstract.rb:141:in `block in create_command_and_execute'
/Users/myuser/.rvm/gems/ruby-2.3.1/gems/sshkit-1.11.2/lib/sshkit/backends/abstract.rb:141:in `tap'
/Users/myuser/.rvm/gems/ruby-2.3.1/gems/sshkit-1.11.2/lib/sshkit/backends/abstract.rb:141:in `create_command_and_execute'
/Users/myuser/.rvm/gems/ruby-2.3.1/gems/sshkit-1.11.2/lib/sshkit/backends/abstract.rb:55:in `test'
/Users/myuser/.rvm/gems/ruby-2.3.1/gems/capistrano-rvm-0.1.2/lib/capistrano/tasks/rvm.rake:21:in `block (3 levels) in <top (required)>'
/Users/myuser/.rvm/gems/ruby-2.3.1/gems/sshkit-1.11.2/lib/sshkit/backends/abstract.rb:29:in `instance_exec'
/Users/myuser/.rvm/gems/ruby-2.3.1/gems/sshkit-1.11.2/lib/sshkit/backends/abstract.rb:29:in `run'
/Users/myuser/.rvm/gems/ruby-2.3.1/gems/sshkit-1.11.2/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => rvm:hook
I've seen other issues talk about net-ssh version 2.8.0 being broken but I'm on 3.2.0 so wondering if anyone knows what the problem could be?