diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -223,6 +223,7 @@ build: ./ image: swh/stack ports: + - 3000:3000 - 5004:5004 depends_on: - swh-idx-storage diff --git a/docker/services/swh-web/entrypoint.sh b/docker/services/swh-web/entrypoint.sh --- a/docker/services/swh-web/entrypoint.sh +++ b/docker/services/swh-web/entrypoint.sh @@ -10,8 +10,11 @@ echo "Install and compile swh-web static assets" pushd /src/swh-web yarn install --frozen-lockfile - yarn build-dev + # execute webpack-dev-server in background + yarn start-dev& popd + # force the use of swh-web develomment settings + export DJANGO_SETTINGS_MODULE=swh.web.settings.development fi source /srv/softwareheritage/utils/pyutils.sh @@ -49,11 +52,17 @@ disown echo "starting the swh-web server" - exec gunicorn --bind 0.0.0.0:5004 \ - --threads 2 \ - --workers 2 \ - --timeout 3600 \ - --access-logfile '-' \ - --config 'python:swh.web.gunicorn_config' \ - 'django.core.wsgi:get_wsgi_application()' + if [[ -d /src/swh-web ]] ; then + # run django development server when overriding swh-web sources + exec django-admin runserver --nostatic --settings=${DJANGO_SETTINGS_MODULE} 0.0.0.0:5004 + else + # run gunicorn workers as in production otherwise + exec gunicorn --bind 0.0.0.0:5004 \ + --threads 2 \ + --workers 2 \ + --timeout 3600 \ + --access-logfile '-' \ + --config 'python:swh.web.gunicorn_config' \ + 'django.core.wsgi:get_wsgi_application()' + fi esac