-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.sh
More file actions
executable file
·96 lines (79 loc) · 2.1 KB
/
Copy pathdev.sh
File metadata and controls
executable file
·96 lines (79 loc) · 2.1 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
cleanup() {
docker rm -f synapse &>/dev/null || :
docker rm -f postgres &>/dev/null || :
pkill -P $$ || :
wait
}
trap cleanup EXIT
cleanup
printf "Preparing synapse configuration\n"
docker run --rm \
--mount type=bind,source="$(pwd)"/local-server/data,target=/data \
-e SYNAPSE_SERVER_NAME=localhost \
-e SYNAPSE_REPORT_STATS=no \
matrixdotorg/synapse:latest generate
printf "Starting synapse\n"
docker run -d --name synapse \
--mount type=bind,source="$(pwd)"/local-server/data,target=/data \
-p 8008:8008 \
matrixdotorg/synapse:latest >/dev/null
printf "Starting postgres\n"
docker run -d --name postgres -p5432:5432 \
-ePOSTGRES_DB=registration-service-db -ePOSTGRES_USER=registration-service -ePOSTGRES_PASSWORD=password postgres:15 >/dev/null
printf "Starting registration-service\n"
(
cd ../registration-service/backend
REGSERVICE_MATRIX_CLIENT_SCHEME=http \
REGSERVICE_MATRIX_CLIENT_PORT=8008 \
REGSERVICE_MATRIX_SERVER_SCHEME=http \
REGSERVICE_MATRIX_SERVER_PORT=8008 \
SPRING_PROFILES_ACTIVE=local \
mvn spring-boot:run &>/dev/null
) &
printf "Starting vzd-mock\n"
(
cd ../vzd-mock
SERVER_PORT=8090 mvn spring-boot:run &>/dev/null
) &
(
await_synapse() {
while ! docker exec synapse curl -fs --head http://localhost:8008 >/dev/null; do
printf "S"
sleep 0.5
done
}
await_postgres() {
while ! nc -z localhost 5432 </dev/null &>/dev/null; do
printf "P"
sleep 0.5
done
}
await_regservice() {
while ! nc -z localhost 8080 </dev/null &>/dev/null; do
printf "R"
sleep 0.5
done
}
await_vzd() {
while ! nc -z localhost 8090 </dev/null &>/dev/null; do
printf "V"
sleep 0.5
done
}
await_synapse &
await_postgres &
await_regservice &
await_vzd &
wait
printf "\nServices started\n"
)
printf "Ensuring admin account\n"
docker exec -it synapse register_new_matrix_user http://localhost:8008 -c /data/homeserver.yaml -a -u admin -p admin &>/dev/null || :
REACT_APP_SERVER=http://localhost:8008 \
REACT_APP_VZD=http://localhost:8090 \
REACT_APP_REGSERVICE=http://localhost:8080/backend/regservice \
yarn start