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