mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 19:59:50 +08:00
24 lines
664 B
Bash
24 lines
664 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
set -e
|
||
|
|
||
|
if [[ "${MIGRATION_ENABLED}" == "true" ]]; then
|
||
|
echo "Running migrations"
|
||
|
flask db upgrade
|
||
|
fi
|
||
|
|
||
|
if [[ "${MODE}" == "worker" ]]; then
|
||
|
celery -A app.celery worker -P ${CELERY_WORKER_CLASS:-gevent} -c ${CELERY_WORKER_AMOUNT:-1} --loglevel INFO
|
||
|
else
|
||
|
if [[ "${DEBUG}" == "true" ]]; then
|
||
|
flask run --host=${DIFY_BIND_ADDRESS:-0.0.0.0} --port=${DIFY_PORT:-5001} --debug
|
||
|
else
|
||
|
gunicorn \
|
||
|
--bind "${DIFY_BIND_ADDRESS:-0.0.0.0}:${DIFY_PORT:-5001}" \
|
||
|
--workers ${SERVER_WORKER_AMOUNT:-1} \
|
||
|
--worker-class ${SERVER_WORKER_CLASS:-gevent} \
|
||
|
--timeout ${GUNICORN_TIMEOUT:-200} \
|
||
|
--preload \
|
||
|
app:app
|
||
|
fi
|
||
|
fi
|