0

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.

johni
  • 5,342
  • 6
  • 42
  • 70

1 Answers1

1

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.

Marcin
  • 215,873
  • 14
  • 235
  • 294
  • You might have solved the issue, which is packing the docker compose file in a zip, something I didn’t. I’ll let you know soon. Thanks! – johni Mar 05 '22 at 14:26
  • It wasn't the issue @marcin. and it is worth saying that the same files were used to successfully set up an EB environment running on a single instance (no LB). Can you share the full configuration you've set? – johni Mar 05 '22 at 17:58
  • looking further, it seems related to deploying the environment in a new VPC that I've configured for this service. I'll have to dig further on that. So far the app is deployed successfully on the default VPC. – johni Mar 05 '22 at 18:27
  • @johni I did not change anything in EB. Just uploaded the zip and created the environment. – Marcin Mar 05 '22 at 22:47