Add healthcheck program
This commit is contained in:
parent
a202e062de
commit
c80837f481
1 changed files with 20 additions and 0 deletions
20
discord_rss_bot/healthcheck.py
Normal file
20
discord_rss_bot/healthcheck.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
"""This is used as a healthcheck in the Dockerfile.
|
||||
The normal way would probably be to use CURL, but then we would have to install it."""
|
||||
|
||||
import sys
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
def healthcheck():
|
||||
"""Check if the website is up."""
|
||||
try:
|
||||
r = requests.get("http://localhost:5000")
|
||||
if r.ok:
|
||||
sys.exit(1)
|
||||
except requests.exceptions.RequestException:
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
healthcheck()
|
||||
Loading…
Add table
Add a link
Reference in a new issue