Capistrano Deploy with SVN over SSH - Network connection closed unexpectedly

Hello all,

i changed today from my local repository to a repository on a server.
The repository now lies on the same server where my application is going
to be deployed. Everything went fine
create my repository on the server and checked out my working copy.
After some changes on the code i wanted to deploy my application but it
failed.
The error is:

“svn: Network connection closed unexpectedly”

Here is the output after the deploy:

cap deploy:update

  • executing `deploy:update’
    ** transaction: start
  • executing `deploy:update_code’
    executing locally: “svn info
    svn+ssh://[email protected]/kunden//svn//trunk
    –username ssh-username --password passwort --no-auth-cache -rHEAD”
    Password:
  • executing “svn checkout -q --username username --password passwort
    –no-auth-cache -r74
    svn+ssh://[email protected]/kunden/***/svn//trunk
    /kunden/284650_78052/webseiten/releases/20100909095956 && (echo 74 >
    /kunden/284650_78052/webseiten/releases/20100909095956/REVISION)”
    servers: [“domainname.com”]
    [domainname.com] executing command
    ** [domainname.com :: err] svn: Network connection closed unexpectedly
    command finished
    *** [deploy:update_code] rolling back
  • executing “rm -rf /kunden///releases/20100909095956;
    true"
    servers: [“domainname.com”]
    [domainname.com] executing command
    command finished
    failed: "sh -c 'svn checkout -q --username ssh-username --password
    passwort --no-auth-cache -r74
    svn+ssh://[email protected]/kunden/
    /svn//trunk
    /kunden///releases/20100909095956 && (echo 74 >
    /kunden/**//releases/20100909095956/REVISION)'” on
    domainname.com

The username and Passwort for the ssh tunnel is correct, i can checkout
the files locally trough a svn client. I will post my deploy.rb maybe
there is something wrong:

set :application, “"
set :domain, "
"
set :repository,
"svn+ssh://[email protected]/kunden/
/svn//trunk”

set :scm, :subversion
set :scm_username, “ssh-username”
set :scm_password, “password”

Or: accurev, bzr, cvs, darcs, git, mercurial, perforce,

subversion or none

set :deploy_via, :checkout
set :deploy_to, “/kunden/*******”
set :user, “username”
set :password, “password”
set :use_sudo, false

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

If you are using Passenger mod_rails uncomment this:

if you’re still using the script/reapear helper you will need

these GitHub - rails/irs_process_scripts: WARNING: this repo is not maintained anymore, if you want to maintain it, please send an mail to rails-core. The extracted inspector, reaper, and spawner scripts from script/process/*

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

So far i used my local repository and depoyed the application via a copy
and not with a checkout from the repository.

Maybe someone had the same problems and could help my with some hints or
a solution. I would be appreciative.

Greetings Greg

Thanks radhames you got it! Costs me half a day and was so easy to
solve.
Copied default_run_options[:pty] = true into my deploy.rb and now he
accepts the ssh key and the deploy worked.

Greetings Greg

Am 09.09.2010 um 14:59 schrieb radhames brito:

Great!!!

aahh the old ssh to the same machine from capistrano, you see, when your
repository and the deployment machine are the same and cap tries to do
ssh
to that machine to checkin with ssh, the first time , the machine does
not
have its own public key cached
is as if you try to ssh to another machine , it will ask you if you want
to
save the public key and that you dont have it cached, then you say yes
and
it never asks you again. The thing is the first time one tries this you
never think that it will need is its own public key to self connect.

SOLUTION, connect on the server and ssh to itself, it will ask if you
want
to save the public key, say yes , good luck

OK. Here’s how I fixed this (on Mac OS X, but fix should work on any
client)

This particular issue arises when you are using a non-standard port
(let’s say 12001 for sake of example) for your SSH server.

Apparently the SVN client experiences syntax errors when given a port
address on a command line like this one:

svn list
svn+ssh://[email protected]:12001/home/username/svn/myproject

So, to fix this, you need to create a client-side config file for SSH
like this:

cd ~
cd .ssh
vi config (create a config file like the one that follows)
:w
:q

Config file located in ~/.ssh/config:

Host domain.com
User username
Port 12001

Then, issue your svn+ssh command WITHOUT the port like this:

svn list svn+ssh://[email protected]/home/username/svn/myproject

That’s it!

Hope that helps.
Rick