-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.sh
executable file
·46 lines (41 loc) · 1.25 KB
/
start.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#! /usr/bin/env sh
set -e
uv run manage.py migrate
uv run manage.py collectstatic --noinput
HOST=${HOST:-"0.0.0.0"}
PORT=${PORT:-80}
WORKERS=${WORKERS:-2}
LIFESPAN=${LIFESPAN:-"off"}
LOG_LEVEL=${LOG_LEVEL:-"info"}
PROXY_HEADERS=${PROXY_HEADERS:-"on"}
FORWARDED_ALLOW_IPS=${FORWARDED_ALLOW_IPS:-"127.0.0.1"}
LIMIT_MAX_REQUESTS=${LIMIT_MAX_REQUESTS:-1000}
SSL_KEYFILE=${SSL_KEYFILE:-""}
SSL_CERTFILE=${SSL_CERTFILE:-""}
APP_MODULE=${APP_MODULE:-"app.asgi:application"}
echo "Uvicorn settings:"
echo "HOST: $HOST"
echo "PORT: $PORT"
echo "WORKERS: $WORKERS"
echo "LIFESPAN: $LIFESPAN"
echo "LOG_LEVEL: $LOG_LEVEL"
echo "PROXY_HEADERS: $PROXY_HEADERS"
echo "FORWARDED_ALLOW_IPS: $FORWARDED_ALLOW_IPS"
echo "LIMIT_MAX_REQUESTS: $LIMIT_MAX_REQUESTS"
echo "SSL_KEYFILE: $SSL_KEYFILE"
echo "SSL_CERTFILE: $SSL_CERTFILE"
echo "APP_MODULE: $APP_MODULE"
echo ""
exec uvicorn \
--host $HOST \
--port $PORT \
--workers $WORKERS \
--lifespan "$LIFESPAN" \
--log-level $LOG_LEVEL \
$( [ "$PROXY_HEADERS" = "on" ] && echo "--proxy-headers" ) \
--forwarded-allow-ips "$FORWARDED_ALLOW_IPS" \
--limit-max-requests $LIMIT_MAX_REQUESTS \
$( [ -n "$SSL_KEYFILE" ] && echo "--ssl-keyfile $SSL_KEYFILE" ) \
$( [ -n "$SSL_CERTFILE" ] && echo "--ssl-certfile $SSL_CERTFILE" ) \
"$APP_MODULE" \
"$@"