-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·78 lines (66 loc) · 2.49 KB
/
Copy pathentrypoint.sh
File metadata and controls
executable file
·78 lines (66 loc) · 2.49 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/sh
set -e
# Function to handle cleanup on exit
cleanup() {
local exit_code=$?
echo ""
echo "==============================================================================="
if [ $exit_code -eq 0 ]; then
echo "✅ Container shutdown completed"
else
echo "❌ Container exited with error (code: $exit_code)"
fi
echo "==============================================================================="
exit $exit_code
}
# Set up signal handlers for graceful shutdown
trap cleanup EXIT
trap 'echo "🛑 Received SIGTERM, shutting down..."; exit 143' TERM
trap 'echo "🛑 Received SIGINT, shutting down..."; exit 130' INT
# Change to the application directory
cd /deps/lets-talk
# echo "📍 Working directory: $(pwd)"
# echo "👤 Running as user: $(id)"
# echo "🐍 Python version: $(python --version)"
# echo ""
# echo "🔧 Running application startup script..."
if ! python startup_application.py; then
echo ""
echo "❌ Application startup failed!"
echo "🚫 Cannot proceed with web server startup"
echo "💡 Check the logs above for specific error details"
echo ""
echo "Common issues:"
echo " • Database connection problems"
echo " • Missing environment variables"
echo " • Migration failures"
echo " • File permission issues"
exit 1
fi
echo ""
echo "✅ Application initialization completed successfully"
# Phase 2: Execute the original entrypoint or command
echo ""
echo "==============================================================================="
echo "🌐 Phase 2: LangGraph API Startup"
echo "==============================================================================="
# Check if there's a custom entrypoint script to run
if [ -f "/storage/entrypoint.sh" ] && [ -x "/storage/entrypoint.sh" ]; then
echo "📝 Executing LangGraph entrypoint..."
exec /storage/entrypoint.sh "$@"
else
echo "📝 No custom entrypoint found, proceeding with default startup"
# If no arguments provided, start the default langgraph server
if [ $# -eq 0 ]; then
echo "🚀 Starting LangGraph API server..."
echo "📡 Server will be available on port 8000"
echo "📚 API documentation at http://localhost:8000/docs"
echo ""
# Start the langgraph API server (this is the default from the base image)
exec python -m langgraph_api.api
else
# Execute the provided command
echo "🔧 Executing provided command: $*"
exec "$@"
fi
fi