Skip to content

Instantly share code, notes, and snippets.

@teohm
Created May 9, 2012 08:51
Show Gist options
  • Save teohm/2643104 to your computer and use it in GitHub Desktop.
Save teohm/2643104 to your computer and use it in GitHub Desktop.
Capistrano - basic setup
#config/deploy/demo.rb
# DEMO-specific deployment configuration
# please put general deployment config in config/deploy.rb
puts "****demo"
#config/deploy.rb
set :application, "project2"
set :stages, %w(live demo)
set :default_stage, "demo"
require 'capistrano/ext/multistage'
set :repository, "[email protected]:teohm/event-api.git"
set :scm, :git
set :deploy_via, :remote_cache
# Enable SSH agent forwarding
ssh_options[:forward_agent] = true
#
# 1) when error: Host key verification failed
# login remote server, run: ssh [email protected], and accept the host as known_hosts
#
# 2) when error: Permission denied (public_key)
# run 'ssh-add -K' on local machine, to add your key to ssh forward agent
# $ ssh-add -K
# Identity added: /Users/huiming/.ssh/id_rsa (/Users/huiming/.ssh/id_rsa)
#
# What is SSH Agent Forwarding?
# http://www.unixwiz.net/techtips/ssh-agent-forwarding.html
# (it's a bit long, but worth reading)
#
server "learndeploy", :web, :app, :db, :primary => true
set :deploy_to, "/home/deployer/#{application}"
set :use_sudo, false
puts "end of deploy"
require 'capistrano/shared_file' # gem install capistrano-shared_file
#config/deploy/live.rb
# LIVE-specific deployment configuration
# please put general deployment config in config/deploy.rb
puts "***live"
server "learndeploy", :web, :app, :db, :primary => true
set :deploy_to, "/home/deployer/#{application}-live"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment