-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathrun.sh
executable file
·65 lines (58 loc) · 2.97 KB
/
run.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
#######################################
# Spin up OpenMRS , OpenHIM and HAPI FHIR
#######################################
echo "..STARTING OPENHIM , OPENMRS , HAPI-FHIR "
docker-compose -f docker/docker-compose.yml up -d --remove-orphans
sleep 3m
#######################################
# Check whether OpenMRS is Started
#######################################
openmrs_start_wait_time=0
contenttype=$(curl -o /dev/null --head -w "%{content_type}\n" -X GET -u admin:Admin123 --connect-timeout 5 \
--max-time 20 http://localhost:8080/openmrs/ws/fhir2/R4/metadata 2>/dev/null | cut -d ";" -f 1)
until [[ ${contenttype} == "application/fhir+json" ]]; do
sleep 60s
echo "..WAITING FOR OPENMRS SERVER TO START"
contenttype=$(curl -o /dev/null --head -w "%{content_type}\n" -X GET -u admin:Admin123 --connect-timeout 5 \
--max-time 20 http://localhost:8080/openmrs/ws/fhir2/R4/metadata 2>/dev/null | cut -d ";" -f 1)
((openmrs_start_wait_time += 1))
if [[ ${openmrs_start_wait_time} == 20 ]]; then
echo "..TERMINATING AS OPENMRS TOOK TOO LONG TO START"
exit 1
fi
done
echo " OPENMRS SERVER STARTED SUCCESSFULLY"
#######################################
# Check whether HAPI-FHIR S is Started
#######################################
hapifhir_start_wait_time=0
contenttype=$(curl -o /dev/null --head -w "%{content_type}\n" -X GET -u hapi:hapi123 --connect-timeout 5 \
--max-time 20 http://localhost:8090/fhir/metadata 2>/dev/null | cut -d ";" -f 1)
until [[ ${contenttype} == "application/fhir+json" ]]; do
sleep 60s
echo "..WAITING FOR HAPI FHIR SERVER TO START"
contenttype=$(curl -o /dev/null --head -w "%{content_type}\n" -X GET -u hapi:hapi123 --connect-timeout 5 \
--max-time 20 http://localhost:8090/fhir/metadata 2>/dev/null | cut -d ";" -f 1)
((hapifhir_start_wait_time += 1))
if [[ ${hapifhir_start_wait_time} == 20 ]]; then
echo "..TERMINATING AS HAPI-FHIR TOOK TOO LONG TO START"
exit 1
fi
done
echo "HAPI FHIR SERVER STARTED SUCCESSFULLY"
###########################################################
# Load TX_PVLS Libraries and Measure Resources into HAPI FHIR
############################################################
echo "..LOADING MEASURE AND LIBRARY RESOURCES INTO HAPI FHIR "
./scripts/load-resources.sh
echo "LOADED MEASURE AND LIBRARY RESOURCES INTO HAPI FHIR "
###########################################################
# Load OpenHIM metadata
############################################################
echo "..LOADING CHANNEL AND CLIENT METADATA INTO OPENHIM"
./scripts/openhim-api.sh root@openhim.org openhim-password -v https://localhost:8085/metadata -d @./config/openhim-config.json -H "Content-Type:application/json"
###########################################################
# Starting the Debezium-streaming-fhir-analytics tool
############################################################
echo "..STARTING STREAMING PIPE LINE "
docker-compose -f docker/pipeline-compose.yml up