diff --git a/dockerfiles/swh-deposit/Dockerfile b/dockerfiles/swh-deposit/Dockerfile index 04e2b93..e8b93b2 100644 --- a/dockerfiles/swh-deposit/Dockerfile +++ b/dockerfiles/swh-deposit/Dockerfile @@ -1,14 +1,16 @@ FROM python:3.6 RUN export DEBIAN_FRONTEND=noninteractive && \ apt-get update && apt-get upgrade -y && \ - apt-get install -y libsystemd-dev postgresql-client && \ + apt-get install -y libsystemd-dev && \ + apt-get install -y postgresql-client && \ + apt-get install -y wait-for-it && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* RUN pip install swh-deposit gunicorn RUN pip install psycopg2-binary # to make pip silent COPY entrypoint.sh / EXPOSE 5006 ENTRYPOINT ["/entrypoint.sh"] diff --git a/dockerfiles/swh-deposit/entrypoint.sh b/dockerfiles/swh-deposit/entrypoint.sh index 1f936a9..17b6def 100755 --- a/dockerfiles/swh-deposit/entrypoint.sh +++ b/dockerfiles/swh-deposit/entrypoint.sh @@ -1,41 +1,41 @@ #!/bin/bash set -ex if [[ -d /src ]] ; then pwd for src_repo in /src/swh-* ; do pushd $src_repo echo "Installing ${src_repo}" pip install -e . popd done fi echo "${PGHOST}:5432:${POSTGRES_DB}:${PGUSER}:${POSTGRES_PASSWORD}" > ~/.pgpass cat > ~/.pg_service.conf < /dev/null 2> /dev/null; do sleep 0.1; done + wait-for-it swh-deposit-db:5432 -s --timeout=0 echo "Migrating db" django-admin migrate --settings=swh.deposit.settings.production echo "starting swh-deposit server" exec gunicorn --bind 0.0.0.0:5006 \ --reload \ --log-level DEBUG \ --timeout 3600 \ swh.deposit.wsgi fi diff --git a/dockerfiles/swh-indexer-storage/Dockerfile b/dockerfiles/swh-indexer-storage/Dockerfile index 1e45985..a3d8fe4 100644 --- a/dockerfiles/swh-indexer-storage/Dockerfile +++ b/dockerfiles/swh-indexer-storage/Dockerfile @@ -1,13 +1,14 @@ FROM python:3.6 RUN export DEBIAN_FRONTEND=noninteractive && \ apt-get update && \ - apt-get install -y \ - libsystemd-dev postgresql-client + apt-get install -y libsystemd-dev && \ + apt-get install -y postgresql-client && \ + apt-get install -y wait-for-it RUN pip install --upgrade pip setuptools wheel RUN pip install swh-indexer gunicorn COPY entrypoint.sh / ENTRYPOINT ["/entrypoint.sh"] diff --git a/dockerfiles/swh-indexer-storage/entrypoint.sh b/dockerfiles/swh-indexer-storage/entrypoint.sh index 95b58a2..b8ed698 100755 --- a/dockerfiles/swh-indexer-storage/entrypoint.sh +++ b/dockerfiles/swh-indexer-storage/entrypoint.sh @@ -1,50 +1,50 @@ #!/bin/bash set -e export PATH=${HOME}/.local/bin:${PATH} if [[ -d /src ]] ; then for srcrepo in /src/swh-* ; do pushd $srcrepo echo "WARNING: $srcrepo will NOT be pip installed in dev mode" echo " due to permission limitations." pip install --user . popd done fi echo Installed Python packages: pip list echo "${PGHOST}:5432:${POSTGRES_DB}:${PGUSER}:${POSTGRES_PASSWORD}" > ~/.pgpass cat > ~/.pg_service.conf <&1 > /dev/null; do sleep 0.1; done + wait-for-it swh-indexer-storage-db:5432 -s --timeout=0 echo Setup the database PGPASSWORD=${POSTGRES_PASSWORD} swh-db-init indexer \ --db-name ${POSTGRES_DB} echo Starting the swh-indexer-storage API server exec gunicorn --bind 0.0.0.0:5007 \ --reload \ --log-level DEBUG \ --timeout 3600 \ swh.indexer.storage.api.wsgi ;; esac diff --git a/dockerfiles/swh-listers-worker/entrypoint.sh b/dockerfiles/swh-listers-worker/entrypoint.sh index 7faf612..971e8ff 100755 --- a/dockerfiles/swh-listers-worker/entrypoint.sh +++ b/dockerfiles/swh-listers-worker/entrypoint.sh @@ -1,67 +1,69 @@ #!/bin/bash set -e export PATH=${HOME}/.local/bin:${PATH} 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 echo Installed Python packages: pip list 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 < ~/.pgpass cat > ~/.pg_service.conf <&1 > /dev/null; do sleep 0.1; done + wait-for-it swh-scheduler-db:5432 -s --timeout=0 echo Setup the swh-scheduler API database PGPASSWORD=${POSTGRES_PASSWORD} swh-db-init scheduler \ --db-name ${POSTGRES_DB} echo Starting the swh-scheduler API server exec gunicorn --bind 0.0.0.0:5008 \ --log-level DEBUG \ --reload \ --timeout 3600 \ swh.scheduler.api.wsgi esac diff --git a/dockerfiles/swh-storage/Dockerfile b/dockerfiles/swh-storage/Dockerfile index 198e8f7..cf8a64f 100644 --- a/dockerfiles/swh-storage/Dockerfile +++ b/dockerfiles/swh-storage/Dockerfile @@ -1,15 +1,16 @@ FROM python:3.6 RUN export DEBIAN_FRONTEND=noninteractive && \ apt-get update && \ - apt-get install -y \ - libsystemd-dev postgresql-client + apt-get install -y libsystemd-dev && \ + apt-get install -y postgresql-client && \ + apt-get install -y wait-for-it RUN pip install --upgrade pip setuptools wheel RUN pip install swh-storage gunicorn COPY entrypoint.sh / ENTRYPOINT ["/entrypoint.sh"] EXPOSE 5002 diff --git a/dockerfiles/swh-storage/entrypoint.sh b/dockerfiles/swh-storage/entrypoint.sh index 90db8df..95a9619 100755 --- a/dockerfiles/swh-storage/entrypoint.sh +++ b/dockerfiles/swh-storage/entrypoint.sh @@ -1,46 +1,46 @@ #!/bin/bash set -e if [[ -d /src ]] ; then for srcrepo in /src/swh-* ; do pushd $srcrepo pip install -e . popd done fi echo Installed Python packages: pip list echo "${PGHOST}:5432:${POSTGRES_DB}:${PGUSER}:${POSTGRES_PASSWORD}" > ~/.pgpass cat > ~/.pg_service.conf < /dev/null 2> /dev/null; do sleep 0.1; done + wait-for-it swh-storage-db:5432 -s --timeout=0 echo Setup the database PGPASSWORD=${POSTGRES_PASSWORD} swh-db-init storage \ --db-name ${POSTGRES_DB} echo Starting the swh-storage API server exec gunicorn --bind 0.0.0.0:5002 \ --reload \ --log-level DEBUG \ --timeout 3600 \ swh.storage.api.wsgi ;; esac diff --git a/dockerfiles/swh-vault/Dockerfile b/dockerfiles/swh-vault/Dockerfile index 826b3bf..293302d 100644 --- a/dockerfiles/swh-vault/Dockerfile +++ b/dockerfiles/swh-vault/Dockerfile @@ -1,13 +1,14 @@ FROM python:3.6 RUN export DEBIAN_FRONTEND=noninteractive && \ apt-get update && \ - apt-get install -y \ - libsystemd-dev postgresql-client + apt-get install -y libsystemd-dev && \ + apt-get install -y postgresql-client && \ + apt-get install -y wait-for-it RUN pip install --upgrade pip setuptools wheel RUN pip install swh-vault COPY entrypoint.sh / ENTRYPOINT ["/entrypoint.sh"] diff --git a/dockerfiles/swh-vault/entrypoint.sh b/dockerfiles/swh-vault/entrypoint.sh index f7268c8..0e1599b 100755 --- a/dockerfiles/swh-vault/entrypoint.sh +++ b/dockerfiles/swh-vault/entrypoint.sh @@ -1,56 +1,57 @@ #!/bin/bash set -e if [[ -d /src ]] ; then for srcrepo in /src/swh-* ; do pushd $srcrepo pip install -e . popd done fi echo Installed Python packages: pip list if [[ -n $PGHOST ]]; then echo "${PGHOST}:5432:${POSTGRES_DB}:${PGUSER}:${POSTGRES_PASSWORD}" > ~/.pgpass cat > ~/.pg_service.conf <&1 > /dev/null; do sleep 0.1; done + wait-for-it swh-vault-db:5432 -s --timeout=0 echo Setup the swh-vault API database PGPASSWORD=${POSTGRES_PASSWORD} swh-db-init vault \ --db-name ${POSTGRES_DB} echo Starting the swh-vault API server exec swh-vault -C /vault-api.yml esac