Skip to content

Instantly share code, notes, and snippets.

@nelyj
Last active August 29, 2015 13:56
Show Gist options
  • Save nelyj/9261134 to your computer and use it in GitHub Desktop.
Save nelyj/9261134 to your computer and use it in GitHub Desktop.
# config valid only for Capistrano 3.1
lock '3.1.0'
set :application, 'mydomain.com'
set :deploy_user, 'deploy'
set :deploy_to, '/var/www'
#setup repo details
set :scm, :git
set :repo_url, 'git@github.com:patojimenez/mydomain.com'
#setup rvm
set :rbenv_type, :system
set :rbenv_ruby, 'ruby 1.9.3p484'
set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} #{fetch(:rbenv_path)}/bin/rbenv exec"
set :rbenv_map_bins, %w{rake gem bundle ruby rails}
ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }
set :format, :pretty
set :pty, true
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
set :linked_files, %w{config/database.yml config/application.yml}
set :keep_releases, 5
set :rails_env, "production"
set :deploy_via, :copy
set :ssh_options, { :forward_agent => true, :port => 22 }
server "www.mydomain.com", :app, :web, :db, :primary => true
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
# Your restart mechanism here, for example:
# execute :touch, release_path.join('tmp/restart.txt')
end
end
after :publishing, :restart
after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
# Here we can do anything such as:
# within release_path do
# execute :rake, 'cache:clear'
# end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment