@@ -16,21 +16,35 @@ printf "\n"
1616# Check that engine and mariadb are already running; containers must be started via ./start-dev-env.sh first
1717engine_running=$( docker compose ps -q --status running engine mariadb | wc -l)
1818if [[ " $engine_running " -lt 2 ]]; then
19- echo -e " ${RED} ERROR: engine and/or mariadb are not running.${NOCOLOR} "
20- echo -e " ${ORANGE} Please start the environment first by running:${NOCOLOR} "
21- echo -e " ${GREEN} ./start-dev-env.sh${NOCOLOR} "
22- echo -e " Then re-run this script once the containers are up."
23- exit 1
19+ if [[ " ${GITHUB_ACTIONS} " == " true" ]]; then
20+ docker compose up -d engine mariadb
21+ echo -e " ${ORANGE} Bringing up the EB production container for migrations${NOCOLOR} "
22+ else
23+ echo -e " ${RED} ERROR: engine and/or mariadb are not running.${NOCOLOR} "
24+ echo -e " ${ORANGE} Please start the environment first by running:${NOCOLOR} "
25+ echo -e " ${GREEN} ./start-dev-env.sh${NOCOLOR} "
26+ echo -e " Then re-run this script once the containers are up."
27+ exit 1
28+ fi
2429fi
2530echo -e " ${ORANGE} Using the currently running engine container for migrations${NOCOLOR} "
2631docker 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
2732
2833echo
2934echo -e " ${ORANGE} Initializing EB database$NOCOLOR ${VINKJE} "
3035echo
31- echo " Running database migrations"
32- cmd=' docker compose exec engine /var/www/html/bin/console doctrine:migrations:migrate --no-interaction'
33- ${cmd}
36+ if [[ " ${GITHUB_ACTIONS} " == " true" ]]; then
37+ echo " Checking if the database is already present"
38+ if ! docker compose exec engine /var/www/html/bin/console doctrine:schema:validate -q --skip-mapping --env=prod > /dev/null 2>&1
39+ then
40+ echo " Creating the database schema"
41+ docker compose exec engine /var/www/html/bin/console doctrine:schema:update --force -q
42+ fi
43+ else
44+ echo " Running database migrations"
45+ cmd=' docker compose exec engine /var/www/html/bin/console doctrine:migrations:migrate --no-interaction'
46+ ${cmd}
47+ fi
3448
3549echo " Clearing the cache"
3650docker compose exec engine /var/www/html/bin/console cache:clear -n --env=prod
4458done
4559echo -e " ${VINKJE} "
4660
61+ if [[ " ${GITHUB_ACTIONS} " == " true" ]]; then
62+ echo
63+ echo -e " ${ORANGE} Bring up the core containers${NOCOLOR} ${VINKJE} "
64+ echo
65+ docker compose --profile oidc up -d --wait
66+ echo
67+ fi
68+
4769echo -e " ${ORANGE} Adding the manage entities${NOCOLOR} ${VINKJE} "
4870printf " \n"
4971for i in " $CWD " /* .json; do
0 commit comments