Class: CfDeployer::DeploymentStrategy::CnameSwap
- Defined in:
- lib/cf_deployer/deployment_strategy/cname_swap.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
#application_name, #component_name, #context, #environment_name
Instance Method Summary collapse
Methods inherited from BlueGreen
#destroy, #exists?, #output_value, #status
Methods inherited from Base
#active_template, #blue_green_strategy?, #initialize, #run_hook
Constructor Details
This class inherits a constructor from CfDeployer::DeploymentStrategy::Base
Instance Method Details
#deploy ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/cf_deployer/deployment_strategy/cname_swap.rb', line 5 def deploy Log.info "Found active stack #{active_stack.name}" if active_stack delete_stack inactive_stack create_inactive_stack warm_up_inactive_stack run_hook(:'after-create') swap_cname Kernel.sleep 60 run_hook(:'after-swap') Log.info "Active stack has been set to #{inactive_stack.name}" delete_stack(active_stack) if active_stack && !settings[:'keep-previous-stack'] Log.info "#{component_name} deployed successfully" end |
#destroy_post ⇒ Object
32 33 34 |
# File 'lib/cf_deployer/deployment_strategy/cname_swap.rb', line 32 def destroy_post dns_driver.delete_record_set(dns_zone, dns_fqdn) end |
#kill_inactive ⇒ Object
20 21 22 23 |
# File 'lib/cf_deployer/deployment_strategy/cname_swap.rb', line 20 def kill_inactive raise ApplicationError.new("Stack: #{inactive_stack.name} does not exist, cannot kill it.") unless inactive_stack.exists? delete_stack inactive_stack end |
#switch ⇒ Object
25 26 27 28 29 30 |
# File 'lib/cf_deployer/deployment_strategy/cname_swap.rb', line 25 def switch raise ApplicationError.new('There is only one color stack active, you cannot switch back to a non-existent version') unless both_stacks_exist? swap_cname Log.info "Active stack has been set to #{inactive_stack.name}" Log.info "#{component_name} switched successfully" end |