-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstart_api.sh
More file actions
executable file
·40 lines (35 loc) · 1.15 KB
/
Copy pathstart_api.sh
File metadata and controls
executable file
·40 lines (35 loc) · 1.15 KB
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
#!/usr/bin/env bash
# Kill any processes using port 8000
echo "Checking for processes using port 8000..."
if command -v lsof >/dev/null 2>&1; then
PIDS=$(lsof -ti:8000 2>/dev/null || true)
if [ ! -z "$PIDS" ]; then
echo "Found processes using port 8000: $PIDS"
echo "Killing processes..."
kill -9 $PIDS 2>/dev/null || true
sleep 2
echo "Processes killed."
else
echo "No processes found using port 8000."
fi
else
echo "lsof command not found, skipping port check."
fi
# Configuration
export HOST="127.0.0.1"
export PORT="8000"
export N_WORKERS="1"
export TIMEOUT="900" # 15 minutes (so workers don't timeout on long requests on llm pipeline hits)
echo "Starting Bank Processing API with UV:"
echo "Workers: ${N_WORKERS}"
echo "Host: ${HOST}"
echo "Port: ${PORT}"
echo "Timeout: ${TIMEOUT}"
# Sync dependencies with uv
uv sync
echo "Starting server..."
PYTHONPATH=. uv run gunicorn -w "${N_WORKERS}" \
-b "${HOST}:${PORT}" \
'main:application' \
--timeout "${TIMEOUT}" \
--log-level info