From ba22fbb915272f9dbda9358691eccd0d7ed0c9ba Mon Sep 17 00:00:00 2001 From: Johan Kromhout Date: Mon, 23 Feb 2026 15:27:48 +0100 Subject: [PATCH 1/4] Init EB DB using migrations instead of schema:create Prior to this change, the EB DB schema in devconf would deviate from the migrations (prod) database, because new changes would be applied automatically via schema:create instead of applying the migrations. This change ensures the EB DB is bootstrapped using the database migrations to match prod. Resolves: https://github.com/OpenConext/OpenConext-engineblock/issues/1861 --- core/scripts/init.sh | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/core/scripts/init.sh b/core/scripts/init.sh index 52dd61e..6ba1c94 100755 --- a/core/scripts/init.sh +++ b/core/scripts/init.sh @@ -12,7 +12,8 @@ set -e # Bootstrapping engineblock means initialising the database printf "\n" -echo -e "${ORANGE}Bring up the engineblock container to bootstrap the database${NOCOLOR}" +echo -e "${ORANGE}Bring up the engineblock Production container to bootstrap the database using the Production container's migrations${NOCOLOR}" +echo "Comment the two lines below to run the migrations from your own running engine container (ensure your EB is running)." echo # Wait for engine to come up; not health yet because we might nee to initialialize db @@ -22,14 +23,10 @@ docker compose exec engine timeout 300 bash -c 'while [[ "$(curl -k -s -o /dev/n echo echo -e "${ORANGE}Initializing EB database$NOCOLOR ${VINKJE}" echo -echo "Checking if the database is already present" -if ! docker compose exec engine /var/www/html/bin/console doctrine:schema:validate -q --skip-mapping --env=prod > /dev/null -then - echo creating the database schema - cmd='docker compose exec engine /var/www/html/bin/console doctrine:schema:update --force -q' - #echo "Executing: ${cmd}" - ${cmd} -fi +echo "Running database migrations" +cmd='docker compose exec engine /var/www/html/bin/console doctrine:migrations:migrate --no-interaction' +${cmd} + echo "Clearing the cache" docker compose exec engine /var/www/html/bin/console cache:clear -n --env=prod docker compose exec engine chown -R www-data:www-data /var/www/html/var/cache/ From b140e83010f88299d9c6a2142c02330ed1322cb3 Mon Sep 17 00:00:00 2001 From: Johan Kromhout Date: Tue, 24 Feb 2026 14:05:44 +0100 Subject: [PATCH 2/4] Improve engine container startup logic for migrations Prior to this change, the script always attempted to bring up the engine and mariadb containers, regardless of their current status. This change checks if the engine and mariadb containers are already running before attempting to start them, providing clearer messaging based on the situation. --- core/scripts/init.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/core/scripts/init.sh b/core/scripts/init.sh index 6ba1c94..571f4aa 100755 --- a/core/scripts/init.sh +++ b/core/scripts/init.sh @@ -12,12 +12,15 @@ set -e # Bootstrapping engineblock means initialising the database printf "\n" -echo -e "${ORANGE}Bring up the engineblock Production container to bootstrap the database using the Production container's migrations${NOCOLOR}" -echo "Comment the two lines below to run the migrations from your own running engine container (ensure your EB is running)." -echo # Wait for engine to come up; not health yet because we might nee to initialialize db -docker compose up -d engine mariadb +engine_running=$(docker compose ps -q --status running engine mariadb | wc -l) +if [[ "$engine_running" -lt 2 ]]; then + docker compose up -d engine mariadb + echo -e "${ORANGE}Bringing up the EB production container for migrations${NOCOLOR}" +else + echo -e "${ORANGE}Using the currently running engine container for migrations${NOCOLOR}" +fi 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 echo From fd66dbba68d7d359b2429dda8fc7b9639346929d Mon Sep 17 00:00:00 2001 From: Johan Kromhout Date: Tue, 24 Feb 2026 14:45:22 +0100 Subject: [PATCH 3/4] Improve init script by removing `docker compose up` script Prior to this change, the init script would re-create some containers, but with an unexpected APP_ENV variable. To reduce complexity, this change requires the user to run the start script, and then run the init script. Co-authored-by: Kay Joosten --- core/README.md | 25 ++++++++++++++----------- core/scripts/init.sh | 22 ++++++++-------------- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/core/README.md b/core/README.md index b97095f..807b0a9 100644 --- a/core/README.md +++ b/core/README.md @@ -8,30 +8,36 @@ This repo contains a docker compose and some configuration to get you started wi ## Getting started ### The first time -If you are doing this for the first time, you need to run a script to seed the environment: +If you are doing this for the first time, first start the environment and then seed it: +1. Start the environment: +``` +./start-dev-env.sh +``` + +2. Once all containers are up, seed the environment: ``` ./scripts/init.sh ``` ### After initialisation -To get all services up and running you must have docker compose installed. Enter this command to get things up and running: +To start the environment again after the initial setup: ``` -docker compose up -d +./start-dev-env.sh ``` You will also need to tell your local machine where to find the hosts. -Add the following line in your hosts file (/etc/hosts ) +Add the following line in your hosts file (/etc/hosts): ``` 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 pdp.dev.openconext.local invite.dev.openconext.local welcome.dev.openconext.local ``` -If all goes wel, you can now login. Please see the section below to find out where you can login. +If all goes well, you can now login. Please see the section below to find out where you can login. -*Please note that this starts the environment with the profile oidc. Bringing it down requires this command:* +To bring the environment down: ``` -docker compose --profile oidc down +./stop-dev-env.sh ``` ## Services @@ -68,10 +74,7 @@ Since the OpenConext suite is composed of multiple docker containers, you can us - invite: Starts services needed for Openconext-Invite (oidcng, voot and teams) - extras: Starts extras (currently pdp) -If you want to start all services, you can use extras. A profile can be started by using the --profile argument to the `docker compose up` command. For example: -``` -docker compose up -d --profile extras -``` +Profiles are handled automatically by `./start-dev-env.sh`. The `oidc` and `test` profiles are enabled by default. To enable additional profiles, edit the script directly. # Starting a PHP project in development mode (only lifecycle, profile and engineblock) diff --git a/core/scripts/init.sh b/core/scripts/init.sh index 571f4aa..8bba6c5 100755 --- a/core/scripts/init.sh +++ b/core/scripts/init.sh @@ -13,14 +13,16 @@ set -e # Bootstrapping engineblock means initialising the database printf "\n" -# Wait for engine to come up; not health yet because we might nee to initialialize db +# Check that engine and mariadb are already running; containers must be started via ./start-dev-env.sh first engine_running=$(docker compose ps -q --status running engine mariadb | wc -l) if [[ "$engine_running" -lt 2 ]]; then - docker compose up -d engine mariadb - echo -e "${ORANGE}Bringing up the EB production container for migrations${NOCOLOR}" -else - echo -e "${ORANGE}Using the currently running engine container for migrations${NOCOLOR}" + echo -e "${RED}ERROR: engine and/or mariadb are not running.${NOCOLOR}" + echo -e "${ORANGE}Please start the environment first by running:${NOCOLOR}" + echo -e " ${GREEN}./start-dev-env.sh${NOCOLOR}" + echo -e "Then re-run this script once the containers are up." + exit 1 fi +echo -e "${ORANGE}Using the currently running engine container for migrations${NOCOLOR}" 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 echo @@ -42,14 +44,6 @@ do done echo -e " ${VINKJE}" -# Now it's time to bootstrap manage -# Bring up containers needed for bootstrapping manage -echo -echo -e "${ORANGE}Bring up the core containers${NOCOLOR} ${VINKJE}" -echo -docker compose --profile oidc up -d --wait -echo - echo -e "${ORANGE}Adding the manage entities${NOCOLOR} ${VINKJE}" printf "\n" for i in "$CWD"/*.json; do @@ -87,5 +81,5 @@ echo "127.0.0.1 engine.dev.openconext.local manage.dev.openconext.local profile. printf "\n" echo "You can now login. If you want to bring the environment down, use the command below" -echo "docker compose --profile oidc down" +echo "./stop-dev-env.sh" printf "\n" From 0e549a9a54656d93897cf39e5880b37517e02033 Mon Sep 17 00:00:00 2001 From: Johan Kromhout Date: Tue, 24 Feb 2026 15:09:35 +0100 Subject: [PATCH 4/4] Allow pipeline to run for max 10 minutes instead of 5 Pulling images is slow, taking > 3 minutes. This change ensures pipeline has enough time to run, before being killed. --- .github/workflows/stepup-behat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stepup-behat.yml b/.github/workflows/stepup-behat.yml index f27818e..cd06b90 100644 --- a/.github/workflows/stepup-behat.yml +++ b/.github/workflows/stepup-behat.yml @@ -9,7 +9,7 @@ on: jobs: build: runs-on: ubuntu-latest - timeout-minutes: 5 + timeout-minutes: 10 env: DOCKER_COMPOSE: docker compose --profile smoketest -f docker-compose.yml steps: