Skip to content
Snippets Groups Projects
Unverified Commit 1cc10fa2 authored by Antoine R. Dumont's avatar Antoine R. Dumont
Browse files

web: Unify entrypoint with others

parent f39722db
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@
set -e
case "$1" in
"shell")
'shell')
shift
if (( $# == 0)); then
exec bash -i
......@@ -11,19 +11,19 @@ case "$1" in
"$@"
fi
;;
"refresh")
echo "Start periodic save code now refresh statuses routine (in background)"
'refresh')
echo 'Start periodic save code now refresh statuses routine (in background)'
exec sh -c 'date && django-admin refresh_savecodenow_statuses \
--settings=${DJANGO_SETTINGS_MODULE} 2>&1'
;;
"sync-mailmaps")
'sync-mailmaps')
echo Deprecated use django-admin instead
shift
echo "django-admin sync-mailmaps routine"
echo 'django-admin sync-mailmaps routine'
date
exec sh -c "django-admin sync_mailmaps --perform '$@'"
;;
"django-admin")
'django-admin')
shift
COMMAND=$1
shift
......@@ -33,23 +33,28 @@ case "$1" in
exec sh -c "django-admin ${COMMAND} $*"
;;
*)
EXTRA_CLI_FLAGS=""
if [ ! -z "${SWH_LOG_CONFIG_JSON}" ]; then
EXTRA_CLI_FLAGS+="--log-config-json ${SWH_LOG_CONFIG_JSON} "
# run gunicorn workers with production configuration
EXTRA_CLI_FLAGS=()
if [ -n "${SWH_LOG_CONFIG_JSON}" ]; then
EXTRA_CLI_FLAGS+=('--log-config-json' "${SWH_LOG_CONFIG_JSON}")
fi
if [ ! -z "${SWH_DEV_MODE}" ]; then
EXTRA_CLI_FLAGS+="--reload "
if [ -n "${STATSD_HOST}" -a -n "${STATSD_PORT}" ]; then
EXTRA_CLI_FLAGS+=('--statsd-host' "${STATSD_HOST}:${STATSD_PORT}")
fi
echo "Starting the swh-web server"
# run gunicorn workers as in production otherwise
exec gunicorn --bind 0.0.0.0:${PORT} \
--log-level ${SWH_LOG_LEVEL:-INFO} \
${EXTRA_CLI_FLAGS} \
--threads ${THREADS} \
--workers ${WORKERS} \
--timeout ${TIMEOUT} \
--statsd-host=${STATSD_HOST}:${STATSD_PORT} \
--statsd-prefix=${STATSD_SERVICE_TYPE} \
if [ -n "${STATSD_SERVICE_TYPE}" ]; then
EXTRA_CLI_FLAGS+=('--statsd-prefix' "${STATSD_SERVICE_TYPE}")
fi
if [ -n "${SWH_DEV_MODE}" ]; then
EXTRA_CLI_FLAGS+=("--reload")
fi
echo 'Starting swh web server'
exec gunicorn --bind "0.0.0.0:${PORT}" \
--log-level "${SWH_LOG_LEVEL:-INFO}" \
"${EXTRA_CLI_FLAGS[@]}" \
--threads "${THREADS}" \
--workers "${WORKERS}" \
--timeout "${TIMEOUT}" \
--access-logfile '-' \
--env DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE} \
--config 'python:swh.web.gunicorn_config' \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment