AWS App Runner health check fails on port 80 for Python app

642 Views Asked by At

I have Python app that process data and I am running it in Docker. Locally, it is working fine. When I tried for a first time to run on AWS App Runner I needed health check, so I expose 80 port in Dockerfile and install nginx that listen on that port. When I run container locally I can access the nginx homepage. With curl as well. Here is in addition my Dockerfile.

FROM python:3.9

ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

RUN  apt update &&  apt install nginx -y
COPY default /etc/nginx/sites-available/default

COPY requirements.txt .
RUN pip install -r requirements.txt


COPY . .
EXPOSE 80/tcp
COPY start.sh /start.sh
RUN chmod +x /start.sh
CMD ["/bin/bash", "/start.sh"]type here

I was trying to setup health check in AWS App Runner. I am using TCP check on port 80. For some reasons it is failing all the time.

Here is the setup for AWS App Runner: Source: Private ECR Deployment Settings: Manual Port: 80 Auto Scaling: Default Health Check: TCP (I tried various settings without success) Security: Use an AWS-owned key (no Instance role) Networking: Public access

Could you please give me some suggestions what could be the issue? Thank you in advance!

1

There are 1 best solutions below

2
On

Usually the health check is configured to the same port on which the application runs. It's unclear if that is port 80 or not.

Can you check if the application is showing any errors in AWS or has started up correctly?

Can you reach the application directly, when a health check is not configured?

My assumption is that there is something wrong with the application itself and not with the health-check.