Class: Blue::Deploy

Inherits:
Object
  • Object
show all
Defined in:
lib/capistrano/deploy.rb

Class Method Summary collapse

Class Method Details

.load(capistrano_config) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/capistrano/deploy.rb', line 3

def self.load(capistrano_config)
  capistrano_config.load do

    namespace :blue do
      desc 'Apply the Blue manifest for this application'
      task :apply_manifest, :except => { :no_release => true } do
        current_host = capture("echo $CAPISTRANO:HOST$").strip.gsub('.', '_')
        # run "cd #{latest_release} && RAILS_ROOT=#{latest_release} RAILS_ENV=#{Blue.env} sudo shadow_puppet #{latest_release}/config/blue/boxes/#{Blue.env}/#{current_host}.rb"
        run "sudo su - -c 'cd #{latest_release} && RAILS_ROOT=#{latest_release} RAILS_ENV=#{Blue.env} shadow_puppet #{latest_release}/config/blue/boxes/#{Blue.env}/#{current_host}.rb'"
      end

      task :verify_db do
        run "cd #{latest_release} && RAILS_ENV=#{Blue.env} bundle exec rails runner 'ActiveRecord::Base.connection.execute %q!SELECT 1=1!'"
      end
    end

    after 'deploy:finalize_update', 'blue:apply_manifest'
    after 'deploy:migrate', 'blue:verify_db'
    after "deploy:update", "deploy:cleanup"
  end
end