Skip to content

Commit

Permalink
Refactor start.sh to remove sleep and debugpy execution, streamline g…
Browse files Browse the repository at this point in the history
…unicorn startup
  • Loading branch information
ariWeinberg committed Jan 10, 2025
1 parent 8d90371 commit 6694f51
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ export GUNICORN_CONF=${GUNICORN_CONF:-./gunicorn_conf.py}
export GUNICORN_TIMEOUT=${GUNICORN_TIMEOUT:-30}
export GUNICORN_KEEP_ALIVE_TIMEOUT=${GUNICORN_KEEP_ALIVE_TIMEOUT:-5}

sleep 10

if [[ -z "${OPAL_BROADCAST_URI}" && "${UVICORN_NUM_WORKERS}" != "1" ]]; then
echo "OPAL_BROADCAST_URI must be set when having multiple workers"
exit 1
Expand All @@ -17,9 +15,4 @@ prefix=""
if [[ -z "${OPAL_ENABLE_DATADOG_APM}" && "${OPAL_ENABLE_DATADOG_APM}" = "true" ]]; then
prefix=ddtrace-run
fi

#(set -x; exec $prefix gunicorn --reload -b 0.0.0.0:${UVICORN_PORT} -k uvicorn.workers.UvicornWorker --workers=${UVICORN_NUM_WORKERS} -c ${GUNICORN_CONF} ${UVICORN_ASGI_APP} -t ${GUNICORN_TIMEOUT} --keep-alive ${GUNICORN_KEEP_ALIVE_TIMEOUT})
(set -x; exec $prefix python -m debugpy --listen 0.0.0.0:5678 -m uvicorn ${UVICORN_ASGI_APP} --reload --host 0.0.0.0 --port ${UVICORN_PORT} )

# write a code that will wait for the user to press enter
read -n1 -r -p "Press any key to continue..." key
(set -x; exec $prefix gunicorn -b 0.0.0.0:${UVICORN_PORT} -k uvicorn.workers.UvicornWorker --workers=${UVICORN_NUM_WORKERS} -c ${GUNICORN_CONF} ${UVICORN_ASGI_APP} -t ${GUNICORN_TIMEOUT} --keep-alive ${GUNICORN_KEEP_ALIVE_TIMEOUT})

0 comments on commit 6694f51

Please sign in to comment.