mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
change(docker): host fastapi over plain http
We don't need the https certificates being dealt with in the fastapi service; we will define our certificates in any frontend nginx running on top. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
d675c0dc26
commit
9f9b1c1732
2 changed files with 2 additions and 21 deletions
|
@ -23,7 +23,7 @@ http {
|
||||||
|
|
||||||
gzip on;
|
gzip on;
|
||||||
|
|
||||||
upstream hypercorn {
|
upstream asgi_backend {
|
||||||
server fastapi:8000;
|
server fastapi:8000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ http {
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
proxy_redirect off;
|
proxy_redirect off;
|
||||||
proxy_buffering off;
|
proxy_buffering off;
|
||||||
proxy_pass https://hypercorn;
|
proxy_pass http://asgi_backend;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
CERT=/data/localhost.cert.pem
|
|
||||||
KEY=/data/localhost.key.pem
|
|
||||||
|
|
||||||
# If production.{cert,key}.pem exists, prefer them. This allows
|
|
||||||
# user customization of the certificates that FastAPI uses.
|
|
||||||
if [ -f /data/production.cert.pem ]; then
|
|
||||||
CERT=/data/production.cert.pem
|
|
||||||
fi
|
|
||||||
if [ -f /data/production.key.pem ]; then
|
|
||||||
KEY=/data/production.key.pem
|
|
||||||
fi
|
|
||||||
|
|
||||||
# By default, set FASTAPI_WORKERS to 2. In production, this should
|
# By default, set FASTAPI_WORKERS to 2. In production, this should
|
||||||
# be configured by the deployer.
|
# be configured by the deployer.
|
||||||
if [ -z ${FASTAPI_WORKERS+x} ]; then
|
if [ -z ${FASTAPI_WORKERS+x} ]; then
|
||||||
|
@ -28,16 +15,12 @@ alembic upgrade head
|
||||||
|
|
||||||
if [ "$1" == "uvicorn" ] || [ "$1" == "" ]; then
|
if [ "$1" == "uvicorn" ] || [ "$1" == "" ]; then
|
||||||
exec uvicorn --reload \
|
exec uvicorn --reload \
|
||||||
--ssl-certfile "$CERT" \
|
|
||||||
--ssl-keyfile "$KEY" \
|
|
||||||
--log-config /docker/logging.conf \
|
--log-config /docker/logging.conf \
|
||||||
--host "0.0.0.0" \
|
--host "0.0.0.0" \
|
||||||
--port 8000 \
|
--port 8000 \
|
||||||
aurweb.asgi:app
|
aurweb.asgi:app
|
||||||
elif [ "$1" == "gunicorn" ]; then
|
elif [ "$1" == "gunicorn" ]; then
|
||||||
exec gunicorn \
|
exec gunicorn \
|
||||||
--keyfile="$KEY" \
|
|
||||||
--certfile="$CERT" \
|
|
||||||
--log-config /docker/logging.conf \
|
--log-config /docker/logging.conf \
|
||||||
--bind "0.0.0.0:8000" \
|
--bind "0.0.0.0:8000" \
|
||||||
-w $FASTAPI_WORKERS \
|
-w $FASTAPI_WORKERS \
|
||||||
|
@ -45,8 +28,6 @@ elif [ "$1" == "gunicorn" ]; then
|
||||||
aurweb.asgi:app
|
aurweb.asgi:app
|
||||||
elif [ "$1" == "hypercorn" ]; then
|
elif [ "$1" == "hypercorn" ]; then
|
||||||
exec hypercorn --reload \
|
exec hypercorn --reload \
|
||||||
--certfile "$CERT" \
|
|
||||||
--keyfile "$KEY" \
|
|
||||||
--log-config /docker/logging.conf \
|
--log-config /docker/logging.conf \
|
||||||
-b "0.0.0.0:8000" \
|
-b "0.0.0.0:8000" \
|
||||||
aurweb.asgi:app
|
aurweb.asgi:app
|
||||||
|
|
Loading…
Add table
Reference in a new issue