diff --git a/docker-compose.yml b/docker-compose.yml --- a/docker-compose.yml +++ b/docker-compose.yml @@ -104,3 +104,70 @@ - swh-objstorage - swh-storage - swh-idx-storage + +# Lister Celery workers + + swh-listers-db: + image: postgres:10 + environment: + POSTGRES_PASSWORD: testpassword + + swh-lister-debian: + image: swh/listers-worker + build: ./dockerfiles/swh-listers-worker + env_file: ./listers.env + environment: + SWH_WORKER_INSTANCE: debian + depends_on: + - swh-listers-db + - swh-scheduler-api + - swh-storage + - amqp + + swh-lister-github: + image: swh/listers-worker + build: ./dockerfiles/swh-listers-worker + env_file: ./listers.env + environment: + SWH_WORKER_INSTANCE: github + depends_on: + - swh-listers-db + - swh-scheduler-api + - swh-storage + - amqp + + swh-lister-gitlab: + image: swh/listers-worker + build: ./dockerfiles/swh-listers-worker + env_file: ./listers.env + environment: + SWH_WORKER_INSTANCE: gitlab + depends_on: + - swh-listers-db + - swh-scheduler-api + - swh-storage + - amqp + + swh-lister-npm: + image: swh/listers-worker + build: ./dockerfiles/swh-listers-worker + env_file: ./listers.env + environment: + SWH_WORKER_INSTANCE: npm + depends_on: + - swh-listers-db + - swh-scheduler-api + - swh-storage + - amqp + + swh-lister-pypi: + image: swh/listers-worker + build: ./dockerfiles/swh-listers-worker + env_file: ./listers.env + environment: + SWH_WORKER_INSTANCE: pypi + depends_on: + - swh-listers-db + - swh-scheduler-api + - swh-storage + - amqp diff --git a/dockerfiles/swh-listers-worker/Dockerfile b/dockerfiles/swh-listers-worker/Dockerfile new file mode 100644 --- /dev/null +++ b/dockerfiles/swh-listers-worker/Dockerfile @@ -0,0 +1,17 @@ +FROM python:3 + +RUN export DEBIAN_FRONTEND=noninteractive && \ + apt-get update && \ + apt-get install -y \ + libsystemd-dev postgresql-client + +RUN pip install swh-lister +RUN useradd -ms /bin/bash swh +COPY entrypoint.sh / + +COPY lister.yml /home/swh/.config/swh/ +RUN chown -R swh: /home/swh/.config/ + +USER swh +ENTRYPOINT ["/entrypoint.sh"] +EXPOSE 5008 diff --git a/dockerfiles/swh-listers-worker/entrypoint.sh b/dockerfiles/swh-listers-worker/entrypoint.sh new file mode 100755 --- /dev/null +++ b/dockerfiles/swh-listers-worker/entrypoint.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +set -e + +if [[ -d /src ]] ; then + for srcrepo in /src/swh-* ; do + pushd $srcrepo + echo "WARNING: $srcrepo wil NOT be pip installed in dev mode" + echo " due to permission limitations." + pip install --user . + popd + done +fi + +export POSTGRES_DB=swh-lister-${SWH_WORKER_INSTANCE} + +echo "${PGHOST}:5432:postgres:${PGUSER}:${POSTGRES_PASSWORD}" > ~/.pgpass +echo "${PGHOST}:5432:${POSTGRES_DB}:${PGUSER}:${POSTGRES_PASSWORD}" >> ~/.pgpass +cat > ~/.pg_service.conf < ~/.config/swh/worker/${SWH_WORKER_INSTANCE}.ini <