Add healthcheck to manuels
This commit is contained in:
parent
95e509c4c1
commit
c309ef04f2
2 changed files with 17 additions and 0 deletions
|
@ -16,6 +16,8 @@ COPY . ./
|
||||||
RUN chmod +x bash/run-prod.sh
|
RUN chmod +x bash/run-prod.sh
|
||||||
CMD 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 DATABASE_URL postgres://postgresql:postgresql@db:5432/manuels
|
||||||
ENV SECRET_KEY ''
|
ENV SECRET_KEY ''
|
||||||
ENV MAILGUN_ACCESS_KEY ''
|
ENV MAILGUN_ACCESS_KEY ''
|
||||||
|
|
15
healthcheck.py
Normal file
15
healthcheck.py
Normal 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()
|
Loading…
Reference in a new issue