Skip to content

Instantly share code, notes, and snippets.

@epintos
Created July 11, 2015 18:40
Show Gist options
  • Save epintos/6476e9adcf60abed4938 to your computer and use it in GitHub Desktop.
Save epintos/6476e9adcf60abed4938 to your computer and use it in GitHub Desktop.
Ruby on Rails deploy with Capistrano 3
# Config valid only for Capistrano 3.2.1
lock '3.2.1'
set :application, 'your-project'
set :repo_url, '[email protected]:organization/your-repository.git'
ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call
set :scm, :git
set :deploy_to, "/home/ubuntu/apps/#{fetch(:application)}"
set :log_level, :info
set :linked_dirs, %w(bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system)
# False is required for sidekiq to work
set :pty, false
set :sidekiq_processes, 5
set :keep_releases, 5
set :rbenv_type, :user
set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} #{fetch(:rbenv_path)}/bin/rbenv exec"
set :rbenv_ruby, '2.0.0-p645'
set :rbenv_map_bins, %w{rake gem bundle ruby rails}
set :rbenv_roles, :all
set :unicorn_user, "ubuntu"
set :unicorn_error_log, "#{shared_path}/log/unicorn_error.log"
set :unicorn_workers, 4
set :bundle_jobs, 4
set :whenever_identifier, ->{ "#{fetch(:application)}_#{fetch(:stage)}" }
after 'deploy:publishing', 'deploy:restart'
after 'deploy:restart', 'sidekiq:restart'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment