Hi Team,
We are currently working on a Frappe application running as containers on an AWS EC2 instance. We have attached an ALB to route the traffic to a target group (EC2 instance).
Issue: The health checks are failing. I can see the requests are reaching the EC2 instance container logs, but they are getting 404 responses.
frontend-1 | 172.31.43.179 - - [06/Jun/2024:02:44:33 +0000] "GET /api/method/frappe.handler.ping HTTP/1.1" 404 114 "-" "ELB-HealthChecker/2.0"
frontend-1 | 172.31.5.152 - - [06/Jun/2024:02:44:33 +0000] "GET /api/method/frappe.handler.ping HTTP/1.1" 404 114 "-" "ELB-HealthChecker/2.0"
frontend-1 | 172.31.43.179 - - [06/Jun/2024:02:45:03 +0000] "GET /api/method/frappe.handler.ping HTTP/1.1" 404 114 "-" "ELB-HealthChecker/2.0"
frontend-1 | 172.31.5.152 - - [06/Jun/2024:02:45:03 +0000] "GET /api/method/frappe.handler.ping HTTP/1.1" 404 114 "-" "ELB-HealthChecker/2.0"
frontend-1 | 172.31.43.179 - - [06/Jun/2024:02:45:33 +0000] "GET /api/method/frappe.handler.ping HTTP/1.1" 404 114 "-" "ELB-HealthChecker/2.0"
frontend-1 | 172.31.5.152 - - [06/Jun/2024:02:45:33 +0000] "GET /api/method/frappe.handler.ping HTTP/1.1" 404 114 "-" "ELB-HealthChecker/2.0"
When I run the same health check without the ALB, it returns a 200 response. However, with the ALB, the request results in a 404. Due to the failed health check, the application is not functioning correctly.
Observations: After SSHing into the instance and executing into both the frontend and backend containers, the result is the same:
http://localhost:8080/api/method/frappe.handler.ping - 404
Frappe version - 14
Docker compose:
name: ajna
services:
backend:
depends_on:
configurator:
condition: service_completed_successfully
required: true
image: XXXXXX.dkr.ecr.ap-south-1.amazonaws.com/shodana:v1.0.0
networks:
default: null
platform: linux/amd64
volumes:
- type: volume
source: sites
target: /home/frappe/frappe-bench/sites
volume: {}
configurator:
command:
- |
ls -1 apps > sites/apps.txt; bench set-config -g db_host $$DB_HOST; bench set-config -gp db_port $$DB_PORT; bench set-config -g redis_cache "redis://$$REDIS_CACHE"; bench set-config -g redis_queue "redis://$$REDIS_QUEUE"; bench set-config -g redis_socketio "redis://$$REDIS_QUEUE"; bench set-config -gp socketio_port $$SOCKETIO_PORT;
depends_on:
redis-cache:
condition: service_started
required: true
redis-queue:
condition: service_started
required: true
entrypoint:
- bash
- -c
environment:
DB_HOST: ajna-docker-rds.XXXXXX.amazonaws.com
DB_PORT: "3306"
REDIS_CACHE: redis-cache:6379
REDIS_QUEUE: redis-queue:6379
SOCKETIO_PORT: "9000"
image: XXXXXX.dkr.ecr.ap-south-1.amazonaws.com/shodana:v1.0.0
networks:
default: null
platform: linux/amd64
volumes:
- type: volume
source: sites
target: /home/frappe/frappe-bench/sites
volume: {}
frontend:
command:
- nginx-entrypoint.sh
depends_on:
backend:
condition: service_started
required: true
websocket:
condition: service_started
required: true
environment:
BACKEND: backend:8000
CLIENT_MAX_BODY_SIZE: 50m
FRAPPE_SITE_NAME_HEADER: $$host
PROXY_READ_TIMEOUT: "120"
SOCKETIO: websocket:9000
UPSTREAM_REAL_IP_ADDRESS: 127.0.0.1
UPSTREAM_REAL_IP_HEADER: X-Forwarded-For
UPSTREAM_REAL_IP_RECURSIVE: "off"
image: XXXXXX.dkr.ecr.ap-south-1.amazonaws.com/shodana:v1.0.0
networks:
default: null
platform: linux/amd64
ports:
- mode: ingress
target: 8080
published: "8080"
protocol: tcp
volumes:
- type: volume
source: sites
target: /home/frappe/frappe-bench/sites
volume: {}
queue-long:
command:
- bench
- worker
- --queue
- long,default,short
depends_on:
configurator:
condition: service_completed_successfully
required: true
image: XXXXXX.dkr.ecr.ap-south-1.amazonaws.com/shodana:v1.0.0
networks:
default: null
platform: linux/amd64
volumes:
- type: volume
source: sites
target: /home/frappe/frappe-bench/sites
volume: {}
queue-short:
command:
- bench
- worker
- --queue
- short,default
depends_on:
configurator:
condition: service_completed_successfully
required: true
image: XXXXXX.dkr.ecr.ap-south-1.amazonaws.com/shodana:v1.0.0
networks:
default: null
platform: linux/amd64
volumes:
- type: volume
source: sites
target: /home/frappe/frappe-bench/sites
volume: {}
redis-cache:
image: redis:6.2-alpine
networks:
default: null
volumes:
- type: volume
source: redis-cache-data
target: /data
volume: {}
redis-queue:
image: redis:6.2-alpine
networks:
default: null
volumes:
- type: volume
source: redis-queue-data
target: /data
volume: {}
scheduler:
command:
- bench
- schedule
depends_on:
configurator:
condition: service_completed_successfully
required: true
image: XXXXXX.dkr.ecr.ap-south-1.amazonaws.com/shodana:v1.0.0
networks:
default: null
platform: linux/amd64
volumes:
- type: volume
source: sites
target: /home/frappe/frappe-bench/sites
volume: {}
websocket:
command:
- node
- /home/frappe/frappe-bench/apps/frappe/socketio.js
depends_on:
configurator:
condition: service_completed_successfully
required: true
image: XXXXXX.dkr.ecr.ap-south-1.amazonaws.com/shodana:v1.0.0
networks:
default: null
platform: linux/amd64
volumes:
- type: volume
source: sites
target: /home/frappe/frappe-bench/sites
volume: {}
networks:
default:
name: ajna_default
volumes:
redis-cache-data:
name: ajna_redis-cache-data
redis-queue-data:
name: ajna_redis-queue-data
sites:
name: ajna_sites
x-backend-defaults:
depends_on:
configurator:
condition: service_completed_successfully
image: XXXXXX.dkr.ecr.ap-south-1.amazonaws.com/shodana:v1.0.0
volumes:
- sites:/home/frappe/frappe-bench/sites
x-customizable-image:
image: XXXXXX.dkr.ecr.ap-south-1.amazonaws.com/shodana:v1.0.0
x-depends-on-configurator:
depends_on:
configurator:
condition: service_completed_successfully
Any insights or suggestions to resolve this issue would be greatly appreciated!
@revant_one Could you please help.