Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Switched to using bundler capistrano tasks. Moved custom task definit…

…ions into lib/deploy/. Removed hoptoad-related load path munging as that gem is now in Gemfile.
  • Loading branch information...
commit 00b0fb6d02787dce7aaa4be8e6c45233922795a1 1 parent 0833ae7
@tcopeland tcopeland authored
View
1  Capfile
@@ -1,3 +1,4 @@
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
+Dir['lib/deploy/*.rb'].each { |r| load(r) }
load 'config/deploy'
View
82 config/deploy.rb
@@ -2,11 +2,10 @@
set :default_stage, "staging"
require 'capistrano/ext/multistage'
+require 'bundler/capistrano'
default_run_options[:pty] = true
-
set :ssh_options, { :forward_agent => true }
-
set :application, "gemcutter"
set(:rails_env) { "#{stage}"}
@@ -14,90 +13,17 @@
# add your private key to the ssh agent. If that's not good for you, just uncomment the
# "set :deploy_via, :copy" and comment "set :deploy_via, :remote_cache"
set :scm, :git
-set :repository, "git://github.com/rubygems/gemcutter"
+set :repository, "git://github.com/rubygems/#{application}"
set :repository_cache, "git_cache"
set :git_enable_submodules, 1
set :deploy_via, :remote_cache
set :git_shallow_clone, 1
set :use_sudo, false
-
set :group, "rubycentral"
set :user, "rubycentral"
-set :ree_path, "/opt/ruby-enterprise-1.8.7-2010.02/bin"
-
-namespace :deploy do
- desc "Restarting mod_rails with restart.txt"
- task :restart, :roles => :app, :except => { :no_release => true } do
- run "touch #{current_path}/tmp/restart.txt"
- end
-
- [:start, :stop].each do |t|
- desc "#{t} task is a no-op with mod_rails"
- task t, :roles => :app do ; end
- end
-
- desc "Move in database.yml for this environment"
- task :move_in_database_yml, :roles => :app do
- run "cp #{deploy_to}/shared/config/database.yml #{current_path}/config/"
- end
-
- desc "Run gem bundle"
- task :bundle, :roles => :app do
- env = "PATH=/usr/local/pgsql/bin:/usr/local/bin:/bin:/usr/bin RAILS_ENV=#{rails_env} #{ree_path}"
- run "#{env}/bundle install --gemfile #{release_path}/Gemfile --path #{fetch(:bundle_dir, "#{shared_path}/bundle")} --deployment --without development test"
- end
-
- desc "Migrate with bundler"
- task :migrate_with_bundler, :roles => :app do
- run "cd #{release_path} && #{ree_path}/rake db:migrate RAILS_ENV=#{rails_env}"
- end
-
- desc "Move in secret settings for this environment"
- task :move_in_secret_settings, :roles => :app do
- run "cp #{deploy_to}/shared/config/secret.rb #{current_path}/config/secret.rb"
- run "cp #{deploy_to}/shared/config/newrelic.yml #{current_path}/config/newrelic.yml"
- end
-end
-
-namespace :maintenance do
- desc "Go to maintenance mode"
- task :on, :roles => :app do
- run "touch #{current_path}/tmp/maintenance_mode"
- deploy.restart
- end
- desc "Back to normal non-maintenance mode"
- task :off, :roles => :app do
- run "rm -f #{current_path}/tmp/maintenance_mode"
- deploy.restart
- end
-end
-
-namespace :bluepill do
- desc "Stop processes that bluepill is monitoring and quit bluepill"
- task :quit, :roles => [:app] do
- sudo "bluepill stop; true"
- sudo "bluepill quit; true"
- end
-
- desc "Load bluepill configuration and start it"
- task :start, :roles => [:app] do
- sudo "bluepill load #{release_path}/config/pills/#{rails_env}.rb"
- end
-
- desc "Prints bluepills monitored processes statuses"
- task :status, :roles => [:app] do
- sudo "bluepill status"
- end
-end
-
+after "deploy", "deploy:migrate"
after "deploy:update", "bluepill:quit", "bluepill:start"
-
-after "deploy:update_code", "deploy:bundle"
-after "deploy", "deploy:migrate_with_bundler"
after "deploy", "deploy:cleanup"
after "deploy:symlink", "deploy:move_in_database_yml", "deploy:move_in_secret_settings"
-
-Dir[File.join(File.dirname(__FILE__), '..', 'vendor', 'gems', 'hoptoad_notifier-*')].each do |vendored_notifier|
- $: << File.join(vendored_notifier, 'lib')
-end
+before "bundle:install", "deploy:set_config_for_pg_gem"
View
18 lib/deploy/bluepill.rb
@@ -0,0 +1,18 @@
+namespace :bluepill do
+ desc "Stop processes that bluepill is monitoring and quit bluepill"
+ task :quit, :roles => [:app] do
+ sudo "bluepill stop; true"
+ sudo "bluepill quit; true"
+ end
+
+ desc "Load bluepill configuration and start it"
+ task :start, :roles => [:app] do
+ sudo "bluepill load #{release_path}/config/pills/#{rails_env}.rb"
+ end
+
+ desc "Prints bluepills monitored processes statuses"
+ task :status, :roles => [:app] do
+ sudo "bluepill status"
+ end
+end
+
View
31 lib/deploy/misc.rb
@@ -0,0 +1,31 @@
+namespace :deploy do
+ desc "Move in database.yml for this environment"
+ task :move_in_database_yml, :roles => :app do
+ run "cp #{deploy_to}/shared/config/database.yml #{current_path}/config/"
+ end
+
+ desc "Move in secret settings for this environment"
+ task :move_in_secret_settings, :roles => :app do
+ run "cp #{deploy_to}/shared/config/secret.rb #{current_path}/config/secret.rb"
+ run "cp #{deploy_to}/shared/config/newrelic.yml #{current_path}/config/newrelic.yml"
+ end
+
+ task :set_config_for_pg_gem, :roles => [:app, :db] do
+ run "cd #{current_path} && bundle config build.pg --with-pg-config=/usr/local/pgsql/bin/pg_config --no-rdoc --no-ri"
+ end
+
+end
+
+namespace :maintenance do
+ desc "Go to maintenance mode"
+ task :on, :roles => :app do
+ run "touch #{current_path}/tmp/maintenance_mode"
+ deploy.restart
+ end
+ desc "Back to normal non-maintenance mode"
+ task :off, :roles => :app do
+ run "rm -f #{current_path}/tmp/maintenance_mode"
+ deploy.restart
+ end
+end
+
View
11 lib/deploy/passenger.rb
@@ -0,0 +1,11 @@
+namespace :deploy do
+ desc "Restarting mod_rails with restart.txt"
+ task :restart, :roles => :app, :except => { :no_release => true } do
+ run "touch #{current_path}/tmp/restart.txt"
+ end
+
+ [:start, :stop].each do |t|
+ desc "#{t} task is a no-op with mod_rails"
+ task t, :roles => :app do ; end
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.