Mercurial > code > home > repos > pi_mqtt
changeset 4:759f0ba7d345
crash (and get restarted) better
author | drewp@bigasterisk.com |
---|---|
date | Sat, 23 Mar 2024 16:15:34 -0700 |
parents | 0cc41259fddd |
children | 492eef562a88 |
files | deploy.yaml pi_mqtt.py |
diffstat | 2 files changed, 5 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/deploy.yaml Sun Dec 10 17:26:52 2023 -0800 +++ b/deploy.yaml Sat Mar 23 16:15:34 2024 -0700 @@ -44,11 +44,8 @@ command: - pdm - run - - uvicorn - - '--port=8001' - - '--host=0.0.0.0' - - '--reload' - - 'pi_mqtt:app' + - python + - 'pi_mqtt.py' --- apiVersion: v1 kind: Service
--- a/pi_mqtt.py Sun Dec 10 17:26:52 2023 -0800 +++ b/pi_mqtt.py Sat Mar 23 16:15:34 2024 -0700 @@ -4,6 +4,7 @@ import background_loop import pigpio +import uvicorn from prometheus_client import Gauge from starlette.applications import Starlette from starlette.requests import Request @@ -18,6 +19,7 @@ lastSuccessfulPoll = time.time() + def health(request: Request) -> PlainTextResponse: if time.time() - lastSuccessfulPoll > 10: return PlainTextResponse('err', status_code=500) @@ -60,4 +62,4 @@ return app -app = main() +uvicorn.run(main, host="0.0.0.0", port=8001, log_level=logging.INFO, factory=True)