-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrender-start.sh
More file actions
executable file
Β·43 lines (32 loc) Β· 1.16 KB
/
render-start.sh
File metadata and controls
executable file
Β·43 lines (32 loc) Β· 1.16 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
41
42
43
#!/bin/bash
# Render startup script for ETI RAG System
set -e
echo "π Starting ETI RAG System on Render..."
# Check if OPENAI_API_KEY is set
if [ -z "$OPENAI_API_KEY" ]; then
echo "β Error: OPENAI_API_KEY environment variable is required"
exit 1
fi
# Check if indexes exist, if not run ingestion
if [ ! -f "/var/data/index/meta_full.json" ] && [ ! -f "/var/data/index/metadata.json" ]; then
echo "π No indexes found. Running initial ingestion..."
# Find the HR manual PDF
HR_MANUAL=$(find /app/data -name "*.pdf" | head -1)
if [ -z "$HR_MANUAL" ]; then
echo "β Error: No PDF found in data directory"
exit 1
fi
echo "π Processing: $HR_MANUAL"
python /app/scripts/ingest.py --pdf-path "$HR_MANUAL" --output-dir /var/data/index
if [ $? -eq 0 ]; then
echo "β
Ingestion completed successfully"
else
echo "β Ingestion failed"
exit 1
fi
else
echo "β
Indexes found, skipping ingestion"
fi
echo "π Starting Gunicorn server..."
# Start with Gunicorn as specified in brief
exec gunicorn -k uvicorn.workers.UvicornWorker -w 2 -b 0.0.0.0:8080 app.main:app