-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_all.sh
More file actions
executable file
·37 lines (31 loc) · 1.23 KB
/
run_all.sh
File metadata and controls
executable file
·37 lines (31 loc) · 1.23 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
#!/bin/bash
# check if mongodb docker container is running and start with docker compose docker/mongodb-docker-compose.yml
MONGO_CONTAINER_NAME="mongo"
echo "Starting MongoDB container..."
echo "Checking if MongoDB container is running..."
if ! docker ps | grep -q "$MONGO_CONTAINER_NAME"; then
echo "Starting MongoDB container..."
docker compose -f docker/mongodb-docker-compose.yaml up -d
echo "MongoDB container started"
echo "Waiting for MongoDB container to be ready..."
sleep 10
echo "MongoDB container is ready"
else
echo "MongoDB container is already running"
fi
# stop existing application if running
echo "--------------------------------"
echo "checking if application is running..."
echo "Stopping existing application if running..."
pkill -f "uvicorn main:app"
# wait for the process to stop
sleep 2
# start FastAPI application with uvicorn integrated Gradio Application
echo "--------------------------------"
echo "Starting application..."
echo "--------------------------------"
uv run uvicorn main:app --host 0.0.0.0 --port 7860 --reload
# catch SIGINT (Ctrl+C) to stop the application gracefully
trap "echo 'Stopping application...'; pkill -f 'uvicorn main:app'; exit" INT
# wait for the application to run
wait