QuentinL52 commited on
Commit
bb44c89
·
verified ·
1 Parent(s): d156418

Update start.sh

Browse files
Files changed (1) hide show
  1. start.sh +12 -7
start.sh CHANGED
@@ -1,19 +1,24 @@
1
  #!/bin/bash
2
 
3
- # Lancer le serveur Redis en arrière-plan
4
  echo "Lancement de Redis..."
5
  redis-server --daemonize yes
6
  sleep 2
7
 
8
- # Lancer le worker Celery en arrière-plan
9
  echo "Lancement du worker Celery..."
 
10
  python -m celery -A tasks.worker_celery:celery_app worker --loglevel=info &
11
 
12
- # Lancer l'API FastAPI (le backend modèle) en arrière-plan
13
  echo "Lancement de l'API FastAPI..."
14
  python -m uvicorn main:app --host 0.0.0.0 --port 8000 &
15
 
16
- # --- LA CORRECTION DÉFINITIVE ---
17
- # On dit à Gunicorn de se déplacer dans le dossier /app AVANT de chercher app:app
18
- echo "Lancement de l'application Flask sur le port 7860..."
19
- python -m gunicorn --chdir /app -w 1 --threads 8 --timeout 120 --bind 0.0.0.0:7860 app:app
 
 
 
 
 
1
  #!/bin/bash
2
 
3
+ # Start Redis in the background
4
  echo "Lancement de Redis..."
5
  redis-server --daemonize yes
6
  sleep 2
7
 
8
+ # Start the Celery worker in the background
9
  echo "Lancement du worker Celery..."
10
+ # We use python -m here as it's reliable for background tasks
11
  python -m celery -A tasks.worker_celery:celery_app worker --loglevel=info &
12
 
13
+ # Start the FastAPI API in the background
14
  echo "Lancement de l'API FastAPI..."
15
  python -m uvicorn main:app --host 0.0.0.0 --port 8000 &
16
 
17
+ # --- THE DEFINITIVE FIX ---
18
+ # 1. Change to the application directory. This is the crucial step.
19
+ cd /app || exit
20
+
21
+ # 2. Execute Gunicorn. 'exec' replaces the shell process with the gunicorn process.
22
+ # This is the main process of the container.
23
+ echo "Lancement de l'application Flask depuis le dossier /app..."
24
+ exec python -m gunicorn --bind 0.0.0.0:7860 --workers 1 --threads 8 --timeout 120 app:app