-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall.sh
executable file
·60 lines (49 loc) · 1.83 KB
/
install.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
#!/bin/bash
# Discovery Application 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 Data Server: '
read DATA_ADDR
# 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 Discovery.service.template > Discovery.service
# Rewrite config file to reference above values
SUBST=s@DATA@$DATA_ADDR@g
sed $SUBST src/config.js.template > src/config.js
# Install Procure
DISCOVERY_DIR=$PWD
cd ..
git clone https://github.com/sync-for-science/procure-wip
cd procure-wip
PROCURE_DIR=$PWD
curl https://open.epic.com/MyApps/EndpointsJson -o ./public/config/epic_endpoints.json
npm install
cd $DISCOVERY_DIR
# Connect Procure and Discovery
SUBST1=s@THIS@$THIS_ADDR@g
SUBST2=s@DATA@$DATA_ADDR@g
sed -e $SUBST1 -e $SUBST2 ./Procure.config-override-dev.json.template > ../procure-wip/public/config/config-override-dev.json
# Rewrite Procure service file to reference install dir
SUBST=s@WORKINGDIR@$PROCURE_DIR@g
sed $SUBST Procure.service.template > Procure.service
# Setup and start Discovery service
sudo systemctl stop Discovery.service
sudo systemctl disable Discovery.service
sudo systemctl enable $PWD/Discovery.service
sudo systemctl start Discovery.service
# Setup and start Procure service
sudo systemctl stop Procure.service
sudo systemctl disable Procure.service
sudo systemctl enable $PWD/Procure.service
sudo systemctl start Procure.service
# Done
echo
echo 'Done! Remember to:'
echo ' edit ./node_modules/react-scripts/config/webpack.config.js (see README.md)'
echo ' restart the Discovery service (sudo systemctl restart Discovery.service)'