Amazon EC2, deployment with capistrano, how?

I am trying to deploy an application to Amazon EC2 with capistrano.

When I run cap deploy:cold

or cap deploy

, I get:

  * 2014-08-27 13:23:39 executing `deploy:cold'
  * 2014-08-27 13:23:39 executing `deploy:update'
 ** transaction: start
  * 2014-08-27 13:23:39 executing `deploy:update_code'
    executing locally: "git ls-remote git@bitbucket.org:username/repository.git HEAD"
    command finished in 1929ms
  * executing "git clone -q git@bitbucket.org:username/repository.git /var/www/repository/releases/20140827112340 && cd /var/www/repository/releases/20140827112340 && git checkout -q -b deploy 813ea45938eca0ee8bae9663d66592b917ecf4fb && (echo 813ea45938eca0ee8bae9663d66592b917ecf4fb > /var/www/repository/releases/20140827112340/REVISION)"
    servers: ["54.XX.XX.XX"]
    [54.XX.XX.XX] executing command
 ** [54.XX.XX.XX :: err] Permission denied (publickey).
 ** [54.XX.XX.XX :: err] fatal: Could not read from remote repository.
 ** 
 ** Please make sure you have the correct access rights
 ** and the repository exists.
    command finished in 505ms
*** [deploy:update_code] rolling back
  * executing "rm -rf /var/www/repository/releases/20140827112340; true"
    servers: ["54.XX.XX.XX"]
    [54.XX.XX.XX] executing command
    command finished in 246ms
failed: "sh -c 'git clone -q git@bitbucket.org:username/repository.git /var/www/repository/releases/20140827112340 && cd /var/www/repository/releases/20140827112340 && git checkout -q -b deploy 813ea45938eca0ee8bae9663d66592b917ecf4fb && (echo 813ea45938eca0ee8bae9663d66592b917ecf4fb > /var/www/repository/releases/20140827112340/REVISION)'" on 54.XX.XX.XX

      

My deploy.rb

file:

set :application, "appname"

set :scm, :git
set :repository, "git@bitbucket.org:username/repository.git"

set :user, "ubuntu"
set :deploy_to, "/var/www/repository"

server "54.XX.XX.XX", :app, :primary => true

      

I followed this tutorial .

I added an SSH key on the remote machine and put it in the git ssh keys.

I have write access to this repository.

How to fix it?

thank

+3


source to share





All Articles