generated from GDGVIT/template
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathentrypoint.sh
More file actions
25 lines (23 loc) · 810 Bytes
/
entrypoint.sh
File metadata and controls
25 lines (23 loc) · 810 Bytes
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
#!/bin/sh
#
# entrypoint.sh — Docker container entrypoint
#
# Switches between web and worker modes based on the SERVICE_TYPE env var.
# Used by the Dockerfile and railway.toml for Railway deployments.
#
# SERVICE_TYPE=worker → Celery worker
# SERVICE_TYPE=<unset> → Gunicorn web server (default)
#
# Port is read from PORT env var (default: 8080, Railway sets this automatically).
set -e
if [ "$SERVICE_TYPE" = "worker" ]; then
echo "Starting Celery worker..."
exec celery -A celery_worker.celery worker \
--loglevel=info \
--queues=celery,pathfinding,health,maintenance \
--max-tasks-per-child=3 \
--concurrency=2
else
echo "Starting Gunicorn on port ${PORT:-8080}..."
exec gunicorn --bind "0.0.0.0:${PORT:-8080}" --workers 2 --timeout 120 run:app
fi