diff --git a/docker-compose.yml b/docker-compose.yml index 0bbdf0a..015a314 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,26 +1,35 @@ version: '2' services: swh-storage-db: image: postgres:10 environment: POSTGRES_PASSWORD: testpassword POSTGRES_DB: swh-storage swh-storage: build: ./dockerfiles/swh-storage image: swh/storage ports: - 5002:5002 depends_on: - swh-storage-db - swh-objstorage environment: POSTGRES_PASSWORD: testpassword POSTGRES_DB: swh-storage PGHOST: swh-storage-db PGUSER: postgres swh-objstorage: build: ./dockerfiles/swh-objstorage 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-web/Dockerfile b/dockerfiles/swh-web/Dockerfile new file mode 100644 index 0000000..4300c9e --- /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 gunicorn3 && \ + 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 index 0000000..b086ab1 --- /dev/null +++ b/dockerfiles/swh-web/entrypoint.sh @@ -0,0 +1,19 @@ +#!/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 --nostatic 0.0.0.0:5004 + #exec gunicorn3 -b 0.0.0.0:5004 swh.web.wsgi +fi diff --git a/dockerfiles/swh-web/web.yml b/dockerfiles/swh-web/web.yml new file mode 100644 index 0000000..11bc295 --- /dev/null +++ b/dockerfiles/swh-web/web.yml @@ -0,0 +1,14 @@ +storage: + cls: remote + args: + url: http://localhost:5002/ + timeout: 1 + +objstorage: + cls: remote + args: + url: http://localhost:5003/ + +indexer_storage: + cls: memory + args: {}