Class: EbDeployer::DeploymentStrategy::BlueGreen

Inherits:
Object
  • Object
show all
Defined in:
lib/eb_deployer/deployment_strategy.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, env_name, eb_driver, env_creation_opts) ⇒ BlueGreen

Returns a new instance of BlueGreen.



18
19
20
21
22
23
24
25
# File 'lib/eb_deployer/deployment_strategy.rb', line 18

def initialize(app, env_name, eb_driver, env_creation_opts)
  @app = app
  @env_name = env_name
  @eb_driver = eb_driver
  @major_cname_prefix = env_creation_opts[:cname_prefix]
  @solution_stack = env_creation_opts[:solution_stack]
  @smoke_test = env_creation_opts[:smoke_test]
end

Instance Method Details

#deploy(version_label, env_settings) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/eb_deployer/deployment_strategy.rb', line 27

def deploy(version_label, env_settings)
  if !envs.any?(&method(:active_env?))
    env('a', @major_cname_prefix).
      deploy(version_label, env_settings)
    return
  end

  active_env = envs.detect(&method(:active_env?))
  inactive_env = envs.reject(&method(:active_env?)).first

  inactive_env.deploy(version_label, env_settings)
  active_env.swap_cname_with(inactive_env)
end