Spaces:
Running
Running
Anish-530 commited on
Commit ·
ef1f114
1
Parent(s): 8a0d65c
Fix Render pricing: Combine web and worker into single free instance
Browse files- backend/start.sh +9 -0
- render.yaml +2 -38
backend/start.sh
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Start the Celery worker in the background
|
| 4 |
+
echo "Starting Celery worker..."
|
| 5 |
+
celery -A app.worker.celery_app worker --loglevel=info -P solo &
|
| 6 |
+
|
| 7 |
+
# Start the FastAPI server in the foreground
|
| 8 |
+
echo "Starting FastAPI server..."
|
| 9 |
+
uvicorn main:app --host 0.0.0.0 --port $PORT --forwarded-allow-ips='*' --proxy-headers
|
render.yaml
CHANGED
|
@@ -2,8 +2,9 @@ services:
|
|
| 2 |
- type: web
|
| 3 |
name: spotix-api
|
| 4 |
env: python
|
|
|
|
| 5 |
buildCommand: "cd backend && pip install -r requirements.txt"
|
| 6 |
-
startCommand: "cd backend &&
|
| 7 |
envVars:
|
| 8 |
- key: DATABASE_URL
|
| 9 |
sync: false
|
|
@@ -25,40 +26,3 @@ services:
|
|
| 25 |
sync: false
|
| 26 |
- key: R2_BUCKET_NAME
|
| 27 |
sync: false
|
| 28 |
-
|
| 29 |
-
- type: worker
|
| 30 |
-
name: spotix-celery
|
| 31 |
-
env: python
|
| 32 |
-
buildCommand: "cd backend && pip install -r requirements.txt"
|
| 33 |
-
startCommand: "cd backend && celery -A app.worker.celery_app worker --loglevel=info -P solo"
|
| 34 |
-
envVars:
|
| 35 |
-
- key: DATABASE_URL
|
| 36 |
-
fromService:
|
| 37 |
-
type: web
|
| 38 |
-
name: spotix-api
|
| 39 |
-
envVarKey: DATABASE_URL
|
| 40 |
-
- key: REDIS_URL
|
| 41 |
-
fromService:
|
| 42 |
-
type: web
|
| 43 |
-
name: spotix-api
|
| 44 |
-
envVarKey: REDIS_URL
|
| 45 |
-
- key: R2_ENDPOINT_URL
|
| 46 |
-
fromService:
|
| 47 |
-
type: web
|
| 48 |
-
name: spotix-api
|
| 49 |
-
envVarKey: R2_ENDPOINT_URL
|
| 50 |
-
- key: R2_ACCESS_KEY_ID
|
| 51 |
-
fromService:
|
| 52 |
-
type: web
|
| 53 |
-
name: spotix-api
|
| 54 |
-
envVarKey: R2_ACCESS_KEY_ID
|
| 55 |
-
- key: R2_SECRET_ACCESS_KEY
|
| 56 |
-
fromService:
|
| 57 |
-
type: web
|
| 58 |
-
name: spotix-api
|
| 59 |
-
envVarKey: R2_SECRET_ACCESS_KEY
|
| 60 |
-
- key: R2_BUCKET_NAME
|
| 61 |
-
fromService:
|
| 62 |
-
type: web
|
| 63 |
-
name: spotix-api
|
| 64 |
-
envVarKey: R2_BUCKET_NAME
|
|
|
|
| 2 |
- type: web
|
| 3 |
name: spotix-api
|
| 4 |
env: python
|
| 5 |
+
plan: free
|
| 6 |
buildCommand: "cd backend && pip install -r requirements.txt"
|
| 7 |
+
startCommand: "cd backend && bash start.sh"
|
| 8 |
envVars:
|
| 9 |
- key: DATABASE_URL
|
| 10 |
sync: false
|
|
|
|
| 26 |
sync: false
|
| 27 |
- key: R2_BUCKET_NAME
|
| 28 |
sync: false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|