Class: CfDeployer::DeploymentStrategy::AutoScalingGroupSwap

Inherits:
BlueGreen
  • Object
show all
Defined in:
lib/cf_deployer/deployment_strategy/auto_scaling_group_swap.rb

Defined Under Namespace

Classes: BothStacksActiveError

Constant Summary

Constants inherited from Base

Base::BLUE_GREEN_STRATEGY

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

#blue_green_strategy?, #initialize

Constructor Details

This class inherits a constructor from CfDeployer::DeploymentStrategy::Base

Instance Method Details

#deployObject



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/cf_deployer/deployment_strategy/auto_scaling_group_swap.rb', line 6

def deploy
  check_blue_green_not_both_active 'Deployment'
  Log.info "Found active stack #{active_stack.name}" if active_stack
  delete_stack inactive_stack
  create_inactive_stack
  swap_group
  run_hook(:'after-swap')
  Log.info "Active stack has been set to #{inactive_stack.name}"
  delete_stack(active_stack) if active_stack && !keep_previous_stack
  Log.info "#{component_name} deployed successfully"
end

#kill_inactiveObject

Raises:



19
20
21
22
23
# File 'lib/cf_deployer/deployment_strategy/auto_scaling_group_swap.rb', line 19

def kill_inactive
  check_blue_green_not_both_active 'Kill Inactive'
  raise ApplicationError.new('Only one color stack exists, cannot kill a non-existant version!') unless both_stacks_exist?
  delete_stack inactive_stack
end

#switchObject

Raises:



25
26
27
28
29
30
# File 'lib/cf_deployer/deployment_strategy/auto_scaling_group_swap.rb', line 25

def switch
  check_blue_green_not_both_active 'Switch'
  raise ApplicationError.new('Only one color stack exists, cannot switch to a non-existent version!') unless both_stacks_exist?
  warm_up_cooled = true
  swap_group warm_up_cooled
end