-
Notifications
You must be signed in to change notification settings - Fork 43
/
start.sh
executable file
·36 lines (26 loc) · 1.16 KB
/
start.sh
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
#!/bin/bash
set -e
source .env
# Set up Service Account Credentials
export GOOGLE_APPLICATION_CREDENTIALS="./service-account.json"
# Check if the credentials file exists
if [ ! -f "$GOOGLE_APPLICATION_CREDENTIALS" ]; then
echo "Error: Service Account Credentials file not found at $GOOGLE_APPLICATION_CREDENTIALS"
echo "Please ensure the service-account.json file is in the current directory if you are working outside developmentMode"
fi
echo "Starting Docker Compose..."
docker compose up -d
# Wait for postgres to be ready
echo "Waiting for postgres to be ready..."
until docker exec potpie_postgres pg_isready -U postgres; do
echo "Postgres is unavailable - sleeping"
sleep 2
done
echo "Postgres is up - applying database migrations"
# Apply database migrations
alembic upgrade head
echo "Starting momentum application..."
gunicorn --worker-class uvicorn.workers.UvicornWorker --workers 1 --timeout 1800 --bind 0.0.0.0:8001 --log-level debug app.main:app &
echo "Starting Celery worker"
# Start Celery worker with the new setup
celery -A app.celery.celery_app worker --loglevel=debug -Q "${CELERY_QUEUE_NAME}_process_repository" -E --concurrency=1 --pool=solo &