-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathinit-environment.sh
executable file
·51 lines (42 loc) · 1.17 KB
/
init-environment.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
MONGO_VERSION="7.0.14"
KEYCLOAK_VERSION="26.0.1"
source scripts/my-functions.sh
echo
echo "Starting environment"
echo "===================="
echo
echo "Creating network"
echo "----------------"
docker network create springboot-keycloak-mongodb-testcontainers-net
echo
echo "Starting mongodb"
echo "----------------"
docker run -d \
--name mongodb \
-p 27017:27017 \
--restart=unless-stopped \
--network=springboot-keycloak-mongodb-testcontainers-net \
--health-cmd="echo 'db.stats().ok' | mongosh localhost:27017/bookdb --quiet" \
mongo:${MONGO_VERSION}
echo
echo "Starting keycloak"
echo "-----------------"
docker run -d \
--name keycloak \
-p 8080:8080 \
-e KEYCLOAK_ADMIN=admin \
-e KEYCLOAK_ADMIN_PASSWORD=admin \
-e KC_DB=dev-mem \
--restart=unless-stopped \
--network=springboot-keycloak-mongodb-testcontainers-net \
--health-cmd="curl -f http://localhost:8080/health/ready || exit 1" \
quay.io/keycloak/keycloak:${KEYCLOAK_VERSION} start-dev
echo
wait_for_container_log "mongodb" "Waiting for connections"
echo
wait_for_container_log "keycloak" "started in"
echo
echo "Environment Up and Running"
echo "=========================="
echo