Page MenuHomeSoftware Heritage

D824.id2620.diff
No OneTemporary

D824.id2620.diff

diff --git a/docker-compose.yml b/docker-compose.yml
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,11 +1,15 @@
version: '2'
services:
+
+# Graph storage
+
swh-storage-db:
image: postgres:10
environment:
POSTGRES_PASSWORD: testpassword
POSTGRES_DB: swh-storage
+
swh-storage:
build: ./dockerfiles/swh-storage
image: swh/storage
@@ -19,12 +23,38 @@
POSTGRES_DB: swh-storage
PGHOST: swh-storage-db
PGUSER: postgres
+
+# Object storage
+
swh-objstorage:
build: ./dockerfiles/swh-objstorage
image: swh/objstorage
ports:
- 5003:5003
+# Indexer storage
+
+ swh-idx-storage-db:
+ image: postgres:10
+ environment:
+ POSTGRES_PASSWORD: testpassword
+ POSTGRES_DB: swh-idx-storage
+
+ swh-idx-storage:
+ build: ./dockerfiles/swh-indexer-storage
+ image: swh/indexer_storage
+ ports:
+ - 5007:5007
+ depends_on:
+ - swh-idx-storage-db
+ environment:
+ POSTGRES_PASSWORD: testpassword
+ POSTGRES_DB: swh-idx-storage
+ PGHOST: swh-idx-storage-db
+ PGUSER: postgres
+
+# Web interface
+
swh-web:
build: ./dockerfiles/swh-web
image: swh/web
@@ -33,3 +63,4 @@
depends_on:
- swh-objstorage
- swh-storage
+ - swh-idx-storage
diff --git a/dockerfiles/swh-indexer-storage/Dockerfile b/dockerfiles/swh-indexer-storage/Dockerfile
new file mode 100644
--- /dev/null
+++ b/dockerfiles/swh-indexer-storage/Dockerfile
@@ -0,0 +1,14 @@
+FROM python:3
+
+RUN export DEBIAN_FRONTEND=noninteractive && \
+ apt-get update && \
+ apt-get install -y \
+ libsystemd-dev postgresql-client
+
+RUN pip install swh-indexer
+COPY indexer_storage.yml /
+COPY entrypoint.sh /
+
+ENTRYPOINT ["/entrypoint.sh"]
+
+EXPOSE 5002
diff --git a/dockerfiles/swh-indexer-storage/entrypoint.sh b/dockerfiles/swh-indexer-storage/entrypoint.sh
new file mode 100755
--- /dev/null
+++ b/dockerfiles/swh-indexer-storage/entrypoint.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+set -e
+
+if [[ -d /src ]] ; then
+ for srcrepo in /src/swh-* ; do
+ pushd $srcrepo
+ pip install -e .
+ popd
+ done
+fi
+
+echo "${PGHOST}:5432:${POSTGRES_DB}:${PGUSER}:${POSTGRES_PASSWORD}" > ~/.pgpass
+cat > ~/.pg_service.conf <<EOF
+[swh-indexer]
+dbname=${POSTGRES_DB}
+host=${PGHOST}
+port=5432
+user=${PGUSER}
+EOF
+
+chmod 0400 ~/.pgpass
+
+case "$1" in
+ "shell")
+ exec bash -i
+ ;;
+ *)
+
+ echo Waiting for postgresql to start
+ until psql service=swh-indexer -c "select 1" 2>&1 > /dev/null; do sleep 0.1; done
+
+ echo Setup the database
+ PGPASSWORD=${POSTGRES_PASSWORD} swh-db-init indexer \
+ --db-name ${POSTGRES_DB}
+
+ echo Starting the swh-indexer-storage API server
+ exec python -m swh.indexer.storage.api.server /indexer_storage.yml
+ ;;
+esac
diff --git a/dockerfiles/swh-indexer-storage/indexer_storage.yml b/dockerfiles/swh-indexer-storage/indexer_storage.yml
new file mode 100644
--- /dev/null
+++ b/dockerfiles/swh-indexer-storage/indexer_storage.yml
@@ -0,0 +1,4 @@
+storage:
+ cls: local
+ args:
+ db: service=swh-indexer

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 30, 3:25 PM (1 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3219870

Event Timeline