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