diff --git a/entrypoint.sh b/entrypoint.sh index 24b79f9e520bff25ae5cd7fc0dcb42c7d4a2f3e5..7298ff78078183d11457b86774217eed9148492e 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,36 +1,10 @@ #!/bin/sh -for command in "$@"; do - if [ "$command" = "initialize" ]; then - TANK_CALLBACK_BASE_URL=${TANK_CALLBACK_BASE_URL:-${AURA_PROTO}://${AURA_HOST}/tank} - DASHBOARD_CALLBACK_BASE_URL=${DASHBOARD_CALLBACK_BASE_URL:-${AURA_PROTO}://${AURA_HOST}} - - poetry run ./manage.py migrate --no-input - poetry run ./manage.py collectstatic --no-input - poetry run ./manage.py createsuperuser --no-input - poetry run ./manage.py create_oidc_client dashboard public --client-id "${DASHBOARD_OIDC_CLIENT_ID}" --client-secret "${DASHBOARD_OIDC_CLIENT_SECRET}" -r "id_token token" -u "${DASHBOARD_CALLBACK_BASE_URL}/oidc_callback.html" -u "${DASHBOARD_CALLBACK_BASE_URL}/oidc_callback_silentRenew.html" -p "${DASHBOARD_CALLBACK_BASE_URL}" -p "${DASHBOARD_CALLBACK_BASE_URL}/" - poetry run ./manage.py create_oidc_client tank confidential --client-id "${TANK_OIDC_CLIENT_ID}" --client-secret "${TANK_OIDC_CLIENT_SECRET}" -r "code" -u "${TANK_CALLBACK_BASE_URL}/tank/auth/oidc/callback" - poetry run ./manage.py addpermissions - poetry run ./manage.py creatersakey - fi - - # FIXME: these should be in the initialization or execute inside the running container - if [ "$command" = "loaddata.custom" ]; then - # from the docker-compose volume - poetry run ./manage.py loaddata fixtures/custom/*.json - elif [ "$command" = "loaddata.sample" ]; then - # from the steering Docker image - poetry run ./manage.py loaddata fixtures/sample/*.json - fi - - # start the application - if [ "$command" = "run.prod" ]; then - poetry run ./manage.py migrate --no-input - poetry run ./manage.py collectstatic --no-input - poetry run gunicorn --bind 0.0.0.0:8000 --workers "$(nproc)" steering.wsgi - elif [ "$command" = "run.dev" ]; then - poetry run ./manage.py migrate --no-input - poetry run ./manage.py collectstatic --no-input - poetry run ./manage.py runserver 0.0.0.0:8000 - fi -done +poetry run ./manage.py migrate --no-input + +if [ "$1" = "run.prod" ]; then + # TODO: is there another way to pass `$(nproc)`? + poetry run gunicorn --bind 0.0.0.0:8000 --workers "$(nproc)" steering.wsgi +elif [ "$1" = "run.dev" ]; then + poetry run ./manage.py runserver 0.0.0.0:8000 +fi