-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_test_environment.sh
More file actions
executable file
·43 lines (33 loc) · 1013 Bytes
/
start_test_environment.sh
File metadata and controls
executable file
·43 lines (33 loc) · 1013 Bytes
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
echo "Starting test environment for Ranx reverse proxy"
echo "=============================================="
# Start the API server in the background
echo "Starting mock API server on port 3000..."
python3 ./mock_api_server.py &
API_PID=$!
# Start another API server (for load balancing) in the background
echo "Starting second mock API server on port 3001..."
python3 ./mock_api_server.py 3001 &
API2_PID=$!
# Start the web server in the background
echo "Starting mock web server on port 8000..."
python3 ./mock_web_server.py &
WEB_PID=$!
# Wait for servers to initialize
echo "Waiting for servers to initialize..."
sleep 2
# Start the proxy server
echo "Starting Ranx reverse proxy on port 8080..."
cargo run
# Cleanup function to kill background processes
cleanup() {
echo "Shutting down test environment..."
kill $API_PID $API2_PID $WEB_PID
exit 0
}
# Set up trap to catch Ctrl+C and cleanup
trap cleanup INT
# Wait for the proxy to exit
wait $PROXY_PID
# Clean up
cleanup