Changeset View
Changeset View
Standalone View
Standalone View
docker/services/swh-web/entrypoint.sh
Show All 9 Lines | |||||
email = 'admin@swh-web.org'; | email = 'admin@swh-web.org'; | ||||
User = get_user_model(); | User = get_user_model(); | ||||
if not User.objects.filter(username = username).exists(): | if not User.objects.filter(username = username).exists(): | ||||
User.objects.create_superuser(username, email, password); | User.objects.create_superuser(username, email, password); | ||||
" | " | ||||
source /srv/softwareheritage/utils/pgsql.sh | |||||
setup_pgsql | |||||
source /srv/softwareheritage/utils/pyutils.sh | source /srv/softwareheritage/utils/pyutils.sh | ||||
setup_pip | setup_pip | ||||
case "$1" in | case "$1" in | ||||
"shell") | "shell") | ||||
exec bash -i | exec bash -i | ||||
;; | ;; | ||||
*) | *) | ||||
echo "Starting memcached" | echo "Starting memcached" | ||||
memcached& | memcached& | ||||
wait_pgsql | |||||
echo "Migrating db using ${DJANGO_SETTINGS_MODULE}" | echo "Migrating db using ${DJANGO_SETTINGS_MODULE}" | ||||
django-admin migrate --settings=${DJANGO_SETTINGS_MODULE} | django-admin migrate --settings=${DJANGO_SETTINGS_MODULE} | ||||
echo "Creating Django admin user" | echo "Creating Django admin user" | ||||
echo "$create_admin_script" | python3 -m swh.web.manage shell | echo "$create_admin_script" | python3 -m swh.web.manage shell | ||||
echo "starting the swh-web server" | echo "starting the swh-web server" | ||||
exec gunicorn --bind 0.0.0.0:5004 \ | exec gunicorn --bind 0.0.0.0:5004 \ | ||||
--threads 2 \ | --threads 2 \ | ||||
--workers 2 \ | --workers 2 \ | ||||
--timeout 3600 \ | --timeout 3600 \ | ||||
--access-logfile '-' \ | --access-logfile '-' \ | ||||
--config 'python:swh.web.gunicorn_config' \ | --config 'python:swh.web.gunicorn_config' \ | ||||
'django.core.wsgi:get_wsgi_application()' | 'django.core.wsgi:get_wsgi_application()' | ||||
esac | esac |