diff --git a/entrypoint.sh b/entrypoint.sh index 8a536945d..778893860 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -14,11 +14,11 @@ if [[ ! -z $1 ]]; then if [[ "$1" == "vmaas-sync" ]]; then exec python3 -m vmaas_sync.vmaas_sync elif [[ "$1" == "manager" ]]; then - exec gunicorn -c manager/gunicorn_conf.py -w ${GUNICORN_WORKERS:-4} -k uvicorn.workers.UvicornWorker --bind=0.0.0.0:$(public_port) --bind=0.0.0.0:$(metrics_port) --timeout=60 --limit-request-field_size=65535 manager.main + exec gunicorn -c manager/gunicorn_conf.py -w ${GUNICORN_WORKERS:-4} --bind=0.0.0.0:$(public_port) --bind=0.0.0.0:$(metrics_port) --timeout=60 --limit-request-field_size=65535 manager.main elif [[ "$1" == "manager-dev" ]]; then - exec gunicorn --reload -c manager/gunicorn_conf.py -w ${GUNICORN_WORKERS:-4} -k uvicorn.workers.UvicornWorker --bind=0.0.0.0:$(public_port) --bind=0.0.0.0:$(metrics_port) --timeout=60 --limit-request-field_size=65535 manager.main + exec gunicorn --reload -c manager/gunicorn_conf.py -w ${GUNICORN_WORKERS:-4} --bind=0.0.0.0:$(public_port) --bind=0.0.0.0:$(metrics_port) --timeout=60 --limit-request-field_size=65535 manager.main elif [[ "$1" == "manager-admin" ]]; then - exec gunicorn -c manager/gunicorn_conf.py -w ${GUNICORN_WORKERS:-4} -k uvicorn.workers.UvicornWorker --bind=0.0.0.0:$(public_port) --bind=0.0.0.0:$(metrics_port) --timeout=60 --limit-request-field_size=65535 manager.admin + exec gunicorn -c manager/gunicorn_conf.py -w ${GUNICORN_WORKERS:-4} --bind=0.0.0.0:$(public_port) --bind=0.0.0.0:$(metrics_port) --timeout=60 --limit-request-field_size=65535 manager.admin elif [[ "$1" == "taskomatic" ]]; then exec python3 -m taskomatic.taskomatic elif [[ "$1" == "notificator" ]]; then diff --git a/manager/main.py b/manager/main.py index 1814737d5..f8a919790 100755 --- a/manager/main.py +++ b/manager/main.py @@ -6,6 +6,7 @@ from traceback import format_exc import connexion +from a2wsgi import ASGIMiddleware from connexion import context from connexion.options import SwaggerUIOptions from connexion.resolver import RestyResolver @@ -117,7 +118,7 @@ def _on_first_request(): app.add_middleware(ErrorHandlerMiddleware, position=connexion.middleware.MiddlewarePosition.BEFORE_EXCEPTION) - return app + return ASGIMiddleware(app) init_logging(num_servers=int(CFG.gunicorn_workers)) diff --git a/tests/manager_tests/conftest.py b/tests/manager_tests/conftest.py index 4e14de117..7e29a5e4f 100644 --- a/tests/manager_tests/conftest.py +++ b/tests/manager_tests/conftest.py @@ -112,7 +112,7 @@ def feature_is_enabled(feature_name, context=None, fallback_function=None): @pytest.fixture def client(app): - with app.test_client() as client: + with app.app.test_client() as client: yield client