Skip to content

Instantly share code, notes, and snippets.

@farcaller
Created May 21, 2012 10:38
Show Gist options
  • Save farcaller/2761758 to your computer and use it in GitHub Desktop.
Save farcaller/2761758 to your computer and use it in GitHub Desktop.
set :application, 'hackndev'
set :repository, 'git@github.com:hackndev/hackndev.git'
set :rails_env, 'production'
default_environment["RAILS_ENV"] = 'production'
set :normalize_asset_timestamps, false
set :scm, :git
set :git_enable_submodules, true
set :production_server, 'naru.ihdev.net'
role :web, production_server
role :app, production_server
role :db, production_server, :primary => true
# target
set :deploy_to, '/home/hackndev/apps/hackndev'
set :svc_dir, '/home/hackndev/service'
set :user, 'hackndev'
set :group, 'hackndev'
set :use_sudo, false
# use bundler
require 'bundler/capistrano'
# use rvm
require 'rvm/capistrano'
set :rvm_ruby_string, '1.9.3'
set :rvm_type, :user
namespace :rvm do
task :trust_rvmrc do
run "rvm rvmrc trust #{release_path}"
end
end
after 'deploy', 'rvm:trust_rvmrc'
#after 'deploy:finalize_update', 'deploy:config'
# forward ssh auth
ssh_options[:forward_agent] = true
set :unicorn_pid, '/tmp/unicorn-pushtap.pid'
namespace :deploy do
# desc "Deploy production configs"
# task :config do
# run <<-CMD
# ln -sf #{shared_path}/database.yml #{latest_release}/config/database.yml
# CMD
# end
desc "Down-up restart of Unicorn"
task :restart, :except => { :no_release => true } do
#run "kill -s HUP `cat #{unicorn_pid}`"
run "sv stop #{svc_dir}/unicorn; sleep 1; sv start #{svc_dir}/unicorn"
end
desc "Start unicorn"
task :start, :except => { :no_release => true } do
#run "cd #{current_path} ; bundle exec unicorn_rails -c config/unicorn.rb -D"
run "sv start #{svc_dir}/unicorn"
end
desc "Stop unicorn"
task :stop, :except => { :no_release => true } do
#run "kill -s QUIT `cat #{unicorn_pid}`"
run "sv stop #{svc_dir}/unicorn"
end
task "migrate" do
end
end
after "deploy:restart", "deploy:cleanup"
# If you are using Passenger mod_rails uncomment this:
# namespace :deploy do
# task :start do ; end
# task :stop do ; end
# task :restart, :roles => :app, :except => { :no_release => true } do
# run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
# end
# end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment