-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathentrypoint.sh
executable file
·47 lines (40 loc) · 1.26 KB
/
entrypoint.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
47
#!/bin/bash
set -euo pipefail
# Configurazione predefinita
WORKERS=3
TIMEOUT=240
MAXREQUESTS=2000
MAXRJITTER=5
GRACEFULTIMEOUT=60
# Analisi degli argomenti della riga di comando (solo --help)
myargs=$(getopt --name "$0" -o h --long "help" -- "$@")
eval set -- "$myargs"
while true; do
case "$1" in
-h|--help)
echo "usage $0 --help"
exit 0
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
--)
shift
break
;;
esac
done
# Verifica dell'installazione di Gunicorn
if ! command -v gunicorn &> /dev/null; then
echo "Error: Gunicorn is not installed."
exit 1
fi
# Verifica esistenza file di log
if [ ! -f "log_conf.json" ]; then
echo "Error: log_conf.json file not found"
exit 1
fi
# Avvio di Gunicorn
echo "Starting Gunicorn with workers: $WORKERS, timeout: $TIMEOUT, max requests: $MAXREQUESTS, max jitter: $MAXRJITTER, graceful timeout: $GRACEFULTIMEOUT"
gunicorn --bind 0.0.0.0:8000 --workers "$WORKERS" --timeout "$TIMEOUT" --max-requests "$MAXREQUESTS" --max-requests-jitter "$MAXRJITTER" --graceful-timeout "$GRACEFULTIMEOUT" --log-config-json log_conf.json --worker-class uvicorn.workers.UvicornWorker tilelite.__main__:app