diff --git a/docker-compose.yml b/docker-compose.yml --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,3 +24,12 @@ image: swh/objstorage ports: - 5003:5003 + + swh-web: + build: ./dockerfiles/swh-web + image: swh/web + ports: + - 5004:5004 + depends_on: + - swh-objstorage + - swh-storage diff --git a/dockerfiles/swh-storage/entrypoint.sh b/dockerfiles/swh-storage/entrypoint.sh --- a/dockerfiles/swh-storage/entrypoint.sh +++ b/dockerfiles/swh-storage/entrypoint.sh @@ -19,7 +19,7 @@ ;; "init") echo Setup the database - swh-db-init storage --db-name ${POSTGRES_DB} --no-create True + swh-db-init storage --db-name ${POSTGRES_DB} --no-create ;; *) echo Starting the swh-storage API server diff --git a/dockerfiles/swh-web/Dockerfile b/dockerfiles/swh-web/Dockerfile new file mode 100644 --- /dev/null +++ b/dockerfiles/swh-web/Dockerfile @@ -0,0 +1,23 @@ +FROM python:3 + +RUN export DEBIAN_FRONTEND=noninteractive && \ + apt-get update && apt-get upgrade -y && \ + apt-get install -y libsystemd-dev && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +RUN pip install swh-web + +RUN python3 -m swh.web.manage migrate + +RUN pip install psycopg2-binary # to make pip silent + +COPY web.yml /etc/softwareheritage/web/ + +RUN cat /etc/softwareheritage/web/web.yml + +COPY entrypoint.sh / + +ENTRYPOINT ["/entrypoint.sh"] + +EXPOSE 5004 diff --git a/dockerfiles/swh-web/entrypoint.sh b/dockerfiles/swh-web/entrypoint.sh new file mode 100755 --- /dev/null +++ b/dockerfiles/swh-web/entrypoint.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set -e + +if [[ -d /src ]] ; then + for srcrepo in /src/swh-* ; do + echo installing $srcrepo + pip install -e . + popd + done +fi + +if [ "$1" = 'shell' ] ; then + exec bash -i +else + echo "starting the swh-web server" + exec python3 -m swh.web.manage runserver --verbosity 3 --insecure 0.0.0.0:5004 +fi diff --git a/dockerfiles/swh-web/web.yml b/dockerfiles/swh-web/web.yml new file mode 100644 --- /dev/null +++ b/dockerfiles/swh-web/web.yml @@ -0,0 +1,19 @@ +storage: + cls: remote + args: + url: http://swh-storage:5002/ + timeout: 1 + +objstorage: + cls: remote + args: + url: http://swh-objstorage:5003/ + +indexer_storage: + cls: memory + args: {} + +allowed_hosts: + - "*" + +debug: yes