Spaces:
Sleeping
Sleeping
Update start.sh
Browse files
start.sh
CHANGED
|
@@ -1,19 +1,24 @@
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
| 3 |
-
#
|
| 4 |
echo "Lancement de Redis..."
|
| 5 |
redis-server --daemonize yes
|
| 6 |
sleep 2
|
| 7 |
|
| 8 |
-
#
|
| 9 |
echo "Lancement du worker Celery..."
|
|
|
|
| 10 |
python -m celery -A tasks.worker_celery:celery_app worker --loglevel=info &
|
| 11 |
|
| 12 |
-
#
|
| 13 |
echo "Lancement de l'API FastAPI..."
|
| 14 |
python -m uvicorn main:app --host 0.0.0.0 --port 8000 &
|
| 15 |
|
| 16 |
-
# ---
|
| 17 |
-
#
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|