Changeset View
Changeset View
Standalone View
Standalone View
docker/services/swh-storage/entrypoint.sh
Show All 20 Lines | |||||
fi | fi | ||||
case "$1" in | case "$1" in | ||||
"shell") | "shell") | ||||
exec bash -i | exec bash -i | ||||
;; | ;; | ||||
*) | *) | ||||
if [ "$STORAGE_BACKEND" = "postgresql" ]; then | if [ "$STORAGE_BACKEND" = "postgresql" ]; then | ||||
wait_pgsql template1 | wait_pgsql ${POSTGRES_DB} | ||||
echo Database setup | echo Database setup | ||||
if ! check_pgsql_db_created; then | |||||
echo Creating database and extensions... | echo Creating extensions... | ||||
swh db create --db-name ${POSTGRES_DB} storage | swh db init-admin --db-name ${POSTGRES_DB} storage | ||||
fi | |||||
echo Initializing the database... | echo Initializing the database... | ||||
swh db init --db-name ${POSTGRES_DB} storage | swh db init --db-name ${POSTGRES_DB} storage | ||||
fi | fi | ||||
echo Starting the swh-storage API server | echo Starting the swh-storage API server | ||||
exec gunicorn --bind 0.0.0.0:5002 \ | exec gunicorn --bind 0.0.0.0:5002 \ | ||||
--reload \ | --reload \ | ||||
--threads 4 \ | --threads 4 \ | ||||
--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.storage.api.server:make_app_from_configfile()' | 'swh.storage.api.server:make_app_from_configfile()' | ||||
;; | ;; | ||||
esac | esac |