Skip to content

Commit fd66dbb

Browse files
johanibkayjoosten
andcommitted
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 <kay.joosten@dawn.tech>
1 parent b140e83 commit fd66dbb

2 files changed

Lines changed: 22 additions & 25 deletions

File tree

core/README.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,36 @@ This repo contains a docker compose and some configuration to get you started wi
88
## Getting started
99

1010
### The first time
11-
If you are doing this for the first time, you need to run a script to seed the environment:
11+
If you are doing this for the first time, first start the environment and then seed it:
1212

13+
1. Start the environment:
14+
```
15+
./start-dev-env.sh
16+
```
17+
18+
2. Once all containers are up, seed the environment:
1319
```
1420
./scripts/init.sh
1521
```
1622

1723
### After initialisation
18-
To get all services up and running you must have docker compose installed. Enter this command to get things up and running:
24+
To start the environment again after the initial setup:
1925

2026
```
21-
docker compose up -d
27+
./start-dev-env.sh
2228
```
2329

2430
You will also need to tell your local machine where to find the hosts.
25-
Add the following line in your hosts file (/etc/hosts )
31+
Add the following line in your hosts file (/etc/hosts):
2632
```
2733
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
2834
```
2935

30-
If all goes wel, you can now login. Please see the section below to find out where you can login.
36+
If all goes well, you can now login. Please see the section below to find out where you can login.
3137

32-
*Please note that this starts the environment with the profile oidc. Bringing it down requires this command:*
38+
To bring the environment down:
3339
```
34-
docker compose --profile oidc down
40+
./stop-dev-env.sh
3541
```
3642

3743
## Services
@@ -68,10 +74,7 @@ Since the OpenConext suite is composed of multiple docker containers, you can us
6874
- invite: Starts services needed for Openconext-Invite (oidcng, voot and teams)
6975
- extras: Starts extras (currently pdp)
7076

71-
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:
72-
```
73-
docker compose up -d --profile extras
74-
```
77+
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.
7578

7679
# Starting a PHP project in development mode (only lifecycle, profile and engineblock)
7780

core/scripts/init.sh

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ set -e
1313
# Bootstrapping engineblock means initialising the database
1414
printf "\n"
1515

16-
# Wait for engine to come up; not health yet because we might nee to initialialize db
16+
# Check that engine and mariadb are already running; containers must be started via ./start-dev-env.sh first
1717
engine_running=$(docker compose ps -q --status running engine mariadb | wc -l)
1818
if [[ "$engine_running" -lt 2 ]]; then
19-
docker compose up -d engine mariadb
20-
echo -e "${ORANGE}Bringing up the EB production container for migrations${NOCOLOR}"
21-
else
22-
echo -e "${ORANGE}Using the currently running engine container for migrations${NOCOLOR}"
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
2324
fi
25+
echo -e "${ORANGE}Using the currently running engine container for migrations${NOCOLOR}"
2426
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
2527

2628
echo
@@ -42,14 +44,6 @@ do
4244
done
4345
echo -e " ${VINKJE}"
4446

45-
# Now it's time to bootstrap manage
46-
# Bring up containers needed for bootstrapping manage
47-
echo
48-
echo -e "${ORANGE}Bring up the core containers${NOCOLOR} ${VINKJE}"
49-
echo
50-
docker compose --profile oidc up -d --wait
51-
echo
52-
5347
echo -e "${ORANGE}Adding the manage entities${NOCOLOR} ${VINKJE}"
5448
printf "\n"
5549
for i in "$CWD"/*.json; do
@@ -87,5 +81,5 @@ echo "127.0.0.1 engine.dev.openconext.local manage.dev.openconext.local profile.
8781

8882
printf "\n"
8983
echo "You can now login. If you want to bring the environment down, use the command below"
90-
echo "docker compose --profile oidc down"
84+
echo "./stop-dev-env.sh"
9185
printf "\n"

0 commit comments

Comments
 (0)