Compare commits

...

2 commits

Author SHA1 Message Date
pedro 1e1a339917 idhub.entrypoint: refactor oidc waiting interval
instead of sleep, waits that all idhubs have wrote its content in
/sharedsecret/ dir
2024-03-18 10:05:16 +01:00
pedro d990d46dd9 pilot xo9b: add idhub3 2024-03-18 09:32:43 +01:00
2 changed files with 44 additions and 4 deletions

View file

@ -55,5 +55,31 @@ services:
- ./idhub2__pilot-xo9b:/opt/idhub
- sharedsecret:/sharedsecret:rw
idhub3:
init: true
image: dkr-dsg.ac.upc.edu/trustchain-oc1-orchestral/idhub:latest
environment:
- DOMAIN=idhub3-xo9b.demo.pangea.org
- SECRET_KEY=${IDHUB_SECRET_KEY:-publicsecretisnotsecureVtmKBfxpVV47PpBCF2Nzz2H6qnbd}
- STATIC_ROOT=${IDHUB_STATIC_ROOT:-/static/}
- MEDIA_ROOT=${IDHUB_MEDIA_ROOT:-/media/}
- PORT=${IDHUB_PORT:-9003}
- 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}
- SUPPORTED_CREDENTIALS=['FinancialVulnerabilityCredential']
- SYNC_ORG_DEV=${IDHUB_SYNC_ORG_DEV}
- OIDC_ORGS=examples/organizations__pilot_xo9b.csv
- OIDC_REDIRECT=true
ports:
- 9003:9003
volumes:
- ./idhub3__pilot-xo9b:/opt/idhub
- sharedsecret:/sharedsecret:rw
volumes:
sharedsecret:

View file

@ -35,6 +35,10 @@ deployment_strategy() {
# warn admin that it should re-enter password to keep the service working
./manage.py send_mail_admins
else
# this file helps all docker containers to guess number of hosts involved
# right now is only needed by new deployment for oidc
touch /sharedsecret/${DOMAIN}
# move the migrate thing in docker entrypoint
# inspired by https://medium.com/analytics-vidhya/django-with-docker-and-docker-compose-python-part-2-8415976470cc
echo "INFO detected NEW deployment"
@ -60,14 +64,24 @@ _get() {
sqlite3 -json db.sqlite3 "select * from oidc4vp_organization;"
}
_lines () {
local myfile="${1}"
cat "${myfile}" | wc -l
}
config_oidc4vp() {
# populate your config
local file="${DOMAIN}"
data="$(_get)"
echo "${data}" | jq --arg domain "${DOMAIN}" '{ ($domain): .}' > /sharedsecret/${file}
echo "${data}" | jq --arg domain "${DOMAIN}" '{ ($domain): .}' > /sharedsecret/${DOMAIN}
echo wait the other idhubs to write, this is the only oportunity to sync with other idhubs in the docker compose
sleep 2
while true; do
echo wait the other idhubs to write, this is the only oportunity to sync with other idhubs in the docker compose
## break when no empty files left
if ! wc -l /sharedsecret/* | awk '{print $1;}' | grep -qE '^0$'; then
break
fi
sleep 1
done
# get other configs
for host in /sharedsecret/*; do
# we are flexible on querying for DOMAIN: the first one based on regex