Skip to content

Commit

Permalink
Adding healtchecks for API pods via cron
Browse files Browse the repository at this point in the history
  • Loading branch information
gtramonte committed Jul 30, 2024
1 parent 15dbb9c commit 0e129e9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
ARG REGISTRY=rg.fr-par.scw.cloud/geolake
ARG TAG=latest
FROM $REGISTRY/geolake-datastore:$TAG

RUN apt update && apt install -y cron

WORKDIR /app
COPY requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
COPY app /app
EXPOSE 80

COPY ./healtcheck.* /opt/

RUN chmod +x /opt/healtcheck.sh
RUN crontab -u root /opt/healtcheck.cron
RUN service cron start

CMD ["uvicorn", "app.main:app", "--proxy-headers", "--host", "0.0.0.0", "--port", "80"]
1 change: 1 addition & 0 deletions api/healtcheck.cron
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*/10 * * * * bash -c '/opt/healtcheck.sh'
1 change: 1 addition & 0 deletions api/healtcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
curl https://hc-ping.com/$HEALTCHECKS

0 comments on commit 0e129e9

Please sign in to comment.