0
0
Fork 0
mirror of https://github.com/healthchecks/healthchecks.git synced 2025-04-08 06:30:05 +00:00

Update Dockerfile to report container health in docker ps

This commit adds a HEALTHCHECK instruction in Dockerfile.
The HEALTHCHECK instruction calls /docker/fetchstatus.sh
which in turn makes a HTTP request to
http://localhost:8000/api/v3/status/
This endpoint makes a test database query and returns non-200
response if the query fails. So, in short, if the Healthchecks
container for any reason is unable to query database, `docker ps`
will now show the container as "unhealthy".

cc: 
This commit is contained in:
Pēteris Caune 2024-08-19 10:17:05 +03:00
parent 70b55a777b
commit 8fed685f12
No known key found for this signature in database
GPG key ID: E28D7679E9A9EDE2
3 changed files with 3 additions and 0 deletions

View file

@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file.
- Update the "Set Password" page to reject very weak passwords
- Implement search by slug in the checks list (#1048)
- Add support for $SLUG placeholder in webhook payloads (#1049)
- Update Dockerfile to use HEALTHCHECK instruction and report container health (#1045)
### Bug Fixes
- Fix Check.ping() to lock the check before updating (#1023)

View file

@ -43,4 +43,5 @@ RUN mkdir /data && chown hc /data
USER hc
ENV USE_GZIP_MIDDLEWARE=True
HEALTHCHECK --interval=10s --start-period=10s --retries=1 CMD /opt/healthchecks/docker/fetchstatus.sh
CMD [ "uwsgi", "/opt/healthchecks/docker/uwsgi.ini"]

1
docker/fetchstatus.sh Executable file
View file

@ -0,0 +1 @@
python -c "from urllib.request import urlopen; urlopen('http://localhost:8000/api/v3/status/')"