bugfix namespace, build__all script, simple pilots

- build__all.sh
- build__common.sh (includes common_start and common_end) which
  simplifies pilots
This commit is contained in:
pedro 2024-01-19 11:01:49 +01:00
parent 00360491ec
commit 3af59e9423
6 changed files with 109 additions and 59 deletions

17
build__all.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
set -e
set -u
# DEBUG
set -x
main() {
action="${action:-deploy}"
export deployment='prod'
./build__pilot-xo9b.sh
./build__pilot-setem.sh
./build__pilot-lafede.sh
./build__pilot-pangea.sh
}
main "${@}"

43
build__common.sh Normal file
View File

@ -0,0 +1,43 @@
#!/bin/sh
set -e
set -u
# DEBUG
#set -x
common_start() {
figlet "${pilot}"
deployment="${1:-${deployment:-}}"
action="${action:-deploy}"
# detach on production deployment
if [ "${deployment}" = 'prod' ]; then
detach='-d'
fi
# ensure uses pilot-pangea branch
(
cd ./IdHub
git checkout ${pilot}
)
# some pilots might use idhub1 and/or idhub2
idhub1="idhub1__${pilot}"
idhub2="idhub2__${pilot}"
# force recreate
rm -rf "./${idhub1}" "./${idhub2}"
}
common_end() {
idhub_dc_f="docker-compose__${pilot}.yml"
docker compose -p ${pilot} -f ${idhub_dc_f} down -v || true
make idhub_build
if [ "${action:-}" = "deploy" ]; then
docker compose -p ${pilot} -f ${idhub_dc_f} up ${detach:-}
fi
}

View File

@ -7,24 +7,14 @@ set -x
# a wallet and verifier idhub for pilot-lafede
main() {
deployment="${1:-}"
# detach on production deployment
if [ "${deployment}" = 'prod' ]; then
detach='-d'
fi
# ensure uses pilot-lafede branch
(
cd ./IdHub
git checkout pilot-lafede
)
# includes functions:
# common_start
# common_end
. ./build__common.sh
pilot='pilot-lafede'
local idhub1="idhub1__${pilot}"
# force recreate
rm -rf "./${idhub1}"
common_start
# detect if is new
if [ ! -f "./${idhub1}" ]; then
@ -33,10 +23,7 @@ main() {
rm -f "${idhub1}/db.sqlite3"
fi
idhub_dc_f="docker-compose__${pilot}.yml"
docker compose -p ${pilot} -f ${idhub_dc_f} down -v || true
make idhub_build \
&& docker compose -p ${pilot} -f ${idhub_dc_f} up ${detach:-}
common_end
}
main "${@}"

31
build__pilot-pangea.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/sh
set -e
set -u
# DEBUG
set -x
# a wallet and verifier idhub for pilot-pangea
main() {
# includes functions:
# common_start
# common_end
. ./build__common.sh
pilot='pilot-pangea'
common_start
# 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
common_end
}
main "${@}"

View File

@ -7,25 +7,14 @@ 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
)
# includes functions:
# common_start
# common_end
. ./build__common.sh
pilot='pilot-setem'
local idhub1="idhub1__${pilot}"
local idhub2="idhub2__${pilot}"
# force recreate
rm -rf "./${idhub1}" "./${idhub2}"
common_start
# detect if is new
if [ ! -f "./${idhub1}" ] && [ ! -f "./${idhub2}" ]; then
@ -36,10 +25,7 @@ main() {
rm -f "${idhub2}/db.sqlite3"
fi
idhub_dc_f="docker-compose__${pilot}.yml"
docker compose -p ${pilot} -f ${idhub_dc_f} down -v || true
make idhub_build \
&& docker compose -p ${pilot} -f ${idhub_dc_f} up ${detach:-}
common_end
}
main "${@}"

View File

@ -7,25 +7,14 @@ set -x
# a wallet and verifier idhub for pilot-xo9b
main() {
deployment="${1:-}"
# detach on production deployment
if [ "${deployment}" = 'prod' ]; then
detach='-d'
fi
# ensure uses pilot-xo9b branch
(
cd ./IdHub
git checkout pilot-xo9b
)
# includes functions:
# common_start
# common_end
. ./build__common.sh
pilot='pilot-xo9b'
local idhub1="idhub1__${pilot}"
local idhub2="idhub2__${pilot}"
# force recreate
rm -rf "./${idhub1}" "./${idhub2}"
common_start
# detect if is new
if [ ! -f "./${idhub1}" ] && [ ! -f "./${idhub2}" ]; then
@ -36,10 +25,7 @@ main() {
rm -f "${idhub2}/db.sqlite3"
fi
idhub_dc_f="docker-compose__${pilot}.yml"
docker compose -p ${pilot} -f ${idhub_dc_f} down -v || true
make idhub_build \
&& docker compose -p ${pilot} -f ${idhub_dc_f} up ${detach:-}
common_end
}
main "${@}"