feat: move from gunicorn to waitress
Waitress, unlike unicorn, is multi-threaded. As it does not do access logs by default, the app needs to be wrapped in TransLogger before being passed to Waitress. To make the switch, a custom registry is now also used instead of the global REGISTRY as the default registry for the app. As part of this change, the default prometheus metrics are then also registered with this new registry. Closes: #72
This commit is contained in:
parent
ffe097b24f
commit
c50d341c26
4 changed files with 27 additions and 15 deletions
11
run_waitress.py
Normal file
11
run_waitress.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
import os
|
||||
from waitress import serve
|
||||
from paste.translogger import TransLogger
|
||||
from app.__init__ import app
|
||||
from flask_migrate import upgrade
|
||||
|
||||
# equivalent of running flask db upgrade
|
||||
with app.app_context():
|
||||
upgrade()
|
||||
|
||||
serve(TransLogger(app), host=os.environ["WAITRESS_RUN_HOST"], port=os.environ["WAITRESS_RUN_PORT"], threads=int(os.environ["WAITRESS_THREADS"]))
|
Loading…
Add table
Add a link
Reference in a new issue