2024-01-19 10:01:49 +00:00
|
|
|
#!/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
|
|
|
|
|
2024-01-23 09:42:42 +00:00
|
|
|
# ensure uses pilot-pangea branch and it is up to date
|
2024-01-19 10:01:49 +00:00
|
|
|
(
|
|
|
|
cd ./IdHub
|
2024-01-23 09:42:42 +00:00
|
|
|
if [ -d .git ]; then
|
|
|
|
#git checkout ${pilot}
|
|
|
|
git checkout main
|
|
|
|
git pull
|
|
|
|
fi
|
2024-01-19 10:01:49 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# some pilots might use idhub1 and/or idhub2
|
|
|
|
idhub1="idhub1__${pilot}"
|
|
|
|
idhub2="idhub2__${pilot}"
|
|
|
|
|
|
|
|
# force recreate
|
|
|
|
rm -rf "./${idhub1}" "./${idhub2}"
|
|
|
|
}
|
|
|
|
|
|
|
|
common_end() {
|
|
|
|
|
2024-01-24 13:49:17 +00:00
|
|
|
dc_file="docker-compose__${pilot}.yml"
|
|
|
|
docker compose -p ${pilot} -f ${dc_file} down -v || true
|
2024-01-19 10:01:49 +00:00
|
|
|
make idhub_build
|
|
|
|
|
|
|
|
if [ "${action:-}" = "deploy" ]; then
|
2024-01-24 13:49:17 +00:00
|
|
|
docker compose -p ${pilot} -f ${dc_file} up ${detach:-}
|
2024-01-19 10:01:49 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
}
|