-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·43 lines (35 loc) · 1.23 KB
/
install.sh
File metadata and controls
executable file
·43 lines (35 loc) · 1.23 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
#!/bin/bash
# Discovery Data Server installer
# 20200821/SK
# Get component locations
THIS_ADDR=`dig @resolver1.opendns.com ANY myip.opendns.com +short`
echo -n 'DNS/IP address of the Discovery FHIR Demo Data Providers: '
read DEMODATA_ADDR
echo -n 'DNS/IP address & (optional) port of the Discovery App Server (address:port): '
read APP_ADDR
if ! [[ $APP_ADDR =~ .+:.+ ]]; then
APP_ADDR=$APP_ADDR:3000
fi
# Install prerequisites
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs
# Install node modules
sudo npm install
# Rewrite service file to reference install dir
SUBST=s@WORKINGDIR@$PWD@g
sed $SUBST DiscoveryData.service.template > DiscoveryData.service
# Rewrite providers file to reference demo data server
SUBST=s@DEMODATA@$DEMODATA_ADDR@g
sed $SUBST providers.json.template > providers.json
# Rewrite config file to reference above values
SUBST1=s@THIS@$THIS_ADDR@g
SUBST2=s@APP@$APP_ADDR@g
sed -e $SUBST1 -e $SUBST2 config.js.template > config.js
# Setup and start service
sudo systemctl stop DiscoveryData.service
sudo systemctl disable DiscoveryData.service
sudo systemctl enable $PWD/DiscoveryData.service
sudo systemctl start DiscoveryData.service
# Done
echo
echo Installation complete!