From 30c0da5fc02773cab72ed7086a2a93ee220c68e8 Mon Sep 17 00:00:00 2001 From: pedro Date: Fri, 12 Jan 2024 10:30:55 +0100 Subject: [PATCH] deployment scripts for pilot setem --- build__pilot-setem.sh | 45 ++++++++++++++++++++++ docker-compose__pilot-setem.yml | 67 +++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100755 build__pilot-setem.sh create mode 100644 docker-compose__pilot-setem.yml diff --git a/build__pilot-setem.sh b/build__pilot-setem.sh new file mode 100755 index 0000000..77255ce --- /dev/null +++ b/build__pilot-setem.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +set -e +set -u +# DEBUG +set -x + +# a wallet and verifier idhub for pilot-setem +main() { + deployment="${1:-}" + + # detach on production deployment + if [ "${deployment}" = 'prod' ]; then + detach='-d' + fi + + # ensure uses pilot-setem branch + ( + cd ./IdHub + git checkout pilot-setem + ) + + postfix='pilot-setem' + local idhub1="idhub1__${postfix}" + local idhub2="idhub2__${postfix}" + + # force recreate + rm -rf "./${idhub1}" "./${idhub2}" + + # detect if is new + if [ ! -f "./${idhub1}" ] && [ ! -f "./${idhub2}" ]; then + echo 'Detected new deployment, recreating git repos idhub1 and idhub2' + cp -rp IdHub "${idhub1}" + rm -f "${idhub1}/db.sqlite3" + cp -rp IdHub "${idhub2}" + rm -f "${idhub2}/db.sqlite3" + fi + + idhub_dc_f="docker-compose__${postfix}.yml" + docker compose -f ${idhub_dc_f} down -v || true + make idhub_build \ + && docker compose -f ${idhub_dc_f} up ${detach:-} +} + +main "${@}" diff --git a/docker-compose__pilot-setem.yml b/docker-compose__pilot-setem.yml new file mode 100644 index 0000000..37bdffb --- /dev/null +++ b/docker-compose__pilot-setem.yml @@ -0,0 +1,67 @@ +version: "3.9" +services: + + idhub1: + container_name: idhub1 + init: true + image: dkr-dsg.ac.upc.edu/trustchain-oc1-orchestral/idhub:latest + environment: + - DEPLOYMENT=${IDHUB_DEPLOYMENT} + - SECRET_KEY=${IDHUB_SECRET_KEY:-publicsecretisnotsecureVtmKBfxpVV47PpBCF2Nzz2H6qnbd} + - ALLOWED_HOSTS=${IDHUB_ALLOWED_HOSTS:-*} + - STATIC_ROOT=${IDHUB_STATIC_ROOT:-/static/} + - MEDIA_ROOT=${IDHUB_MEDIA_ROOT:-/media/} + - PORT=${IDHUB_PORT:-9001} + - DJANGO_SUPERUSER_USERNAME=${IDHUB_USER} + - DJANGO_SUPERUSER_PASSWORD=${IDHUB_PASSWD} + - DJANGO_SUPERUSER_EMAIL=${IDHUB_EMAIL} + - CSRF_TRUSTED_ORIGINS=https://idhub1-setem.demo.pangea.org + - DEFAULT_FROM_EMAIL=${IDHUB_DEFAULT_FROM_EMAIL} + - EMAIL_HOST=${IDHUB_EMAIL_HOST} + - EMAIL_HOST_USER=${IDHUB_EMAIL_HOST_USER} + - EMAIL_HOST_PASSWORD=${IDHUB_EMAIL_HOST_PASSWORD} + - EMAIL_PORT=${IDHUB_EMAIL_PORT} + - EMAIL_USE_TLS=${IDHUB_EMAIL_USE_TLS} + - EMAIL_BACKEND=${IDHUB_EMAIL_BACKEND} + - RESPONSE_URI=https://idhub1-setem.demo.pangea.org/oidc4vp/ + - ALLOW_CODE_URI=https://idhub1-setem.demo.pangea.org/oidc4vp/allow_code + - SUPPORTED_CREDENTIALS=['MembershipCard'] + ports: + - 9003:9001 + volumes: + - ./idhub1__pilot-setem:/opt/idhub + - sharedsecret:/sharedsecret:rw + + idhub2: + container_name: idhub2 + init: true + image: dkr-dsg.ac.upc.edu/trustchain-oc1-orchestral/idhub:latest + environment: + - DEPLOYMENT=${IDHUB_DEPLOYMENT} + - SECRET_KEY=${IDHUB_SECRET_KEY:-publicsecretisnotsecureVtmKBfxpVV47PpBCF2Nzz2H6qnbd} + - ALLOWED_HOSTS=${IDHUB_ALLOWED_HOSTS:-*} + - STATIC_ROOT=${IDHUB_STATIC_ROOT:-/static/} + - MEDIA_ROOT=${IDHUB_MEDIA_ROOT:-/media/} + - PORT=${IDHUB_PORT:-9002} + - DJANGO_SUPERUSER_USERNAME=${IDHUB_USER} + - DJANGO_SUPERUSER_PASSWORD=${IDHUB_PASSWD} + - DJANGO_SUPERUSER_EMAIL=${IDHUB_EMAIL} + - CSRF_TRUSTED_ORIGINS=https://idhub2-setem.demo.pangea.org + - DEFAULT_FROM_EMAIL=${IDHUB_DEFAULT_FROM_EMAIL} + - EMAIL_HOST=${IDHUB_EMAIL_HOST} + - EMAIL_HOST_USER=${IDHUB_EMAIL_HOST_USER} + - EMAIL_HOST_PASSWORD=${IDHUB_EMAIL_HOST_PASSWORD} + - EMAIL_PORT=${IDHUB_EMAIL_PORT} + - EMAIL_USE_TLS=${IDHUB_EMAIL_USE_TLS} + - EMAIL_BACKEND=${IDHUB_EMAIL_BACKEND} + - RESPONSE_URI=https://idhub2-setem.demo.pangea.org/oidc4vp/ + - ALLOW_CODE_URI=https://idhub2-setem.demo.pangea.org/oidc4vp/allow_code + - SUPPORTED_CREDENTIALS=['MembershipCard'] + ports: + - 9004:9002 + volumes: + - ./idhub2__pilot-setem:/opt/idhub + - sharedsecret:/sharedsecret:rw + +volumes: + sharedsecret: