lserman / capistrano-elbas

Deploy Rails apps to AWS AutoScale groups
MIT License
96 stars 67 forks source link

Multi Region/Multi ASG #21

Closed sixfeetover closed 5 years ago

sixfeetover commented 7 years ago

These changes allow for deploying to multiple regions and/or multiple autoscaling groups. Addresses #15.

This should be merged after #20, as it builds off of those commits. When #20 is merged in, I can rebase off of that before this gets merged.

jamesbloomer commented 7 years ago

@sixfeetover I tried using the branch for this PR and found that it tried to connect to the servers using the private IP address. I have noticed that you used this rather than the public DNS name, any particular reason?

jamesbloomer commented 7 years ago

I've been trying this PR, placing the autoscale call in an environment configuration file where a call to server used to be. It still however only updates one of the launch configurations.

eg.

set :stage, :review

autoscale 'www', user: 'user', roles: %w(app db)
autoscale 'data', user: 'user', roles: %w(data)

Are you running autoscale inside a configuration file like that? It only updates the AMI and LC for the last autoscale in the file.

sixfeetover commented 7 years ago

That's true - it's the internal IP because our servers have no public IPs. They are private and only accessed through a bastion. We haven't tested on public because we don't have any - perhaps we can make it an option to use either internal IP or public DNS.

As to the ASG, we are deploying to the ASGs of the same name in different regions. Let me verify the behavior and get back to you.

mmartell37 commented 7 years ago

I have verified locally that indeed a new AMI is created, and the launch configuration updated for, only the last ASG provided. I'm debugging now.

mmartell37 commented 7 years ago

@jamesbloomer I've added support for multiple regions in #21 and tested locally. This should also support multiple, different ASGs per region, but is not yet tested.

jamesbloomer commented 7 years ago

@mmartell37 I'm afraid that still doesn't work for the case of:

autoscale 'www', user: 'user', roles: %w(app)
autoscale 'data', user: 'user', roles: %w(data)

set :aws_region, 'eu-west-1'

It creates the AMI and LC for the last autoscale statement.

mmartell37 commented 7 years ago

@jamesbloomer Indeed, I missed an inner loop over ASGs in a given region. I've tested locally, but do not have a multi-ASG setup in a given region. Please try #21 again with my latest commit.

jamesbloomer commented 7 years ago

I've got that working now, so thanks a lot. A couple of points to note:

sixfeetover commented 7 years ago

Since there's no activity here, and there's more stuff we wanted to do to this gem, I've forked this permanently as a new gem at https://github.com/sixfeetover/capistrano-asg.

@jamesbloomer Do you want to add your comments as an issue over there? PRs also welcome!

lserman commented 5 years ago

I'm just now coming back to maintain this repository using the new AWS SDK and AWS launch templates. I will not be maintaining the old ELBAS that relied on launch configurations and AWS SDK v1. It seems like @sixfeetover has moved the older versions onto a fork and that's fine by me, so I'm going to close this PR. Multi-region AMI creation is something I'd like to get into the new version eventually but isn't a priority for me personally at the moment. If someone wants to extract the AMI creation/launch template parts of this PR, update them for aws-sdk-v3, and make a new PR then I'll be glad to take a look at it and merge.

Systho commented 5 years ago

@lserman How high a priority is it for you to allow single region but multiple ASG ?

lserman commented 5 years ago

Not personally motivated to do it right now, our setups all use one ASG per deploy. I will be more active in managing PRs etc though if someone else wants to take a shot.