From db058cfc7f5295fbcf572ebb6b54693d098c87a4 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Thu, 4 Dec 2025 14:38:47 -0500 Subject: [PATCH] Fix entrypoint.sh bind address in IPV4 only cases --- scripts/entrypoint.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index 31b616e..f8cb89f 100755 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -13,7 +13,13 @@ echo "" echo Booting... touch /tmp/booting.flag -if [ -f ./venv/bin/libretranslate ]; then +BIND_ADDR="0.0.0.0" +IPV6_STATUS=$(cat /proc/sys/net/ipv6/conf/all/disable_ipv6) +if [[ $IPV6_STATUS -eq 0 ]]; then + BIND_ADDR="[::]" +fi + +if [[ -f ./venv/bin/libretranslate ]]; then LT_POWERCYCLE=1 ./venv/bin/libretranslate "$@" else echo "WARNING: Cannot powercycle LibreTranslate (if you are in development mode, that's fine..)" @@ -22,5 +28,5 @@ fi rm -f /tmp/booting.flag eval $(./venv/bin/python ./scripts/print_args_env.py "$@") -PROMETHEUS_MULTIPROC_DIR="${__dirname}/../db/prometheus" ./venv/bin/gunicorn -c scripts/gunicorn_conf.py --workers $LT_THREADS --max-requests 250 --timeout 2400 --bind [::]:$LT_PORT 'wsgi:app' +PROMETHEUS_MULTIPROC_DIR="${__dirname}/../db/prometheus" ./venv/bin/gunicorn -c scripts/gunicorn_conf.py --workers $LT_THREADS --max-requests 250 --timeout 2400 --bind $BIND_ADDR:$LT_PORT 'wsgi:app'