Problem to deploy with Capistrano

Hi, friends!

I’m using Rails 3.2.3, RVM, Postgresql 9.1.3 and running Ubuntu Server 11.10 on my own Dell server. I tried this:

cap deploy:check

  • executing `deploy:check’
  • executing “test -d /home/digifoto.com/apps/digifoto/releases” servers: [“188.xx.xx.xx”] [188.xx.xx.xx] executing command [188.xx.xx.xx] rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell ‘1.9.3’ -c ‘test -d /home/digifoto.com/apps/digifoto/releases’ command finished in 389ms
  • executing “test -w /home/digifoto.com/apps/digifoto” servers: [“188.xx.xx.xx”] [188.xx.xx.xx] executing command [188.xx.xx.xx] rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell ‘1.9.3’ -c ‘test -w /home/digifoto.com/apps/digifoto’ command finished in 251ms
  • executing “test -w /home/digifoto.com/apps/digifoto/releases” servers: [“188.xx.xx.xx”] [188.xx.xx.xx] executing command [188.xx.xx.xx] rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell ‘1.9.3’ -c ‘test -w /home/digifoto.com/apps/digifoto/releases’ command finished in 256ms
  • executing “which tar” servers: [“188.xx.xx.xx”] [188.xx.xx.xx] executing command [188.xx.xx.xx] rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell ‘1.9.3’ -c ‘which tar’ command finished in 513ms You appear to have all necessary dependencies installed

Well, then I issued: cap deploy

After several minutes I got an error:

[188.xx.xx.xx] sftp upload /tmp/20120414150439.tar.gz → /tmp/20120414150439.tar.gz *** upload via sftp failed on 188.xx.xx.xx: Connection timed out - recvfrom(2) (Connection timed out - recvfrom(2)) *** [deploy:update_code] rolling back

  • executing “rm -rf /home/digifoto.com/apps/digifoto/releases/20120414150439; true” servers: [“188.xx.xx.xx”] ** [deploy:update_code] exception while rolling back: IOError, closed stream upload via sftp failed on 188.xx.xx.xx: Connection timed out - recvfrom(2) (Connection timed out - recvfrom(2))

This is my deploy.rb:

Can you sftp the file to that location manually? Are you sure there is adequate disk space? Have you looked for permissions issues?

Have you watched your system logs while this is occurring?

If its your own server you really should set it up so it can connect to your git server and set:

set :deploy_via, :remote_cache

This way you’ll save a lot of time; capistrano will update a repo in your server instead of sending a tar file with the whole project and I guess you won’t have problems with sftp.

If thats not possible, looks like you may not have the port used by sftp opened on your server or that ip is not accessible from your dev machine.

Good luck.

Hi, friends!

I’m using Rails 3.2.3, RVM, Postgresql 9.1.3 and running Ubuntu Server 11.10 on my own Dell server. I tried this:

cap deploy:check

  • executing `deploy:check’
  • executing “test -d /home/digifoto.com/apps/digifoto/releases” servers: [“188.xx.xx.xx”] [188.xx.xx.xx] executing command [188.xx.xx.xx] rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell ‘1.9.3’ -c ‘test -d /home/digifoto.com/apps/digifoto/releases’ command finished in 389ms
  • executing “test -w /home/digifoto.com/apps/digifoto” servers: [“188.xx.xx.xx”] [188.xx.xx.xx] executing command [188.xx.xx.xx] rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell ‘1.9.3’ -c ‘test -w /home/digifoto.com/apps/digifoto’ command finished in 251ms
  • executing “test -w /home/digifoto.com/apps/digifoto/releases” servers: [“188.xx.xx.xx”] [188.xx.xx.xx] executing command [188.xx.xx.xx] rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell ‘1.9.3’ -c ‘test -w /home/digifoto.com/apps/digifoto/releases’ command finished in 256ms
  • executing “which tar” servers: [“188.xx.xx.xx”] [188.xx.xx.xx] executing command [188.xx.xx.xx] rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell ‘1.9.3’ -c ‘which tar’ command finished in 513ms You appear to have all necessary dependencies installed

Well, then I issued: cap deploy

After several minutes I got an error:

[188.xx.xx.xx] sftp upload /tmp/20120414150439.tar.gz → /tmp/20120414150439.tar.gz *** upload via sftp failed on 188.xx.xx.xx: Connection timed out - recvfrom(2) (Connection timed out - recvfrom(2)) *** [deploy:update_code] rolling back

  • executing “rm -rf /home/digifoto.com/apps/digifoto/releases/20120414150439; true” servers: [“188.xx.xx.xx”] ** [deploy:update_code] exception while rolling back: IOError, closed stream upload via sftp failed on 188.xx.xx.xx: Connection timed out - recvfrom(2) (Connection timed out - recvfrom(2))

This is my deploy.rb:

require ‘bundler/capistrano’

require “rvm/capistrano” # Load RVM’s capistrano plugin. set :rvm_ruby_string, ‘1.9.3’ # Or whatever env you want it to run in.

set :application, “digifoto” set :repository, “git@github.com:xxxxxx/digifoto.git” set :branch, “production”

set :scm, :git set :user, “digifoto.com” set :deploy_to, “/home/digifoto.com/apps/#{application}” set :deploy_via, :copy

set :use_sudo, false set :keep_releases, 3

role :web, “188.xx.xx.xx” # Your HTTP server, Apache/etc role :app, “188.xx.xx.xx” # This may be the same as your Web server role :db, “188.xx.xx.xx”, :primary => true # This is where Rails migrations will run

set :port, 22

namespace :deploy do task :start do ; end task :stop do ; end task :restart, :roles => :app, :except => { :no_release => true } do run “#{try_sudo} touch #{File.join(current_path,‘tmp’,‘restart.txt’)}” end end

I am pulling my hair because of this! Could someone help me? Thanks in advance!

Hi friends! Yes, I have enough space on disk and the permissions are OK. I tried to change from “set :deploy_via, :copy” to “set :deploy_via, :remote_cache” and everything seemed to be all right when I got stucked with another problem:

bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile rake aborted! uninitialized constant Capistrano

I will open a new topic for this new problem.

Thank you very, very much for your replies :slight_smile: !