First up, try this: http://capistranorb.com/documentation/faq/why-does-something-work-in-my-ssh-session-but-not-in-capistrano/Some of the content towards the end of that page is important.
The output === Lancement de /home/rvm_admin/.bashrc === indicates that you have something loading, which shouldn't. We have always recommended against using a pty especially as we can't guarantee what happen in those scripts, and how it might break your environment in the scripting context. If you don't want to use a PTY (see below, for why you need the workaround) simply add set(:pty, false) somewhere early in your code. Along with the other set() lines is early enough. It looks like you are using a version of Capistrano which still defaulted to using a pty by default (a mistake on our side) I suggest you try upgrading, and using Capistrano from master until we throw out the new release which certainly has that corrected, although any revision after 3.0.1 (from the Git history) should be fine. I can't explain why your ssh session is timing out, but whatever your .bashrc is doing is certainly not helping. Lee Hambley -- http://lee.hambley.name/ +49 (0) 170 298 5667 On 14 January 2014 12:04, Douglas Magnenat <[email protected]>wrote: > I got an issue with task git:wrapper not working : > > *Versions:* > Ruby 2.1 > Capistrano 3.0.1 > Rake 10.1.1/ Rails 3.2.16 / etc > > *Platform:* > Working on XUbuntu 12.04.4 LTS > Deploying to Debian Wheezy > > *Logs:* > Please past logs (as completely as possible to a 3rd party pasting service > such as pastie.org) > Which log do you want ? Capistrano has no log. Ruby has no log. > > *Files:* > > Capfile > require 'capistrano/setup' > > > require 'capistrano/deploy' > > > require 'capistrano/rails' > > > Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r } > > > deploy.rb > require 'rvm/capistrano' > set :rvm_type, :system > set :application, 'odpf' > set :repo_url, '[email protected]:mycount/mygitrepo.git' > set :branch, 'production_1.01' > > namespace :deploy do > > desc 'Restart application' > task :restart do > on roles(:app), in: :sequence, wait: 5 do > # Your restart mechanism here, for example: > # Reference : > http://www.modrails.com/documentation/Users%20guide%20Apache.html#_redeploying_restarting_the_ruby_on_rails_application > execute :touch, release_path.join('tmp/restart.txt') > end > end > > after :restart, :clear_cache do > on roles(:web), in: :groups, limit: 3, wait: 10 do > # Reference : > http://guides.rubyonrails.org/v3.2.14/command_line.html#tmp > within release_path do > execute :rake, 'tmp:cache:clear' > end > end > end > after :finishing, 'deploy:cleanup' > end > > Stage files (production.rb, staging.rb) : > > production.rb > set :stage, :production > server 'myserver.net', user: 'rvm_admin', roles: %w{web app db} > > set :ssh_options, { > forward_agent: false, > port: 8888 > } > > > This my output : > douglas@bilbo:/var/www/odpf$ cap production git:check --trace > ** Invoke production (first_time) > ** Execute production > ** Invoke load:defaults (first_time) > ** Execute load:defaults > [deprecated] I18n.enforce_available_locales will default to true in the > future. If you really want to skip validation of your locale you can setI18n > .enforce_available_locales = false to avoid this message. > ** Invoke bundler:map_bins (first_time) > ** Execute bundler:map_bins > ** Invoke git:check (first_time) > ** Invoke git:wrapper (first_time) > ** Execute git:wrapper > INFO [01658950] Running /usr/bin/env mkdir -p /tmp/odpf/ on phisa-odpf-vd > .vserver.nimag.net > DEBUG [01658950] Command: /usr/bin/env mkdir -p /tmp/odpf/ > DEBUG [01658950] === Lancement de /home/rvm_admin/.bashrc === > INFO [01658950] Finished in 0.629 seconds with exit status 0 (successful > ). > cap aborted! > === Lancement de /home/rvm_admin/.bashrc === > /home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/net-scp-1.1.2/lib/net/scp. > rb:392:in `await_response_state' > /home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/net-scp-1.1.2/lib/net/scp.rb:363:in > `block (3 levels) in start_command' > /home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:311:in > `call' > /home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/net-ssh-2.7.0/lib/net/ssh/ > connection/channel.rb:311:in `process' > /home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:222:in > `block in preprocess' > /home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:222:in > `each' > /home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/net-ssh-2.7.0/lib/net/ssh/ > connection/session.rb:222:in `preprocess' > /home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:205:in > `process' > /home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in > `block in loop' > /home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/net-ssh-2.7.0/lib/net/ssh/ > connection/session.rb:169:in `loop' > /home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in > `loop' > /home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:269:in > `wait' > /home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/net-scp-1.1.2/lib/net/scp. > rb:279:in `upload!' > /home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:81:in > `upload!' > /home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/capistrano-3.0.1/lib/capistrano/tasks/git.rake:14:in > `block (3 levels) in <top (required)>' > /home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/sshkit-1.3.0/lib/sshkit/ > backends/netssh.rb:54:in `instance_exec' > /home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:54:in > `run' > /home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/sshkit-1.3.0/lib/sshkit/runners/parallel.rb:12:in > `block (2 levels) in execute' > Tasks: TOP => git:check => git:wrapper > > The last line of code that the ruby debugger gave is about > await_response_state, so I guess that net-scp doesn't get an answer and > timed out. I can't figure why though ??? > > I dug into > /home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/capistrano-3.0.1/lib/capistrano/tasks/git.rake > and found this at the stucked line 13 : > > upload! StringIO.new("#!/bin/sh -e\nexec /usr/bin/ssh -o > PasswordAuthentication=no -o StrictHostKeyChecking=no \"$@\"\n"), > "#{fetch(:tmp_dir)}/#{fetch(:application)}/git-ssh.sh" > > > I can nto figure out why this simple file creation fail. My /tmp dir got > 777 access right. > I also dug into > /home/douglas/.rvm/gems/ruby-2.1.0@rails3/gems/net-scp-1.1.2/lib/net/scp.rb > around line 392 : > # The action invoked while the state machine remains in the "await > # response" state. As long as there is no data ready to process, the > # machine will remain in this state. As soon as the server replies with > # an integer 0 as the only byte, the state machine is kicked into the > # next state (see +await_response+). If the response is not a 0, an > # exception is raised. > 389>def await_response_state(channel) > 390> return if channel[:buffer].available == 0 > 391> c = channel[:buffer].read_byte > 392> raise "#{c.chr}#{channel[:buffer].read}" if c != 0 > 393> channel[:next], channel[:state] = nil, channel[:next] > 394> send("#{channel[:state]}_state", channel) > 395>end > > > -- > 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 [email protected]. > To view this discussion on the web, visit > https://groups.google.com/d/msgid/capistrano/70ad39fc-df36-4db4-9940-99efd9f0745b%40googlegroups.com > . > For more options, visit https://groups.google.com/groups/opt_out. > -- 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 [email protected]. To view this discussion on the web, visit https://groups.google.com/d/msgid/capistrano/CAN_%2BVLW-mZg%3DU_h1AMQhnCi4pMHhxwNDSzQcoMi%3Dc7%3Dvs-AYsQ%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
