Skip to content
This repository was archived by the owner on Jul 3, 2023. It is now read-only.

create alb-service #134

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kc-dot-io
Copy link

@kc-dot-io kc-dot-io commented Jun 16, 2017

overview

#101 attempts to overwrite web-service's ELB with ALB. Some of the reasons that this is important are:

  • vpc support
  • path based routing
  • rules based routing
  • web sockets
  • better connection draining

...however it seems it was rejected due to the implementation.

this PR attempts to re-introduce this ALB implementation in a non breaking way by adding a different type of service that can be explicitly chosen as an alternative to the elb enabled web-service. I've called it alb-service - yuck, i know.

tasks

  • create alb-service
  • test that it works

note

if this approach is accepted in principal, then here are the questions up for discussion:

  • is this module name ok or should we change it? socket-service, io-service?
  • what about offering alb on internal services? alb-service is taken... alb-internal-service... ugh....

Seems to me we might have to think about a breaking change at some point to get this in with good logical naming, otherwise this project is going to be getting forked a lot because ALB is a huge improvement and while we really should try to support it in a somewhat non breaking manner, it's nearly impossible to ignore the fact that ELB doesn't support sockets at this point. I mean c'mon AWS, what were you thinking? Please accept this approach, my sanity depends on it.

Copy link
Contributor

@jalessio jalessio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noted a bunch of places where "ELB" looks like it should be "ALB" but now I'm not totally sure what the correct terminology is. Seems like "ALBs" are considered a type of "ELB"? In any case, I think using "ALB" across the board for this module would reduce confusion with the existing ELB module.

I'll give this a try -- I like this project but using a Classic ELB is non-starter for me.

@@ -0,0 +1,179 @@
/**
* The ELB module creates an ELB, security group
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/ELB/ALB/

*/

variable "name" {
description = "ELB name, e.g cdn"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/ELB/ALB/

}

variable "external_dns_name" {
description = "The subdomain under which the ELB is exposed externally, defaults to the task name"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/ELB/ALB/

}

variable "internal_dns_name" {
description = "The subdomain under which the ELB is exposed internally, defaults to the task name"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/ELB/ALB/

* Outputs.
*/

// The ELB name.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/ELB/ALB/

value = "${aws_alb.main.id}"
}

// The ELB dns_name.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/ELB/ALB/

value = "${aws_route53_record.internal.fqdn}"
}

// The zone id of the ELB
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/ELB/ALB/

@@ -0,0 +1,233 @@
/**
* The web-service is similar to the `service` module, but the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/web-service/alb-service/

* Usage:
*
* module "auth_service" {
* source = "github.com/segmentio/stack/service"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait, isn't this wrong here and in stack/master/web-service/main.tf? Seems like this line should be:

source    = "github.com/segmentio/stack/alb-service"

no?

}

variable "log_bucket" {
description = "S3 bucket name to write ELB logs into"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/ELB/ALB/

@kc-dot-io
Copy link
Author

@jalessio your comments are all valid. If this is an acceptable approach and we can agree on the caveats I listed, I'm happy to update the PR based on both comments and also fix the reference in web-service from your last comment.

@jalessio
Copy link
Contributor

@slajax I'm not affiliated with Segment or this project so I can't weigh in on whether the maintainers will find this to be an acceptable approach. For my purposes I could just drop ELB support altogether but I understand the need to maintain backward compatibility.

As far as how to structure this, on first pass it seems like one of these options would be nice:

  • rename this to "web-service-alb" instead of "alb-service" -- IMO this makes it clear that it's similar in functionality to the existing "web-service" module
  • better have a variable like elb_type which defaults to "classic" but can optionally accept "alb"(or maybe "application") to specify the type of load balancer you want. At some point in the future, maybe the default could be switched to "alb" as a breaking change? I admit to not yet being knowledgeable enough about Terraform to know how easy/hard that would be to implement.

@kc-dot-io
Copy link
Author

kc-dot-io commented Jun 23, 2017

@jalessio thanks for the feedback.

  • I agree, this sounds like better naming, will wait to see what maintainers think but I think this is a good compromise.

  • I originally wanted to implement it so I could dynamically source the load balancer type inside of the existing web-service based on a variable, while defaulting to elb but terraform doesn't support variables in source paths unfortunately, due to it's current order of operations. I think this is similar to the approach you are suggesting. If not, can you elaborate?

@jalessio jalessio mentioned this pull request Sep 9, 2017
@kc-dot-io
Copy link
Author

Just an update here. We also added alb to the internal service in our fork which we are actively maintaining. Feel free to hit us up if you are also working off a fork and want to share updates.

@pikeas
Copy link

pikeas commented Mar 13, 2018

@slajax Is https://github.com/HackCapital/stack your fork? The last update there is a few months older than your comment here...

@kc-dot-io
Copy link
Author

Yes that is the fork.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants