File tree 1 file changed +50
-0
lines changed
1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Startup script for the AI Wrapper for OpenAI Requests MVP
4
+
5
+ set -e
6
+
7
+ echo " Starting AI Wrapper for OpenAI Requests MVP..."
8
+
9
+ # Source environment variables from .env
10
+ if [ -f .env ]; then
11
+ source .env
12
+ fi
13
+
14
+ # Start the backend service (FastAPI/Uvicorn)
15
+ echo " Starting backend service..."
16
+ uvicorn main:app --reload &
17
+
18
+ # Start the database service (PostgreSQL)
19
+ echo " Starting database service..."
20
+ docker-compose up -d db &
21
+
22
+ # Wait for services to start
23
+ sleep 5
24
+
25
+ # Check if services are running
26
+ echo " Checking if services are running..."
27
+ if [[ $( docker ps -aqf " name=db" ) ]]; then
28
+ echo " Database service started."
29
+ else
30
+ echo " Error: Database service failed to start."
31
+ exit 1
32
+ fi
33
+
34
+ if [[ $( pg_isready -h localhost -p 5432 -U user) ]]; then
35
+ echo " Database connection established."
36
+ else
37
+ echo " Error: Database connection failed."
38
+ exit 1
39
+ fi
40
+
41
+ # Check if the backend service is listening on port 8000
42
+ if [[ $( nc -z localhost 8000) ]]; then
43
+ echo " Backend service started."
44
+ else
45
+ echo " Error: Backend service failed to start."
46
+ exit 1
47
+ fi
48
+
49
+ echo " AI Wrapper for OpenAI Requests MVP started successfully."
50
+ echo " Access the API at http://localhost:8000/"
You can’t perform that action at this time.
0 commit comments