layer0
layer0 copied to clipboard
Dynamic Port Mapping through Support App LB / Application Entities
Opening up path to deliver dynamic port mapping, currently possibly through ALB or Consul.
Current ALB only supports HTTP, with TCP support coming.
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
routespecified;443/HTTPSin this example. Theprivatefield specifies if the ALB is internet-facing or not (same as how we use ELBs today). - A Target Group for the
routespecified;guestbook:80in this example. Note that we would terminate all SSL connection on the target group level (the same thing we do with ELBs today), so the443:80/HTTPSroute is80/HTTPon the target group. Each target group would also use the specified health_check;/healthin 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
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.