Add healthcheck to manuels

This commit is contained in:
Gabriel Augendre 2018-06-19 23:52:48 +02:00
parent 95e509c4c1
commit c309ef04f2
2 changed files with 17 additions and 0 deletions

View file

@ -16,6 +16,8 @@ COPY . ./
RUN chmod +x bash/run-prod.sh
CMD bash/run-prod.sh
HEALTHCHECK CMD ["pipenv", "run", "python", "healthcheck.py"]
ENV DATABASE_URL postgres://postgresql:postgresql@db:5432/manuels
ENV SECRET_KEY ''
ENV MAILGUN_ACCESS_KEY ''

15
healthcheck.py Normal file
View file

@ -0,0 +1,15 @@
import os
import sys
import requests
def main():
port = os.getenv('PORT', 8000)
res = requests.get(f'http://localhost:{port}/')
if res.status_code >= 400:
sys.exit(1)
if __name__ == '__main__':
main()