diff --git a/discovery-provider/requirements.txt b/discovery-provider/requirements.txt index 856a99220dc..255da658844 100644 --- a/discovery-provider/requirements.txt +++ b/discovery-provider/requirements.txt @@ -23,3 +23,4 @@ fakeredis==1.4.2 jsonformatter==0.3.0 py-cid==0.3.0 pytest-postgresql==2.4.1 +eventlet==0.28.0 diff --git a/discovery-provider/scripts/prod-server.sh b/discovery-provider/scripts/prod-server.sh index 7cfa2ffa14f..e1e2683ea8b 100755 --- a/discovery-provider/scripts/prod-server.sh +++ b/discovery-provider/scripts/prod-server.sh @@ -6,5 +6,28 @@ # "-b :5000" accept requests on port 5000 # "--access-logfile - --error-logfile" - log to stdout/stderr # "src.wsgi:app" - app entry point in format: $(MODULE_NAME):$(VARIABLE_NAME) -exec gunicorn -b :5000 --access-logfile - --error-logfile - src.wsgi:app --log-level=debug --workers 2 --threads 8 +# Use specified number of workers if present +if [[ -z "${audius_gunicorn_workers}" ]] +then + WORKERS=2 +else + WORKERS="${audius_gunicorn_workers}" +fi + +# Use specified number of threads if present (only used for "sync" workers) +if [[ -z "${audius_gunicorn_threads}" ]] +then + THREADS=8 +else + THREADS="${audius_gunicorn_threads}" +fi + +# If a worker class is specified, use that. Otherwise, use sync workers. +if [[ -z "${audius_gunicorn_worker_class}" ]] +then + exec gunicorn -b :5000 --access-logfile - --error-logfile - src.wsgi:app --log-level=debug --workers=$WORKERS --threads=$THREADS +else + WORKER_CLASS="${audius_gunicorn_worker_class}" + exec gunicorn -b :5000 --access-logfile - --error-logfile - src.wsgi:app --log-level=debug --worker-class=$WORKER_CLASS --workers=$WORKERS +fi \ No newline at end of file