Deploying rails 3.1 application to amazon EC2 Instance with Capistrano connection failed error

Followed the step in the
http://blog.bhushangahire.net/2010/02/17/setup-capistrano-to-deploy-rails-application-on-amazon-ec2-with-git/


Able to connect to the ec2 as a User with SSH. (geoman.pub key is in
~/.ssh folder )

  1. Create a user geoman in ec2.
  2. created public and private key for the user.
  3. Copied the public key to ec2 and able to SSH as user to ec2 from
    mac shell. ssh -i ~/.ssh/geoman -l geoman ec2-xx-xxx-xx-xxx.us-
    west-2.compute.amazonaws.com

Able to create a test rails project, place in local git and setup
Capistrano

Here is the deploy.rb

set :application, “awstestapp”
set :repository, “.”

set :scm, :git

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

perforce, subversion or none

set :location, “ec2-xx-xxx-xx-xxx.us-west-2.compute.amazonaws.com
role :web, location # Your HTTP server,
Apache/etc
role :app, location # This may be the same as
your Web server
role :db, location, :primary => true # This is where Rails migrations
will run
#role :db, “your slave db-server here”

The directory on the EC2 node that will be deployed to

set :deploy_to, “/var/www/vhosts/#{application}”

The way in which files will be transferred from repository to remote

host

If you were using a hosted github repository this would be slightly

different
set :deploy_via, :copy

Set up SSH so it can connect to the EC2 node - assumes your SSH key

is in ~/.ssh/id_rsa
set :user, [File.join(ENV[“HOME”], “.ssh”, “geoman”)]

if you’re still using the script/reaper 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/*

If you are using Passenger mod_rails uncomment this:

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


Run the command - cap deploy:setup FAILED

NOTE: [(geoman.pub key is in ~/.ssh folder )]

  • executing `deploy:setup’
    • executing “sudo -p 'sudo password: ’ mkdir -p /var/www/vhosts/
      awstestapp /var/www/vhosts/awstestapp/releases /var/www/vhosts/
      awstestapp/shared /var/www/vhosts/awstestapp/shared/system /var/www/
      vhosts/awstestapp/shared/log /var/www/vhosts/awstestapp/shared/pids”
      servers: [“ec2-xx-xxx-xx-xxx.us-west-2.compute.amazonaws.com”]
      Password:
      connection failed for: ec2-xx-xxx-xx-xxx.us-
      west-2.compute.amazonaws.com (Net::SSH::AuthenticationFailed: /Users/
      geoman/.ssh/geoman)

what do I miss here? any help is appreciated.

On Dec 12, 4:28am, Geo M. [email protected] wrote:

Set up SSH so it can connect to the EC2 node - assumes your SSH key

is in ~/.ssh/id_rsa
set :user, [File.join(ENV[“HOME”], “.ssh”, “geoman”)]

I think you copied from that blog post too hastily - :user should be
set to the user name, not the path to the ssh key, which is set
separately.

Fred