johni
johni

Reputation: 5568

Fail deploying simple HTTP server to ElasticBeanstalk when using Application Load Balancer

I'm unable to deploy the simplest docker-compose file to an ElasticBeanstalk environment configured with Application Load Balancer for high-availability.

This is the docker file:

version: "3.9"

services:
  demo:
    image: nginxdemos/hello
    ports:
      - "80:80"
    restart: always

This is the ALB configuration: ALB configuration

EB Chain of events:

  1. Creating CloudWatch alarms and log groups
  2. Creating security groups
    1. For the load balancer
      1. Allow incoming traffic from the internet to my two listerners on ports 80/443
    2. For the EC2 machines
      1. Allow incoming traffic to the process port from the first security group created
  3. Create auto scaling groups
  4. Create Application Load Balancer
  5. Create EC2 instance

Approx. 10 minutes after creating the EC2 instance (#5), I get the following log:

Environment health has transitioned from Pending to Severe. ELB processes are not healthy on all instances. Initialization in progress (running for 12 minutes). None of the instances are sending data. 50.0 % of the requests to the ELB are failing with HTTP 5xx. Insufficient request rate (2.0 requests/min) to determine application health (6 minutes ago). ELB health is failing or not available for all instances.

Looking at the Target Group, it is indicating 0 healthy instances (based on the default healthchecks)

When SSH'ing the instance, I see that the docker service is not even started, and my application is not running. So that explains why the instance is unhealthy.

However, what am I supposed to do differently? based on the understanding I have, to me it looks like a bug in the flow initiated by ElasticBealstalk, as the flow is waiting for the instances to be healthy before starting my application (otherwise, why the application wasn't started in the 10 minutes after the EC2 instance was created?)

It doesn't seem like an application issue, because the docker service was not even started.

Appreciate your help.

Upvotes: 0

Views: 193

Answers (1)

Marcin
Marcin

Reputation: 238557

I tried to replicate your issue using your docker-compose.yml and Docker running on 64bit Amazon Linux 2/3.4.12 platform. For the test I created a zip file containing only the docker-compose.yml.

Everything works as expected and no issues were found.

The only thing I can suggest is to double check your files. Also there is no reason to use 443 as you don't have https at all.

Upvotes: 1

Related Questions