hnsw-tuner / entrypoint.sh
raduvespa's picture
suppress http logging; back to 100K docs
53f5e50
Raw History Blame Contribute Delete
1.32 kB
#!/usr/bin/env bash
# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
set -euo pipefail
cd /app
VESPA_PID=""
APP_PID=""
export VESPA_CONFIGSERVERS="${VESPA_CONFIGSERVERS:-$(hostname)}"
shutdown() {
if [[ -n "$APP_PID" ]] && kill -0 "$APP_PID" 2>/dev/null; then
kill "$APP_PID" 2>/dev/null || true
fi
if [[ -n "$VESPA_PID" ]] && kill -0 "$VESPA_PID" 2>/dev/null; then
kill "$VESPA_PID" 2>/dev/null || true
fi
if [[ -n "$APP_PID" ]]; then
wait "$APP_PID" 2>/dev/null || true
fi
if [[ -n "$VESPA_PID" ]]; then
wait "$VESPA_PID" 2>/dev/null || true
fi
}
trap 'shutdown; exit 1' TERM INT
/usr/local/bin/start-container.sh configserver,services &
VESPA_PID=$!
until curl -sf http://localhost:19071/state/v1/health >/dev/null 2>&1; do
if ! kill -0 "$VESPA_PID" 2>/dev/null; then
set +e
wait "$VESPA_PID"
exit_code=$?
set -e
exit "$exit_code"
fi
sleep 2
done
export VESPA_URL=http://localhost
export VESPA_PORT=8080
export PORT=7860
export DATA_DIR="${DATA_DIR:-/data}"
export DATASET_SIZE="${DATASET_SIZE:-mid}"
/opt/venv/bin/python app.py &
APP_PID=$!
set +e
wait -n "$VESPA_PID" "$APP_PID"
exit_code=$?
set -e
shutdown
exit "$exit_code"