mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Docker: add .env configurable FASTAPI_BACKEND
By default we now use uvicorn because it has a much better developer feedback out of the box. We'll work on hypercorn logging, but for now, hypercorn is usable via: `docker-compose --env-file docker/hypercorn.env up nginx`. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
495dd2d821
commit
df161ef38e
6 changed files with 23 additions and 11 deletions
1
.env
Normal file
1
.env
Normal file
|
@ -0,0 +1 @@
|
|||
FASTAPI_BACKEND="uvicorn"
|
|
@ -17,7 +17,8 @@ RUN pacman -Syu --noconfirm --noprogressbar \
|
|||
python-requests python-aiofiles python-python-multipart \
|
||||
python-pytest-asyncio python-coverage hypercorn python-bcrypt \
|
||||
python-email-validator openssh python-lxml mariadb mariadb-libs \
|
||||
python-isort flake8 cgit uwsgi uwsgi-plugin-cgi php php-fpm
|
||||
python-isort flake8 cgit uwsgi uwsgi-plugin-cgi php php-fpm \
|
||||
python-asgiref uvicorn
|
||||
|
||||
RUN useradd -U -d /aurweb -c 'AUR User' aur
|
||||
|
||||
|
@ -30,4 +31,3 @@ ENV PYTHONPATH=/aurweb
|
|||
ENV AUR_CONFIG=conf/config
|
||||
|
||||
RUN make -C po all install
|
||||
RUN python setup.py install
|
||||
|
|
|
@ -124,9 +124,9 @@ services:
|
|||
environment:
|
||||
- AUR_CONFIG=conf/config
|
||||
entrypoint: /docker/fastapi-entrypoint.sh
|
||||
command: /docker/scripts/run-fastapi.sh
|
||||
command: /docker/scripts/run-fastapi.sh "${FASTAPI_BACKEND}"
|
||||
healthcheck:
|
||||
test: "bash /docker/health/fastapi.sh"
|
||||
test: "bash /docker/health/fastapi.sh ${FASTAPI_BACKEND}"
|
||||
interval: 2s
|
||||
timeout: 30s
|
||||
depends_on:
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#!/bin/bash
|
||||
exec pgrep hypercorn
|
||||
exec pgrep "$1"
|
||||
|
|
1
docker/hypercorn.env
Normal file
1
docker/hypercorn.env
Normal file
|
@ -0,0 +1 @@
|
|||
FASTAPI_BACKEND="hypercorn"
|
|
@ -3,9 +3,19 @@
|
|||
# Initialize the new database; ignore errors.
|
||||
python -m aurweb.initdb 2>/dev/null || /bin/true
|
||||
|
||||
exec hypercorn --reload \
|
||||
if [ "$1" == "uvicorn" ] || [ "$1" == "" ]; then
|
||||
exec uvicorn --reload \
|
||||
--ssl-certfile /cache/localhost.cert.pem \
|
||||
--ssl-keyfile /cache/localhost.key.pem \
|
||||
--log-config /docker/logging.conf \
|
||||
--host "0.0.0.0" \
|
||||
--port 8000 \
|
||||
aurweb.asgi:app
|
||||
else
|
||||
exec hypercorn --reload \
|
||||
--certfile /cache/localhost.cert.pem \
|
||||
--keyfile /cache/localhost.key.pem \
|
||||
--error-logfile - \
|
||||
--log-config docker/logging.conf \
|
||||
-b "0.0.0.0:8000" aurweb.asgi:app
|
||||
--log-config /docker/logging.conf \
|
||||
-b "0.0.0.0:8000" \
|
||||
aurweb.asgi:app
|
||||
fi
|
||||
|
|
Loading…
Add table
Reference in a new issue