-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbootstrap
More file actions
executable file
·137 lines (113 loc) · 3.98 KB
/
Copy pathbootstrap
File metadata and controls
executable file
·137 lines (113 loc) · 3.98 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
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
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/usr/bin/env bash
set -e
#
# This script allows you to install Nubomedia PaaS API. To execute it:
#
# 'curl -fsSkL https://raw.githubusercontent.com/fhg-fokus-nubomedia/bootstrap/master/bootstrap | bash'
export DEBIAN_FRONTEND=noninteractive
_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
_connectivity_manager_base_repo="https://github.com/tub-nubomedia/connectivity-manager.git"
_tag="develop"
#_tag="tags/1.1"
_base=/opt
_connectivity_manager_base="${_base}/nubomedia"
_connectivity_manager="${_connectivity_manager_base}/connectivity-manager"
_log_folder=/var/log/nubomedia
_user="$(id -un 2>/dev/null || true)"
function checkBinary {
echo -n " * Checking for '$1'..."
if command -v $1 >/dev/null 2>&1; then
echo "OK"
return 0
else
echo >&2 "FAILED."
return 1
fi
}
_ex='sh -c'
if [ "$_user" != 'root' ]; then
if checkBinary sudo; then
_ex='sudo -E sh -c'
elif checkBinary su; then
_ex='su -c'
fi
fi
function createConnectivityManagerBase {
echo "Creating the Connectivity Manager base folder"
# removing it if exists
#$_ex 'rm -rf '$__connectivity_manager_base
$_ex 'mkdir -p '$_connectivity_manager
$_ex 'chown -R '"$_user $_connectivity_manager_base"
# create log folder and give permission
#$_ex 'rm -rf '$_log_folder
$_ex 'mkdir -p '$_log_folder
$_ex 'chown -R '"$_user $_log_folder"
}
function compileProperties {
export baseUrl
read -p "Enter the Connectivity Manager Agent ip [http://localhost:8091]: " baseUrl
if [[ "$baseUrl" != "" ]]; then
$_ex 'sed -i "s|connectivitymanager.baseUrl=http://localhost:8091|connectivitymanager.baseUrl=$baseUrl|g" /etc/nubomedia/qos.properties'
fi
export nfvoIp
read -p "Enter the Orchestrator ip [localhost]: " nfvoIp
if [[ $nfvoIp != "" ]]; then
$_ex 'sed -i "s/nfvo.baseURL=localhost/nfvo.baseURL=$nfvoIp/g" /etc/nubomedia/qos.properties'
fi
export nfvoUsername
read -p "Enter the Orchestrator username [admin]: " nfvoUsername
if [[ $nfvoUsername != "" ]]; then
$_ex 'sed -i "s/nfvo.username=admin/nfvo.username=$nfvoUsername/g" /etc/nubomedia/qos.properties'
fi
export brokerIp
read -p "Enter the nfvo rabbit broker ip [localhost]: " brokerIp
if [[ $nfvoUsername != "" ]]; then
$_ex 'sed -i "s/spring.rabbitmq.host=localhost/spring.rabbitmq.host=$brokerIp/g" /etc/nubomedia/qos.properties'
fi
export nfvoPassword
read -p "Enter the Orchestrator password [openbaton]: " nfvoPassword
if [[ $nfvoPassword != "" ]]; then
$_ex 'sed -i "s/nfvo.password=openbaton/nfvo.password=$nfvoPassword/g" /etc/nubomedia/qos.properties'
fi
}
function checkoutConnectivityManager {
echo "Getting the Connectivity Manager..."
createConnectivityManagerBase
git clone --recursive "${_connectivity_manager_base_repo}" "${_connectivity_manager}"
pushd "${_connectivity_manager}"
git checkout ${_tag}
popd
$_ex 'mkdir -p "/etc/nubomedia"'
echo "created properties folder"
$_ex 'cp '"${_connectivity_manager}/src/main/resources/qos.properties /etc/nubomedia/qos.properties"
echo "copied properties file, now modifing..."
}
function compileConnectivityManager {
echo "compiling the Connectivity Manager"
pushd "${_connectivity_manager}"
./connectivity-manager.sh compile
if [ $? -ne 0 ]; then
echo "ERROR: The compilation of the Connectivity Manager failed"
exit 1
fi
popd
}
function startConnectivityManager {
echo "starting the Connectivity Manager"
pushd ${_connectivity_manager}
./connectivity-manager.sh start
popd
}
function deployConnectivityManager {
compileConnectivityManager
startConnectivityManager
}
function bootstrap {
# checkout Connectivity Manager
checkoutConnectivityManager
compileProperties
# deploy and compile Connectivity Manager
deployConnectivityManager
echo "Connectivity is up and running now. Check screen -x connectivity-manager..."
}
bootstrap