-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvmScript.sh
125 lines (86 loc) · 3.36 KB
/
vmScript.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
apt update
apt upgrade -y
chmod +x /opt/FAIMS-Thesis/Uninstall.sh
echo
echo "#########################################################"
echo "Install node.js version 16"
apt install npm -y
npm cache clean -f
npm install -g n
apt install g++-multilib -y
n 16
hash -r
echo
echo "#########################################################"
echo "Download FAIMS conductor"
cd /opt
git clone https://github.com/FAIMS/FAIMS3-conductor.git
cp /opt/FAIMS-Thesis/conductor.env /opt/FAIMS3-conductor/.env
echo "#########################################################"
echo ".env has been created. Please add your google client id and secret, and setup your couchdb username and password."
read -p "Press any key to continue..."
cd /opt/FAIMS3-conductor
echo
echo "#########################################################"
echo "Create couchdb local.ini"
chmod +x ./keymanagement/makeInstanceKeys.sh
./keymanagement/makeInstanceKeys.sh .env
echo
echo "#########################################################"
echo "Install FAIMS conductor dependancies"
npm install
echo
echo "#########################################################"
echo "CouchDB install, configure and setup"
apt update && apt install -y curl apt-transport-https gnupg
curl https://couchdb.apache.org/repo/keys.asc | gpg --dearmor | sudo tee /usr/share/keyrings/couchdb-archive-keyring.gpg >/dev/null 2>&1
source /etc/os-release
echo "deb [signed-by=/usr/share/keyrings/couchdb-archive-keyring.gpg] https://apache.jfrog.io/artifactory/couchdb-deb/ ${VERSION_CODENAME} main" | sudo tee /etc/apt/sources.list.d/couchdb.list >/dev/null
apt update
apt upgrade -y
source /opt/FAIMS3-conductor/.env
COUCHDB_PASSWORD=$COUCHDB_PASSWORD
FAIMS_COOKIE=$FAIMS_COOKIE_SECRET
echo "couchdb couchdb/mode select standalone
couchdb couchdb/mode seen true
couchdb couchdb/cookie string ${FAIMS_COOKIE}
couchdb couchdb/cookie seen true
couchdb couchdb/bindaddress string 127.0.0.1
couchdb couchdb/bindaddress seen true
couchdb couchdb/adminpass password ${COUCHDB_PASSWORD}
couchdb couchdb/adminpass seen true
couchdb couchdb/adminpass_again password ${COUCHDB_PASSWORD}
couchdb couchdb/adminpass_again seen true" | debconf-set-selections
DEBIAN_FRONTEND=noninteractive apt-get install -y couchdb
echo
echo "#########################################################"
echo "Copying local.ini"
cp /opt/FAIMS3-conductor/couchdb/local.ini /opt/couchdb/etc/
echo
echo "#########################################################"
echo "restart couchdb"
service couchdb restart
echo
echo "#########################################################"
echo "enable conductor to start on startup"
cd /opt/FAIMS-Thesis
sudo cp ./StartConductor.service /etc/systemd/system/StartConductor.service
sudo systemctl enable StartConductor.service
chmod +x ./StartConductorOnStartup.sh
chmod +x /etc/systemd/system/StartConductor.service
echo
echo "#########################################################"
echo "Adjust package.json to include env-cmd before start"
cp ./package.json /opt/FAIMS3-conductor/package.json
echo
echo "#########################################################"
echo "Install FAIMS3"
cd /opt/FAIMS-Thesis
chmod +x install-FAIMS3.sh
./install-FAIMS3.sh
echo
echo "#########################################################"
echo "Configuration of Access Point"
cd /opt/FAIMS-Thesis/faimsAccessPoint
chmod +x accessPoint.txt
./accessPoint.txt