This repository has been archived by the owner on Oct 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
run.sh
executable file
·92 lines (71 loc) · 2.37 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
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
#!/bin/bash
echo '--------------'
echo '- MedGATE -'
echo '--------------'
echo ''
case "$OSTYPE" in
linux*)
echo "OS: LINUX"
export ftp_host_ip=$(ip address | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1' | grep -v '172.')
cp -f ./docker/docker-compose.linux.yml ./docker/docker-compose.yml
;;
msys*)
echo "OS: WINDOWS"
gateway=$(ipconfig | grep Gateway | grep -Eo '([0-9]{0,3}\.){2}')
export ftp_host_ip=$(ipconfig | grep IPv4 | grep $gateway | grep -Eo '([0-9]*\.){3}[0-9]*')
cp -f ./docker/docker-compose.win.yml ./docker/docker-compose.yml
USER="$(whoami)"
sed -i "s/CURRENTUSER/$USER/g" ./docker/docker-compose.yml
;;
darwin*)
echo "OS: OSX"
exit 1
;;
*)
echo "Unsupported OS: $OSTYPE"
exit 1
;;
esac
if [ -z $ftp_host_ip ]; then
echo $ftp_host_ip
fi
# get FTP username for mounting correct volumes in docker-compose
FTP_USER=$(grep 'FTP_USER' medgate.config) && export MEDGATE_FTP_USER=${FTP_USER//'FTP_USER='/}
# stop all the running services
echo '==> Stopping any running MedGATE services'
docker-compose -f ./docker/docker-compose.yml stop
echo '==> Configuring enviroment'
# create medgate related directories for initialization
mkdir -p /medgate/ingress
mkdir -p /medgate/output
mkdir -p /medgate/archive
mkdir -p /medgate/hl7
# create gcp related directories for initialization
mkdir -p /gcp/instances/gcp_1/in
mkdir -p /gcp/applications
mkdir -p /gcp/data
mkdir -p /gcp/output
# create brat data and config directories
mkdir -p /brat-data
mkdir -p /brat-cfg
echo '==> Pulling latest image for MedGATE services'
#remove medgate-service container and pull the latest medgate-service image
if [ "$(docker ps -aq -f name='medgate-service')" ]; then
# remove existing medgate-service container
docker rm -f medgate-service medgate-webdav
# pull the latest medgate-service image
docker pull swanseauniversitymedical/medgate-dev:latest
fi
echo '==> Building Docker Images'
docker-compose -f ./docker/docker-compose.yml up --no-recreate -d
echo '==> Running Docker Images'
docker ps
echo ''
echo 'Medgate at http://<ip>/ '
echo ''
echo 'kibana at http://<ip>/kibana/ '
echo 'webdav at http://<ip>/webdav/ '
echo 'brat at http://<ip>/brat/ '
echo 'NRDA Gateway at http://<ip>/nrdagateway/ '
echo '(note / at the end is required)'
echo 'FTP at' ${ftp_host_ip}