summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorBryan Sullivan <bryan.sullivan@att.com>2017-12-01 09:23:09 -0800
committerBryan Sullivan <bryan.sullivan@att.com>2017-12-06 11:56:12 -0800
commit2eecb84bd0eb2d9cb21f56b036efe9929c4fef4b (patch)
tree899d0e06a08ee54e30a5a9b19546878bb67b2c1f /tools
parent1d476bccb3e406e1862489743be4d043ec4d2865 (diff)
Support VES deploy on centos
JIRA: VES-2 Reverified as working on ubuntu Change-Id: I9d2425f092137c7547b5eeeedd7bf34aa426f3eb Signed-off-by: Bryan Sullivan <bryan.sullivan@att.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/demo_deploy.sh34
-rw-r--r--tools/ves-setup.sh62
2 files changed, 56 insertions, 40 deletions
diff --git a/tools/demo_deploy.sh b/tools/demo_deploy.sh
index 433dafd..c9a0e75 100644
--- a/tools/demo_deploy.sh
+++ b/tools/demo_deploy.sh
@@ -29,7 +29,7 @@
#.
#. Prerequisites:
#. - Ubuntu Xenial host for the admin server
-#. - Ubuntu Xenial server for master and worker nodes
+#. - Ubuntu Xenial or Centos 7 server for master and worker nodes
#. - Password-less ssh key provided for node setup
#. - hostname of selected master node in DNS or /etc/hosts
#. - env variables set prior to running this script, as per ves-setup.sh
@@ -48,27 +48,30 @@
#.
#. Usage: on the admin server
#. $ git clone https://gerrit.opnfv.org/gerrit/ves ~/ves
-#. $ bash ~/ves/tools/demo_deploy.sh <key> <master> <workers> [cloudify]
+#. $ cd ~/ves/tools
+#. $ bash demo_deploy.sh <key> <user> <master> <workers> [cloudify]
#. <key>: SSH key enabling password-less SSH to nodes
+#. <user>: username on node with password-less SSH authorized
#. <master>: master node where core components will be installed
#. <workers>: list of worker nodes where collectd will be installed
#. cloudify: flag indicating to deploy VES core services via Cloudify
key=$1
-master=$2
-workers="$3"
-cloudify=$4
+user=$2
+master=$3
+workers="$4"
+cloudify=$5
eval `ssh-agent`
ssh-add $key
echo; echo "$0 $(date): Setting up master node"
ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
- ubuntu@$master sudo rm -rf /tmp/ves
+ $user@$master sudo rm -rf /tmp/ves
scp -r -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
- ~/ves ubuntu@$master:/tmp
+ ~/ves $user@$master:/tmp
ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
- ubuntu@$master <<EOF
+ $user@$master <<EOF
ves_host=$master
export ves_host
ves_mode=node
@@ -98,25 +101,30 @@ ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
EOF
scp -r -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
- ubuntu@$master:/tmp/ves/ves_env.sh ~/ves/.
-
-echo; echo "$0 $(date): VES Grafana dashboards are available at http://$master:3001 (login as admin/admin)"
+ $user@$master:/tmp/ves/ves_env.sh ~/ves/.
nodes="$master $workers"
for node in $nodes; do
echo; echo "$0 $(date): Setting up collectd at $node"
if [[ "$node" != "$master" ]]; then
scp -r -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
- ~/ves ubuntu@$node:/tmp
+ ~/ves $user@$node:/tmp
fi
ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
- ubuntu@$node <<EOF > /dev/null 2>&1 &
+ $user@$node <<EOF > /dev/null 2>&1 &
ves_kafka_host=$master
export ves_kafka_host
+ ves_kafka_port=$ves_kafka_port
+ export ves_kafka_port
ves_kafka_hostname=$ves_kafka_hostname
export ves_kafka_hostname
+ ves_mode=node
+ export ves_mode
ves_collectd=build
export ves_collectd
bash /tmp/ves/tools/ves-setup.sh collectd
EOF
done
+
+echo; echo "$0 $(date): VES Grafana dashboards are available at http://$master:3000 (login as admin/admin)"
+
diff --git a/tools/ves-setup.sh b/tools/ves-setup.sh
index 84feab8..4bd4a8a 100644
--- a/tools/ves-setup.sh
+++ b/tools/ves-setup.sh
@@ -51,7 +51,6 @@
#. ves_grafana_host: grafana host:port (default: none)
#. ves_grafana_auth: credentials in form "user/pass" (default: admin/admin)
#. ves_loglevel: loglevel for VES Agent and Collector (ERROR|DEBUG)
-#. ves_cloudtype: kubernetes|openstack (default:kubernetes)
#.
#. Usage:
#. git clone https://gerrit.opnfv.org/gerrit/ves /tmp/ves
@@ -86,15 +85,16 @@ function log() {
function common_prereqs() {
log "install common prerequisites"
- if [ "$dist" == "Ubuntu" ]; then
+ if [[ "$dist" == "ubuntu" ]]; then
sudo apt-get update
- sudo apt-get install -y git
+ sudo apt-get install -y git wget
# Required for kafka
sudo apt-get install -y default-jre
sudo apt-get install -y zookeeperd
sudo apt-get install -y python-pip
else
sudo yum update -y
+ sudo yum install -y git wget
# per http://aurora.apache.org/documentation/0.12.0/installing/#centos-7
sudo yum install -y https://archive.cloudera.com/cdh5/one-click-install/redhat/7/x86_64/cloudera-cdh-5-0.x86_64.rpm
sudo yum install -y java-1.6.0-openjdk zookeeper
@@ -186,7 +186,7 @@ function setup_collectd() {
log "Install Apache Kafka C/C++ client library"
# TODO: asap, replace the build process below with package install
# sudo apt-get install -y librdkafka1 librdkafka-dev
- if [ "$dist" == "Ubuntu" ]; then
+ if [[ "$dist" == "ubuntu" ]]; then
sudo apt-get install -y build-essential
else
sudo yum group install -y 'Development Tools'
@@ -195,7 +195,7 @@ function setup_collectd() {
cd ~/librdkafka
git checkout -b v0.9.5 v0.9.5
# TODO: Barometer VES guide to clarify specific prerequisites for Ubuntu
- if [ "$dist" == "Ubuntu" ]; then
+ if [[ "$dist" == "ubuntu" ]]; then
sudo apt-get install -y libpthread-stubs0-dev libssl-dev libsasl2-dev \
liblz4-dev
fi
@@ -205,29 +205,42 @@ function setup_collectd() {
log "Install collectd"
if [[ "$ves_collectd" != "build" ]]; then
- if [ "$dist" == "Ubuntu" ]; then
+ if [[ "$dist" == "ubuntu" ]]; then
sudo apt-get install -y collectd
else
sudo yum install -y collectd
fi
else
log "Install collectd build prerequisites"
- if [ "$dist" == "Ubuntu" ]; then
+ if [[ "$dist" == "ubuntu" ]]; then
sudo apt-get install -y pkg-config
fi
+ if [[ "$ves_mode" == "node" ]]; then
+ # TODO: Barometer VES guide to clarify prerequisites install for Ubuntu
+ log "setup additional prerequisites for VES node mode"
+ if [[ "$dist" == "ubuntu" ]]; then
+ sudo apt-get install -y libxml2-dev libpciaccess-dev libyajl-dev \
+ libdevmapper-dev libvirt-dev
+ else
+ sudo yum install -y libxml2-devel libpciaccess-devel yajl-devel \
+ device-mapper-devel libvirt-devel
+ # TODO: install libvirt from source to enable all features per
+ # http://docs.opnfv.org/en/latest/submodules/barometer/docs/release/userguide/feature.userguide.html#virt-plugin
+ fi
+ fi
log "Build collectd with Kafka support"
git clone https://github.com/collectd/collectd.git ~/collectd
cd ~/collectd
# TODO: Barometer VES guide to clarify specific prerequisites for Ubuntu
- if [ "$dist" == "Ubuntu" ]; then
+ if [[ "$dist" == "ubuntu" ]]; then
sudo apt-get install -y flex bison
sudo apt-get install -y autoconf
sudo apt-get install -y libtool
fi
./build.sh
./configure --with-librdkafka=/usr --without-perl-bindings --enable-perl=no
- make
+ sudo make
sudo make install
# TODO: Barometer VES guide to clarify collectd.service is correct
@@ -246,21 +259,19 @@ function setup_collectd() {
sudo mv systemd.collectd.service collectd.service
sudo chmod +x collectd.service
fi
+
+ if [[ "$dist" == "centos" ]]; then
+ # TODO: fix this workaround for issue preventing collectd from working
+ # in var /log/messages
+ # ... collectd: ... check_create_dir: mkdir (/work-dir): Permission denied
+ sudo mkdir /work-dir
+ fi
+
sudo systemctl daemon-reload
- sudo systemctl start collectd.service
+ sudo systemctl restart collectd.service
log "setup VES collectd config for VES $ves_mode mode"
if [[ "$ves_mode" == "node" ]]; then
- # TODO: Barometer VES guide to clarify prerequisites install for Ubuntu
- log "setup additional prerequisites for VES node mode"
- if [ "$dist" == "Ubuntu" ]; then
- sudo apt-get install -y libxml2-dev libpciaccess-dev libyajl-dev \
- libdevmapper-dev
- else
- sudo yum install -y libxml2-devel libpciaccess-devel yajl-devel \
- device-mapper-devel
- fi
-
# # TODO: fix for journalctl -xe report "... is marked executable"
# sudo chmod 744 /etc/systemd/system/collectd.service
@@ -316,11 +327,7 @@ LoadPlugin write_kafka
</Plugin>
EOF
- if [[ "$ves_cloudtype" == "openstack" ]]; then
- log "start libvirtd"
- # TODO: install libvirt from source to enable all features per
- # http://docs.opnfv.org/en/latest/submodules/barometer/docs/release/userguide/feature.userguide.html#virt-plugin
- sudo systemctl start libvirtd
+ if [[ -d /etc/nova ]]; then
cat <<EOF | sudo tee -a $collectd_conf
LoadPlugin virt
<Plugin virt>
@@ -392,6 +399,7 @@ EOF
echo "$ves_kafka_host $ves_kafka_hostname" | sudo tee -a /etc/hosts
fi
log "restart collectd to apply updated config"
+ sudo systemctl daemon-reload
sudo systemctl restart collectd
}
@@ -484,7 +492,7 @@ function setup_collector() {
$2 $3 $4
log "install prerequistes"
- if [ "$dist" == "Ubuntu" ]; then
+ if [[ "$dist" == "ubuntu" ]]; then
sudo apt-get install -y jq
else
sudo yum install -y jq
@@ -634,7 +642,7 @@ done
EOF
}
-dist=`grep DISTRIB_ID /etc/*-release | awk -F '=' '{print $2}'`
+dist=$(grep --m 1 ID /etc/os-release | awk -F '=' '{print $2}' | sed 's/"//g')
if [[ $(grep -c $HOSTNAME /etc/hosts) -eq 0 ]]; then
echo "$(ip route get 8.8.8.8 | awk '{print $NF; exit}') $HOSTNAME" |\
sudo tee -a /etc/hosts