From 7c26020c80edb5e0483f095da54f470454531974 Mon Sep 17 00:00:00 2001 From: jo Date: Wed, 6 Jul 2022 17:25:04 +0200 Subject: [PATCH] feat(api): use uvicorn as asgi server with gunicorn --- api/install/systemd/libretime-api.service | 3 ++- api/install/systemd/libretime-api.socket | 2 +- api/packages.ini | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/api/install/systemd/libretime-api.service b/api/install/systemd/libretime-api.service index 6b3e38ad7..0a15a95a5 100644 --- a/api/install/systemd/libretime-api.service +++ b/api/install/systemd/libretime-api.service @@ -13,9 +13,10 @@ Environment=LIBRETIME_CONFIG_FILEPATH=@@CONFIG_FILEPATH@@ ExecStart=/usr/bin/gunicorn \ --workers 4 \ + --worker-class uvicorn.workers.UvicornWorker \ --log-file - \ --bind unix:/run/libretime-api.sock \ - libretime_api.wsgi + libretime_api.asgi ExecReload=/bin/kill -s HUP $MAINPID User=libretime Group=libretime diff --git a/api/install/systemd/libretime-api.socket b/api/install/systemd/libretime-api.socket index c145d5bd1..41f198019 100644 --- a/api/install/systemd/libretime-api.socket +++ b/api/install/systemd/libretime-api.socket @@ -5,7 +5,7 @@ PartOf=libretime-api.service [Socket] ListenStream=/run/libretime-api.sock SocketUser=@@DEFAULT_WEB_USER@@ -SocketMode=640 +SocketMode=660 [Install] WantedBy=sockets.target diff --git a/api/packages.ini b/api/packages.ini index 495cd3866..14d707b8f 100644 --- a/api/packages.ini +++ b/api/packages.ini @@ -4,6 +4,9 @@ python3 = buster, bullseye, bionic, focal python3-pip = buster, bullseye, bionic, focal gunicorn = buster, bullseye, bionic, focal python3-gunicorn = buster, bullseye, bionic, focal +python3-uvicorn = buster, bullseye, bionic, focal +python3-httptools = buster, bullseye, bionic, focal +python3-uvloop = buster, bullseye, bionic, focal [psycopg2] # See https://www.psycopg.org/docs/install.html#install-from-source