@@ -4,35 +4,53 @@ GREEN='\033[0;32m'
44ORANGE=' \033[0;33m'
55BLUE=' \033[0;34m'
66NOCOLOR=' \033[0m'
7+ VINKJE=" ${GREEN} ✔${NOCOLOR} "
78CWD=$( dirname $0 )
89manageurl=https://manage.dev.openconext.local/manage/api/internal/
910
1011set -e
1112
1213# Bootstrapping engineblock means initialising the database
1314printf " \n"
14- echo " Bring up the engineblock container to bootstrap the database"
15+ echo -e " ${ORANGE} Bring up the engineblock container to bootstrap the database${NOCOLOR} "
16+ echo
17+
18+ # Wait for engine to come up; not health yet because we might nee to initialialize db
1519docker compose up -d engine mariadb
16- # Wait for engine to come up
17- docker compose exec engine timeout 300 bash -c ' while [[ "$(curl -k -s -o /dev/null -w ' ' %{http_code}' ' localhost/info)" != "200" ]]; do sleep 5; done' || false
20+ docker compose exec engine timeout 300 bash -c ' while [[ "$(curl -k -s -o /dev/null -w ' ' %{http_code}' ' localhost/internal/info)" != "200" ]]; do sleep 5; done' || false
1821
19- echo -e " ${ORANGE} First, we will initialise the EB database$NOCOLOR ${GREEN} \xE2\x9C\x94${NOCOLOR} "
22+ echo
23+ echo -e " ${ORANGE} Initializing EB database$NOCOLOR ${VINKJE} "
24+ echo
2025echo " Checking if the database is already present"
21- if ! docker compose exec engine /var/www/html/bin/console doctrine:schema:validate -q --skip-mapping --env=prod; then
26+ if ! docker compose exec engine /var/www/html/bin/console doctrine:schema:validate -q --skip-mapping --env=prod > /dev/null
27+ then
2228 echo creating the database schema
23- echo " Executing docker compose exec engine /var/www/html/bin/console doctrine:schema:create --env prod "
24- docker compose exec engine /var/www/html/bin/console doctrine:schema:create --env prod
25- # TODO: Use migrations instead of schema:create. Not both. @see https://github.com/OpenConext/OpenConext-engineblock/issues/1861
29+ cmd= ' docker compose exec engine /var/www/html/bin/console doctrine:schema:update --force -q '
30+ # echo "Executing: ${cmd}"
31+ ${cmd}
2632fi
2733echo " Clearing the cache"
28- echo " Executing docker compose exec engine /var/www/html/bin/console cache:clear -n --env=prod"
2934docker compose exec engine /var/www/html/bin/console cache:clear -n --env=prod
3035docker compose exec engine chown -R www-data:www-data /var/www/html/var/cache/
3136
37+ echo -ne " Waiting for EB to be healthy..."
38+ until [ " $( docker inspect -f {{.State.Health.Status}} $( docker compose ps -q engine) ) " == " healthy" ]
39+ do
40+ echo -n " ."
41+ sleep 0.5;
42+ done
43+ echo -e " ${VINKJE} "
44+
3245# Now it's time to bootstrap manage
3346# Bring up containers needed for bootstrapping manage
47+ echo
48+ echo -e " ${ORANGE} Bring up the core containers${NOCOLOR} ${VINKJE} "
49+ echo
3450docker compose --profile oidc up -d --wait
35- echo -e " ${ORANGE} Adding the manage entities${NOCOLOR}${GREEN} \xE2\x9C\x94${NOCOLOR} "
51+ echo
52+
53+ echo -e " ${ORANGE} Adding the manage entities${NOCOLOR} ${VINKJE} "
3654printf " \n"
3755for i in " $CWD " /* .json; do
3856 entityid=$( grep ' "entityid":' " $i " | awk -F' "' ' {print $4}' )
@@ -58,11 +76,11 @@ for i in "$CWD"/*.json; do
5876 fi
5977done
6078printf " \n"
61- echo -e " ${ORANGE} Send a PUSH in Manage, which pushes the entities to EngineBlock and OIDCNG${NOCOLOR}${GREEN} \xE2\x9C\x94 ${NOCOLOR }"
79+ echo -e " ${ORANGE} Send a PUSH in Manage, which pushes the entities to EngineBlock and OIDCNG ${VINKJE }"
6280docker compose exec managegui curl -q -s -k -u sysadmin:secret $manageurl /push > /dev/null
6381
6482printf " \n"
65- echo -e " ${BLUE} Please add the following line to your /etc/hosts:${NOCOLOR}${GREEN} \xE2\x9C\x94 ${NOCOLOR }"
83+ echo -e " ${BLUE} Please add the following line to your /etc/hosts: ${VINKJE }"
6684printf " \n"
6785
6886echo " 127.0.0.1 engine.dev.openconext.local manage.dev.openconext.local profile.dev.openconext.local engine-api.dev.openconext.local mujina-idp.dev.openconext.local profile.dev.openconext.local connect.dev.openconext.local teams.dev.openconext.local voot.dev.openconext.local invite.dev.openconext.local welcome.dev.openconext.local"
0 commit comments