Skip to content

Instantly share code, notes, and snippets.

@eparreno
Created January 14, 2010 13:02
Show Gist options
  • Save eparreno/277143 to your computer and use it in GitHub Desktop.
Save eparreno/277143 to your computer and use it in GitHub Desktop.
Standard capistrano deploy.rb file
# Standard capistrano deploy.rb file
# by Emili Parreno - www.eparreno.com
#
# Knowledge
# http://www.capify.org/index.php/Documentation
# http://github.com/guides/deploying-with-capistrano
# http://wiki.brightbox.co.uk/docs:gemv2:repositories
set :application, 'myapp'
set :keep_releases, 3
# Git settings
set :repository, '[email protected]:username/reponame.git'
set :scm, :git
set :branch, 'master'
set :copy_strategy, :export
set :deploy_via, :remote_cache
set :repository_cache, "/var/cache/www/#{application}"
#set :git_shallow_clone, 1
#set :git_enable_submodules, 1
#set :scm_verbose true
# SSH settings
set :user, 'username'
set :password, 'password'
set :use_sudo, false
#set :port, '22'
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
#set :runner, 'username'
#set :spinner, false
#set :reaper, false
# Roles
# Replace 0.0.0.0 with your ip
task :production do
set :rails_env, 'production'
set :deploy_to, "/var/www/#{application}/production"
role :web, '0.0.0.0'
role :app, '0.0.0.0'
role :db, '0.0.0.0', :primary => true
end
task :staging do
set :rails_env, 'staging'
set :deploy_to, "/var/www/#{application}/staging"
role :web, '0.0.0.0'
role :app, '0.0.0.0'
role :db, '0.0.0.0', :primary => true
end
task :after_symlink do
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
run "ln -nfs #{shared_path}/assets/ #{release_path}/public/assets"
end
namespace :deploy do
desc 'Restart Passenger $ cap production deploy:restart'
task :restart, :roles => :app do
run "touch #{release_path}/tmp/restart.txt"
end
desc 'Starts sphinx $ cap production deploy:sphinx:start'
namespace :sphinx do
task :start, :roles => :app do
...
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment