Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/stepup-behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
25 changes: 14 additions & 11 deletions core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down
36 changes: 15 additions & 21 deletions core/scripts/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,26 @@ set -e

# Bootstrapping engineblock means initialising the database
printf "\n"
echo -e "${ORANGE}Bring up the engineblock container to bootstrap the database${NOCOLOR}"
echo

# Wait for engine to come up; not health yet because we might nee to initialialize db
docker compose up -d engine mariadb
# 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
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
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/
Expand All @@ -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
Expand Down Expand Up @@ -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"
Loading