Skip to content

Commit

Permalink
Add eventlet support and gunicorn config vals (#951)
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondjacobson committed Oct 19, 2020
1 parent 896eea4 commit ad755b3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions discovery-provider/requirements.txt
Expand Up @@ -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
25 changes: 24 additions & 1 deletion discovery-provider/scripts/prod-server.sh
Expand Up @@ -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

0 comments on commit ad755b3

Please sign in to comment.