ashwinR commited on
Commit
e9fa6d9
1 Parent(s): 2d6ff0f

Update start.sh

Browse files
Files changed (1) hide show
  1. start.sh +15 -4
start.sh CHANGED
@@ -1,13 +1,24 @@
1
  #!/bin/bash
2
 
3
- # Wait for PostgreSQL to become ready
4
- while ! pg_isready -q -h localhost -p 5432 -U postadmin; do
5
- echo "$(date) - waiting for database to start"
 
 
 
 
 
 
6
  sleep 2
7
  done
8
 
 
 
 
 
 
9
  # Run migrations
10
  alembic upgrade head
11
 
12
  # Start the FastAPI app using Uvicorn
13
- uvicorn app:app --host 0.0.0.0 --port 7860
 
1
  #!/bin/bash
2
 
3
+ # Start Redis
4
+ service redis-server start
5
+
6
+ # Start PostgreSQL
7
+ service postgresql start
8
+
9
+ # Wait for PostgreSQL to start
10
+ until pg_isready -U postgres; do
11
+ echo "Waiting for PostgreSQL..."
12
  sleep 2
13
  done
14
 
15
+ # Create user and database
16
+ sudo -u postgres psql -c "CREATE USER postadmin WITH PASSWORD 'postpass';"
17
+ sudo -u postgres psql -c "CREATE DATABASE siksalaya;"
18
+ sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE siksalaya TO postadmin;"
19
+
20
  # Run migrations
21
  alembic upgrade head
22
 
23
  # Start the FastAPI app using Uvicorn
24
+ uvicorn app:app --host 0.0.0.0 --port 7860