layer0 icon indicating copy to clipboard operation
layer0 copied to clipboard

Dynamic Port Mapping through Support App LB / Application Entities

Open tribaljack opened this issue 8 years ago • 2 comments
trafficstars

Opening up path to deliver dynamic port mapping, currently possibly through ALB or Consul.

Current ALB only supports HTTP, with TCP support coming.

tribaljack avatar Mar 03 '17 01:03 tribaljack

I propose we introduce a new entity, application, that encapsulates both a service and an application loadbalancer. The terraform design would look something like:

resource "layer0_application" "guestbook" {
    name        = "guestbook"
    environment = "${layer0_environment.demo.id}"
    deploy      = "${layer0_deploy.guestbook.id}"
    scale       = 3
    private     = false

    route {
        host_port      = 443
        container_name = "guestbook"
        container_port = 80
        protocol       = "https"
        certificate_id = "{var.certificate_id}"
        health_check   = "/health"
    }
}

The example above would create the following resources:

  • An ALB inside the Layer0 environment with a listener for the route specified; 443/HTTPS in this example. The private field specifies if the ALB is internet-facing or not (same as how we use ELBs today).
  • A Target Group for the route specified; guestbook:80 in this example. Note that we would terminate all SSL connection on the target group level (the same thing we do with ELBs today), so the 443:80/HTTPS route is 80/HTTP on the target group. Each target group would also use the specified health_check; /health in this example.
  • A layer0 service named guestbook. This service would configured to use the ALB we created above.

The CLI could look something like:

$ l0 application get *
SERVICE ID    SERVICE NAME  ENVIRONMENT  ROUTE                   DEPLOYMENTS  SCALE
guestbook123  guestbook     dev          443:guestbook:80/HTTPS  guestbook:1  1/1

$ l0 application create --route 443:guestbook:80/HTTPS --health-check "/" demo guestbook guestbook:latest

zpatrick avatar Mar 08 '17 21:03 zpatrick

dunno if this this the right issue to comment on for ALB support, but this would be a really nice to have for WebSockets.

just learned that ELBs don't really support WebSockets for a number of reasons (affinity, protocols, headers, etc.)

  • https://mixmax.com/blog/deploying-meteor-to-elastic-beanstalk-1

ALB has much better support here, so would unlock some scenarios for us.

andycmaj avatar Dec 21 '17 23:12 andycmaj