From b4a933c18f4791d297a42a7d6f4fcff71b48b4a5 Mon Sep 17 00:00:00 2001 From: Austin Clark Date: Thu, 11 Feb 2016 13:29:35 -0700 Subject: [PATCH] Create stackviz element and script in nodepool In order to get Stackviz running against tempest gate run data, it will need to be pulled in its pre-built form (i.e. with npm deps installed) from the nodepool images. This change adds a couple steps to build Stackviz so that it is in a ready state for retrieval and use on the logs server. A future devstack-gate patch will pull the stackviz directory from the nodepool images onto the logs server. This nodepool patch is required first in order to prepare stackviz for download. Installing the npm modules takes a considerable amount of time (~5-10 mins), so it is best that this work is done on the images before gate jobs are run. Change-Id: I9bc50b8eba696264d2b97ed20a37f28f4768abb8 --- nodepool/elements/node-devstack/element-deps | 1 + nodepool/elements/stackviz/README.rst | 1 + .../stackviz/install.d/89-prepare-stackviz | 35 ++++++++++++++++ .../elements/stackviz/package-installs.yaml | 2 + nodepool/elements/stackviz/pkg-map.json | 14 +++++++ nodepool/scripts/install_stackviz.sh | 41 +++++++++++++++++++ nodepool/scripts/prepare_node_devstack.sh | 3 ++ 7 files changed, 97 insertions(+) create mode 100644 nodepool/elements/stackviz/README.rst create mode 100755 nodepool/elements/stackviz/install.d/89-prepare-stackviz create mode 100644 nodepool/elements/stackviz/package-installs.yaml create mode 100644 nodepool/elements/stackviz/pkg-map.json create mode 100755 nodepool/scripts/install_stackviz.sh diff --git a/nodepool/elements/node-devstack/element-deps b/nodepool/elements/node-devstack/element-deps index 4ad866a5bc..0a3e2fcc7d 100644 --- a/nodepool/elements/node-devstack/element-deps +++ b/nodepool/elements/node-devstack/element-deps @@ -1,3 +1,4 @@ cache-devstack nodepool-base puppet +stackviz diff --git a/nodepool/elements/stackviz/README.rst b/nodepool/elements/stackviz/README.rst new file mode 100644 index 0000000000..57f3506871 --- /dev/null +++ b/nodepool/elements/stackviz/README.rst @@ -0,0 +1 @@ +Installs stackviz and builds npm dependencies for eventual transfer to the logs server. diff --git a/nodepool/elements/stackviz/install.d/89-prepare-stackviz b/nodepool/elements/stackviz/install.d/89-prepare-stackviz new file mode 100755 index 0000000000..bfc7adce7a --- /dev/null +++ b/nodepool/elements/stackviz/install.d/89-prepare-stackviz @@ -0,0 +1,35 @@ +#!/bin/bash +# Copyright (C) 2014 Hewlett-Packard Development Company, L.P. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# +# See the License for the specific language governing permissions and +# limitations under the License. + +# dib-lint: disable=setu setpipefail +if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then + set -x +fi +set -e + +STACKVIZ_DIR=/opt/stackviz +cp -r /opt/git/openstack/stackviz $STACKVIZ_DIR + +cd $STACKVIZ_DIR + +sudo npm install -g npm +sudo npm install -g gulp +npm install + +gulp prod + +rm -rf node_modules/ diff --git a/nodepool/elements/stackviz/package-installs.yaml b/nodepool/elements/stackviz/package-installs.yaml new file mode 100644 index 0000000000..632c547558 --- /dev/null +++ b/nodepool/elements/stackviz/package-installs.yaml @@ -0,0 +1,2 @@ +nodejs: +npm: diff --git a/nodepool/elements/stackviz/pkg-map.json b/nodepool/elements/stackviz/pkg-map.json new file mode 100644 index 0000000000..c1e0c8e752 --- /dev/null +++ b/nodepool/elements/stackviz/pkg-map.json @@ -0,0 +1,14 @@ +{ + "family": { + "debian": { + "nodejs": "nodejs-legacy" + }, + "suse": { + "npm": "nodejs-npm" + } + }, + "default": { + "nodejs": "nodejs", + "npm": "npm" + } +} diff --git a/nodepool/scripts/install_stackviz.sh b/nodepool/scripts/install_stackviz.sh new file mode 100755 index 0000000000..5f54cafee1 --- /dev/null +++ b/nodepool/scripts/install_stackviz.sh @@ -0,0 +1,41 @@ +#!/bin/bash -xe + +# Copyright (C) 2011-2013 OpenStack Foundation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# +# See the License for the specific language governing permissions and +# limitations under the License. + +HOSTNAME=$1 + +export SUDO='true' +export THIN='true' + +STACKVIZ_DIR=/opt/stackviz +cp -r /opt/git/openstack/stackviz $STACKVIZ_DIR + +cd $STACKVIZ_DIR + +if [ -f /usr/bin/apt-get ] ; then + sudo apt-get install nodejs npm nodejs-legacy +else + sudo yum install nodejs npm +fi + +sudo npm install -g npm +sudo npm install -g gulp +npm install + +gulp prod + +rm -rf node_modules/ diff --git a/nodepool/scripts/prepare_node_devstack.sh b/nodepool/scripts/prepare_node_devstack.sh index fe07c0ca04..c4abaf9ead 100755 --- a/nodepool/scripts/prepare_node_devstack.sh +++ b/nodepool/scripts/prepare_node_devstack.sh @@ -41,4 +41,7 @@ sudo chown -R jenkins:jenkins $TEMPEST_DIR/preseed-streams # Delete the venv after the script is called sudo rm -rf /opt/git/subunit2sql-env +# install stackviz and dependencies +./install_stackviz.sh + ./fix_grub_timeout.sh