2023-09-01 01:30:53 +02:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
2024-02-19 01:03:01 +02:00
|
|
|
lib_path="/usr/lib/$(arch)-linux-gnu/libmimalloc.so.2"
|
2024-03-16 06:04:45 +02:00
|
|
|
# mimalloc seems to increase memory usage dramatically with openvino, need to investigate
|
2024-05-17 18:59:05 +02:00
|
|
|
if ! [ "$DEVICE" = "openvino" ]; then
|
2024-03-16 06:04:45 +02:00
|
|
|
export LD_PRELOAD="$lib_path"
|
|
|
|
export LD_BIND_NOW=1
|
2024-07-18 16:50:57 +02:00
|
|
|
: "${MACHINE_LEARNING_WORKER_TIMEOUT:=120}"
|
|
|
|
else
|
|
|
|
: "${MACHINE_LEARNING_WORKER_TIMEOUT:=300}"
|
2024-03-16 06:04:45 +02:00
|
|
|
fi
|
2023-09-01 01:30:53 +02:00
|
|
|
|
2024-05-17 18:59:05 +02:00
|
|
|
: "${IMMICH_HOST:=[::]}"
|
|
|
|
: "${IMMICH_PORT:=3003}"
|
2024-07-18 19:50:52 +02:00
|
|
|
: "${MACHINE_LEARNING_WORKERS:=1}"
|
2024-08-29 17:11:49 +02:00
|
|
|
: "${MACHINE_LEARNING_HTTP_KEEPALIVE_TIMEOUT_S:=2}"
|
2023-09-01 01:30:53 +02:00
|
|
|
|
|
|
|
gunicorn app.main:app \
|
2023-12-14 21:51:24 +02:00
|
|
|
-k app.config.CustomUvicornWorker \
|
2024-10-07 23:37:45 +02:00
|
|
|
-c gunicorn_conf.py \
|
2024-05-17 18:59:05 +02:00
|
|
|
-b "$IMMICH_HOST":"$IMMICH_PORT" \
|
2024-02-19 01:03:01 +02:00
|
|
|
-w "$MACHINE_LEARNING_WORKERS" \
|
|
|
|
-t "$MACHINE_LEARNING_WORKER_TIMEOUT" \
|
2023-12-14 21:51:24 +02:00
|
|
|
--log-config-json log_conf.json \
|
2024-08-29 17:11:49 +02:00
|
|
|
--keep-alive "$MACHINE_LEARNING_HTTP_KEEPALIVE_TIMEOUT_S" \
|
2023-12-14 21:51:24 +02:00
|
|
|
--graceful-timeout 0
|