I am trying to deploy my first webapp to EC2 using capistrano and the repo is on github. But I am facing issues with "cap deploy:cold". The deploy.rb is pasted below. Following are the steps I followed.
1) Logged into ec2 instance using ssh from my local machine. Generated keys using ssh-keygen without any passphrase.
2) Took the contents of id_rsa.pub and copied to the github repo settings deploy keys.
3) Then from my local machine, ran "cap deploy:cold". I get the following error
user1@laptop:~/MyExample$ cap deploy:cold
* 2013-03-01 19:08:06 executing deploy:cold'
deploy:update'
** transaction: start
* 2013-03-01 19:08:06 executing `deploy:update_code'
updating the cached checkout on all servers
executing locally: "git ls-remote git@github.com:user1/MyExample.git HEAD"
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
* [deploy:update_code] rolling back
* executing "rm -rf /var/www/MyExample.com/releases/20130301133835; true"
servers: ["181.73.124.219"]
[181.73.124.219] executing command
command finished in 1186ms
* 2013-03-01 19:08:06 executing
set :application, "MyExample.com" set :scm, "git" set :repository, "git@github.com:thisuser/example.git"
default_run_options[:pty] = true
set :user, 'ubuntu' set :use_sudo, true set :deploy_to, "/var/www/#{application}" set :deploy_via, :remote_cache
role :web, "181.73.124.219" role :app, "181.73.124.219" role :db, "181.73.124.219", :primary => true
after "deploy", "deploy:bundle_gems" after "deploy:bundle_gems", "deploy:restart"
namespace :deploy do task :bundle_gems do run "cd #{deploy_to}/current && bundle install vandor/gems" end 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
What am I missing here? Also any pointers to a URL/blog that can provide detailed steps would help.
Thanks.