mirror of
https://git.oceanpay.cc/danial/kami_apple_exchage.git
synced 2025-12-18 22:29:09 +00:00
- Create README.md for deployment instructions including environment requirements and setup steps. - Implement deploy.sh script for automated deployment of development and production environments. - Add combined Docker Compose configuration for frontend and backend services. - Include Redis configuration file for optimized memory management and persistence. - Update frontend Dockerfile to handle Next.js asset paths and static files. - Remove obsolete deployment files and configurations from frontend directory.
45 lines
1.4 KiB
Bash
45 lines
1.4 KiB
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
# 默认服务类型为API
|
|
SERVICE_TYPE=${SERVICE_TYPE:-api}
|
|
|
|
echo "Starting service type: $SERVICE_TYPE"
|
|
|
|
case "$SERVICE_TYPE" in
|
|
"api")
|
|
echo "Starting FastAPI server with Gunicorn..."
|
|
exec gunicorn -k uvicorn.workers.UvicornWorker -c run.py app.main:app
|
|
;;
|
|
"worker")
|
|
echo "Starting Celery worker with gevent pool..."
|
|
exec celery -A app.core.celery_app worker \
|
|
--loglevel=info \
|
|
--pool=gevent \
|
|
--concurrency=${CELERY_CONCURRENCY:-100} \
|
|
--max-tasks-per-child=${CELERY_MAX_TASKS_PER_CHILD:-1000} \
|
|
--prefetch-multiplier=${CELERY_PREFETCH_MULTIPLIER:-1} \
|
|
--without-gossip \
|
|
--without-mingle \
|
|
--without-heartbeat
|
|
;;
|
|
"beat")
|
|
echo "Starting Celery beat scheduler..."
|
|
exec celery -A app.core.celery_app beat \
|
|
--loglevel=info \
|
|
--schedule=/app/data/celerybeat-schedule
|
|
;;
|
|
"flower")
|
|
echo "Starting Celery Flower monitoring..."
|
|
exec /app/.venv/bin/celery -A app.core.celery_app flower \
|
|
--port=5555 \
|
|
--broker=redis://redis:6379/0 \
|
|
--result_backend=redis://redis:6379/1 \
|
|
--loglevel=info
|
|
;;
|
|
*)
|
|
echo "Unknown service type: $SERVICE_TYPE"
|
|
echo "Available types: api, worker, beat, flower"
|
|
exit 1
|
|
;;
|
|
esac |