From ad23bb0aa2ba45187d47628d3cc10318b502571e Mon Sep 17 00:00:00 2001 From: Bastian Blank Date: Fri, 8 Dec 2023 12:50:51 +0100 Subject: [PATCH] Use Hypercorn as production ASGI server The internal server in Quart is not supposed to be used for production. Use Hypercorn instead. --- Containerfile | 6 +++--- src/glvd/web/app.py | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 src/glvd/web/app.py diff --git a/Containerfile b/Containerfile index 2bd8d00..5a52fa4 100644 --- a/Containerfile +++ b/Containerfile @@ -3,9 +3,9 @@ FROM docker.io/library/debian:trixie-slim # XXX: Debian Experimental required for python3-sqlalchemy (>= 2) RUN sed -i -e 's/Suites: trixie trixie-updates/\0 experimental/' /etc/apt/sources.list.d/debian.sources RUN apt-get update && \ - apt-get upgrade -y --no-install-recommends python3-asyncpg python3-pip python3-poetry-core python3-quart python3-requests python3-sqlalchemy/experimental + apt-get upgrade -y --no-install-recommends python3-asyncpg python3-hypercorn python3-pip python3-poetry-core python3-quart python3-requests python3-sqlalchemy/experimental COPY . /usr/local/src RUN pip install --break-system-packages --no-deps --editable /usr/local/src -# TODO: The Quart internal server is only for development -CMD ["quart", "--app=glvd.web", "run", "--host=::"] +ENTRYPOINT ["hypercorn", "glvd.web.app:app"] +CMD [] diff --git a/src/glvd/web/app.py b/src/glvd/web/app.py new file mode 100644 index 0000000..7fc4632 --- /dev/null +++ b/src/glvd/web/app.py @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: MIT + +from . import create_app + + +app = create_app()