-
-
Notifications
You must be signed in to change notification settings - Fork 158
/
init-environment.sh
executable file
·70 lines (56 loc) · 1.44 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env bash
MONGO_VERSION="7.0.14"
POSTGRES_VERSION="17.0"
KEYCLOAK_VERSION="25.0.6"
source scripts/my-functions.sh
echo
echo "Starting environment"
echo "===================="
echo
echo "Creating network"
echo "----------------"
docker network create springboot-react-keycloak-net
echo
echo "Starting mongodb"
echo "----------------"
docker run -d \
--name mongodb \
-p 27017:27017 \
--network=springboot-react-keycloak-net \
mongo:${MONGO_VERSION}
echo
echo "Starting postgres"
echo "-----------------"
docker run -d \
--name postgres \
-p 5432:5432 \
-e POSTGRES_DB=keycloak \
-e POSTGRES_USER=keycloak \
-e POSTGRES_PASSWORD=password \
--network=springboot-react-keycloak-net \
postgres:${POSTGRES_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=postgres \
-e KC_DB_URL_HOST=postgres \
-e KC_DB_URL_DATABASE=keycloak \
-e KC_DB_USERNAME=keycloak \
-e KC_DB_PASSWORD=password \
--network=springboot-react-keycloak-net \
quay.io/keycloak/keycloak:${KEYCLOAK_VERSION} start-dev
echo
wait_for_container_log "mongodb" "Waiting for connections"
echo
wait_for_container_log "postgres" "database system is ready"
echo
wait_for_container_log "keycloak" "started in"
echo
echo "Environment Up and Running"
echo "=========================="
echo