This HowTo explain how to deploy web applications through capistrano with git repo hosted on bitbucket.org.

This was tested with EC2 instance and you need to edit your ssh config so that root could login with the password.

Add you public key to the server for authentication:

cat ~/.ssh/id_rsa.pub | ssh ServerName/IP “cat >> .ssh/authorized_keys”

Install the required package

apt-get install capistrano

Create a deployment config file

cd /var/www/deploy

capify .

vi /var/www/deploy/config/deploy.rb

set :application, “testapp”
server “gloss.io”, :web ,:primary => true
set :deploy_to, “/var/www/#{application}”
set :use_sudo, false
ssh_options[:forward_agent] = true
set :scm, :git
set :repository, “https://user:passowrd@bitbucket.org/BITBUCKETUSERNAME/PROJECT.git”
set :branch, “master”
role :app, ‘ROLE’

Advertisements