views:

172

answers:

2

Hi, im trying to deploy an application in slicehost using capistrano. I can log in via SSH using the same credentials, however when I try to deploy it i get the following error:

  • executing `deploy'
  • executing `deploy:update' ** transaction: start
  • executing `deploy:update_code' updating the cached checkout on all servers executing locally: "git ls-remote [email protected]:xxx.git master"
  • executing "if [ -d /home/sdn/shared/cached-copy ]; then cd /home/xxx/shared/cached-copy && git fetch -q origin && git reset -q --hard 910a97024a45f1304d6b50c8862605ea0f1cf829 && git clean -q -d -x -f; else git clone -q [email protected]:xxx.git /home/xxx/shared/cached-copy && cd /home/xxx/shared/cached-copy && git checkout -q -b deploy 910a97024a45f1304d6b50c8862605ea0f1cf829; fi" servers: ["173.203.79.208"] * [deploy:update_code] rolling back
  • executing "rm -rf /home/xxx/releases/20100506160548; true" servers: ["173.203.79.208"] ** [deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: 173.203.79.208 (Net::SSH::Disconnect: connection closed by remote host) connection failed for: 173.203.79.208 (Net::SSH::Disconnect: connection closed by remote host)

What am I doing wrong? is anything I should add to my deploy.rb file in order to get it to work with slicehost?

+1  A: 

Does Slicehost have permission to clone a repository from your git server? If your git server requires ssh authentication, you'll have to generate ssh keys on your host, and put your host's public key on your git server.

If it's not that, then it appears that it's something else related to running git on your host. But "(Net::SSH::Disconnect: connection closed by remote host)" smells like an authentication issue.

Clinton Judy
A: 

You can generate a key on your server as Clinton suggests, or you can enable SSH Agent Forwarding.

This means you won't have to generate a new SSH key on your server. You use the the key already on the machine you're deploying from and the key is forwarded for use on the server to connect to your git server.

You can add ssh_options[:forward_agent] = true to your capistrano recipe or add a Host config to your ~/.ssh/config like this:

Host <name>
  HostName <ip or host>
  User <username>
  IdentityFile ~/.ssh/<filename>
  ForwardAgent yes

I prefer the later.

There's a very thorough guide to SSH Agent Forwarding over at www.unixwiz.net

jordelver