mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 00:36:31 +02:00
fix: reduced docker size by 67%
This commit is contained in:
parent
aed8163aee
commit
590baff093
3 changed files with 75 additions and 37 deletions
33
surfsense_backend/scripts/docker/entrypoint.sh
Normal file
33
surfsense_backend/scripts/docker/entrypoint.sh
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Function to handle shutdown gracefully
|
||||
cleanup() {
|
||||
echo "Shutting down services..."
|
||||
kill -TERM "$backend_pid" "$celery_worker_pid" "$celery_beat_pid" 2>/dev/null || true
|
||||
wait "$backend_pid" "$celery_worker_pid" "$celery_beat_pid" 2>/dev/null || true
|
||||
exit 0
|
||||
}
|
||||
|
||||
trap cleanup SIGTERM SIGINT
|
||||
|
||||
echo "Starting Celery Beat..."
|
||||
celery -A app.celery_app beat --loglevel=info &
|
||||
celery_beat_pid=$!
|
||||
|
||||
echo "Starting Celery Worker..."
|
||||
celery -A app.celery_app worker --loglevel=info --concurrency=1 --pool=solo &
|
||||
celery_worker_pid=$!
|
||||
|
||||
echo "Starting FastAPI Backend..."
|
||||
python main.py --reload &
|
||||
backend_pid=$!
|
||||
|
||||
echo "All services started. PIDs: Backend=$backend_pid, Worker=$celery_worker_pid, Beat=$celery_beat_pid"
|
||||
|
||||
# Wait for any process to exit
|
||||
wait -n
|
||||
|
||||
# If we get here, one process exited, so exit with its status
|
||||
exit $?
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue