Changeset View
Changeset View
Standalone View
Standalone View
docker/services/swh-scheduler/entrypoint.sh
#!/bin/bash | #!/bin/bash | ||||
set -e | set -e | ||||
source /srv/softwareheritage/utils/pyutils.sh | source /srv/softwareheritage/utils/pyutils.sh | ||||
setup_pip | |||||
source /srv/softwareheritage/utils/pgsql.sh | source /srv/softwareheritage/utils/pgsql.sh | ||||
setup_pgsql | setup_pgsql | ||||
setup_pip | |||||
case "$1" in | if [ "$1" = 'shell' ] ; then | ||||
"shell") | shift | ||||
if (( $# == 0)); then | |||||
exec bash -i | exec bash -i | ||||
;; | else | ||||
"swh-scheduler") | "$@" | ||||
exec $@ | fi | ||||
;; | else | ||||
*) | |||||
wait_pgsql | wait_pgsql | ||||
echo Setup the swh-scheduler API database | echo Setup the swh-scheduler API database | ||||
PGPASSWORD=${POSTGRES_PASSWORD} swh db-init \ | PGPASSWORD=${POSTGRES_PASSWORD} swh db-init \ | ||||
--db-name ${POSTGRES_DB} scheduler | --db-name ${POSTGRES_DB} scheduler | ||||
echo Starting the swh-scheduler API server | echo Starting the swh-scheduler API server | ||||
exec gunicorn --bind 0.0.0.0:5008 \ | exec gunicorn --bind 0.0.0.0:5008 \ | ||||
--log-level DEBUG \ | --log-level DEBUG \ | ||||
--threads 2 \ | --threads 2 \ | ||||
--workers 2 \ | --workers 2 \ | ||||
--reload \ | --reload \ | ||||
--timeout 3600 \ | --timeout 3600 \ | ||||
--config 'python:swh.core.api.gunicorn_config' \ | --config 'python:swh.core.api.gunicorn_config' \ | ||||
'swh.scheduler.api.server:make_app_from_configfile()' | 'swh.scheduler.api.server:make_app_from_configfile()' | ||||
fi | |||||
esac |