ThoughtWorksStudios / eb_deployer

AWS Elastic Beanstalk blue-green deployment automation from ThoughtWorks Mingle Team
MIT License
400 stars 94 forks source link

blue-green stopped working in us-east #75

Open hoshy opened 8 years ago

hoshy commented 8 years ago

I have a strange issue: blue-green deploy does not work after moving to us-east-1 region.

After playing around I found that ElasticBeanstalk adds region to the EB URLs like my-app.us-east-1.elasticbeanstalk.com. That was not the case in eu-west-1.

I worked around by hacking https://github.com/ThoughtWorksStudios/eb_deployer/blob/master/lib/eb_deployer/deployment_strategy/blue_green.rb#L62

  def active_ebenv?(ebenv)
    str = ebenv.cname_prefix.nil? ? nil : ebenv.cname_prefix.gsub(/\..*/,'')
    str == @component.cname_prefix
  end

This solves the issue for me - but it's not the way it should be implemented I guess ;-)

ap-dji commented 8 years ago

Blue/green is working for me in us-east using 0.6.6 . The dns naming change was announced back in January and presumably has rolled out to all regions by now.

darkoz commented 8 years ago

I have a similar issue. I recently renamed our EB application (in ap-southeast-2 region**) and re-ran the deployer where the only config change was a new application name. This created a new environment correctly, but subsequent deploys always seem to do an inplace update. The output shows eb_deployer trying to do a describe on a second env which doesn't exist but then proceeds to deploy to the original instead of creating the new environment.

I tried cloning the original environment and naming it after the search string from the output, but the behaviour remained the same.

\ the reasons for the rename was to get a new clean build which would then also get the DNS changes because of an ancient env we had with the old no-region URI

wpc commented 8 years ago

This issue should already been fixed 0.6.4 (released back to Jan 2016) @darkoz and @hoshy, do you still have this problem? Which version of eb_deployer are you guys using?

hoshy commented 8 years ago

@wpc I use eb_deployer (0.6.6) - yes problem still exists.

wpc commented 8 years ago

@hoshy:

Can you take a look at your environment url, is that exactly match ${application-name}-${environment-name}.us-east-1.elasticbeanstalk.com?

darkoz commented 8 years ago

@wpc yes the problem persists - I'm using version 0.6.6.

If the app name is something like xyz-website and my environment name (in the yml) is production this generated an env in EB called production-a-1234567 with the URL xyz-website-production.ap-southeast-2.elasticbeanstalk.com

When the deployer runs it searches for env production-b-7654321 doesn't find it and decides to deploy to env a.

Relevant logs:

[2016-07-14T06:04:17.529481 #15192]  INFO -- : [Aws::ElasticBeanstalk::Client 200 1.085341 0 retries] describe_environments(application_name:"xyz-website",environment_names:["production-a-1234567"])
[2016-07-14T06:04:17.646081 #15192]  INFO -- : [Aws::ElasticBeanstalk::Client 200 0.116127 0 retries] describe_environments(application_name:"xyz-website",environment_names:["production-b-7654321"])
[2016-07-14T06:04:17.867926 #15192]  INFO -- : [Aws::ElasticBeanstalk::Client 200 0.221493 0 retries] describe_environments(application_name:"xyz-website",environment_names:["production-a-1234567"])
[2016-07-14T06:04:17.929711 #15192]  INFO -- : [Aws::ElasticBeanstalk::Client 200 0.061392 0 retries] describe_events(max_records:1,application_name:"xyz-website",environment_name:"production-a-1234567")
[2016-07-14T06:04:19.260271 #15192]  INFO -- : [Aws::ElasticBeanstalk::Client 200 1.330172 0 retries] describe_environments(application_name:"xyz-website",environment_names:["production-a-1234567"])
[2016-07-14T06:04:22.659676 #15192]  INFO -- : [Aws::ElasticBeanstalk::Client 200 3.397742 0 retries] update_environment(environment_id:"${production-a-1234567-id}",version_label:"1.0.0.123",option_settings:[{...}],tier:{name:"WebServer",type:"Standard"})
hoshy commented 8 years ago

@wpc the URL is ${application}-${environments.name}-${components.name}.us-east-1.elasticbeanstalk.com