Use official 2.1.0 packages for Grafana

Change-Id: Ifd4bbefb38a92ae388515acedfcbb9c7d62b5093
This commit is contained in:
Simon Pasquier 2015-08-05 14:55:43 +02:00
parent 69da2766a4
commit bdc46e80cd
2 changed files with 67 additions and 51 deletions

46
functions.sh Normal file
View File

@ -0,0 +1,46 @@
#!/bin/bash
# Copyright 2015 Mirantis, Inc.
#
# 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.
set -eux
ROOT="$(dirname "$(readlink -f "$0")")"
MODULES_DIR="${ROOT}"/deployment_scripts/puppet/modules
RPM_REPO="${ROOT}"/repositories/centos/
DEB_REPO="${ROOT}"/repositories/ubuntu/
# Download RPM or DEB packages and store them in the local repository directory
function download_package {
while [ $# -gt 0 ]; do
if [[ "$1" == *.deb ]]; then
REPO=$DEB_REPO
elif [[ "$1" == *.rpm ]]; then
REPO=$RPM_REPO
else
echo "Invalid URL for download_package(): $1"
fi
FILE=$(basename "$1")
wget -qO - "$1" > "$REPO"/"$FILE"
shift
done
}
# Download official Puppet module and store it in the local directory
function download_puppet_module {
rm -rf "${MODULES_DIR:?}"/"$1"
mkdir -p "${MODULES_DIR}"/"$1"
wget -qO- "$2" | tar -C "${MODULES_DIR}/$1" --strip-components=1 -xz
}

View File

@ -1,60 +1,30 @@
#!/bin/bash
set -eux
ROOT="$(dirname "$(readlink -f "$0")")"
MODULES="${ROOT}"/deployment_scripts/puppet/modules
RPM_REPO="${ROOT}"/repositories/centos/
DEB_REPO="${ROOT}"/repositories/ubuntu/
# Puppet manifests for Grafana
# NOTE: We are downloading master until branch 2.1.x is available.
GRAFANA_TARBALL_URL="https://github.com/bfraser/puppet-grafana/archive/master.tar.gz"
# Puppet manifests from fuel-lib
# This is the commit id for the current stable/6.1 branch
FUEL_LIB_COMMIT="be44e9ea792fe4314ac8c1b7596742ceb5163f61"
FUEL_LIB_TARBALL_URL="https://github.com/stackforge/fuel-library/archive/${FUEL_LIB_COMMIT}.tar.gz"
. "$(dirname "$(readlink -f "$0")")"/functions.sh
APT_TARBALL_URL="https://forgeapi.puppetlabs.com/v3/files/puppetlabs-apt-2.1.1.tar.gz"
CONCAT_TARBALL_URL="https://forgeapi.puppetlabs.com/v3/files/puppetlabs-concat-1.2.4.tar.gz"
STDLIB_TARBALL_URL="https://forgeapi.puppetlabs.com/v3/files/puppetlabs-stdlib-4.7.0.tar.gz"
INIFILE_TARBALL_URL="https://forgeapi.puppetlabs.com/v3/files/puppetlabs-inifile-1.4.1.tar.gz"
LVM_TARBALL_URL="https://forgeapi.puppetlabs.com/v3/files/puppetlabs-lvm-0.5.0.tar.gz"
GRAFANA_TARBALL_URL="https://forgeapi.puppetlabs.com/v3/files/bfraser-grafana-2.1.0.tar.gz"
# Get the disk_management from fuel-plugin-elasticsearch-kibana
MODULE_DISK_MANAGEMENT="https://github.com/stackforge/fuel-plugin-elasticsearch-kibana/archive/master.tar.gz"
DISK_MANAGEMENT_TARBALL_URL="https://github.com/stackforge/fuel-plugin-elasticsearch-kibana/archive/master.tar.gz"
# Downloads needed RPM or DEB packages
function download {
case "$1" in
deb) REPO=$DEB_REPO;;
rpm) REPO=$RPM_REPO;;
esac
shift
download_package https://s3.amazonaws.com/influxdb/influxdb_0.9.2_amd64.deb
download_package https://s3.amazonaws.com/influxdb/influxdb-0.9.2-1.x86_64.rpm
while [ $# -gt 0 ]; do
FILE=$(basename "$1")
wget -qO - "$1" > "$REPO"/"$FILE"
shift
done
}
download_package https://grafanarel.s3.amazonaws.com/builds/grafana_2.1.0_amd64.deb
download_package https://grafanarel.s3.amazonaws.com/builds/grafana-2.1.0-1.x86_64.rpm
download deb https://s3.amazonaws.com/influxdb/influxdb_0.9.2_amd64.deb
download rpm https://s3.amazonaws.com/influxdb/influxdb-0.9.2-1.x86_64.rpm
# As Grafana 2.1.x is required for InfluxDB, we download nightly build until
# official release is available.
download deb https://grafanarel.s3.amazonaws.com/builds/grafana_latest_amd64.deb
download rpm https://grafanarel.s3.amazonaws.com/builds/grafana-latest-1.x86_64.rpm
# Install puppet manifests
# Clean-up first
rm -rf "${MODULES:?}"/{grafana,stdlib,concat,inifile,disk_management,lvm}
mkdir -p "${MODULES}"/grafana
# Include Grafana.
wget -qO- "${GRAFANA_TARBALL_URL}" | tar -C "${MODULES}/grafana" --strip-components=1 -xz
# Include dependent manifests from fuel-library
wget -qO- "${FUEL_LIB_TARBALL_URL}" | \
tar -C "${MODULES}" --strip-components=3 -zxvf - \
fuel-library-${FUEL_LIB_COMMIT}/deployment/puppet/{stdlib,concat,inifile,lvm}
# Include disk_management
wget -qO- "${MODULE_DISK_MANAGEMENT}" | \
tar -C "${MODULES}" --strip-components=4 -xzvf - \
# Download Puppet modules
download_puppet_module "grafana" "$GRAFANA_TARBALL_URL"
download_puppet_module "apt" "$APT_TARBALL_URL"
download_puppet_module "concat" "$CONCAT_TARBALL_URL"
download_puppet_module "stdlib" "$STDLIB_TARBALL_URL"
download_puppet_module "inifile" "$INIFILE_TARBALL_URL"
download_puppet_module "lvm" "$LVM_TARBALL_URL"
wget -qO- "${DISK_MANAGEMENT_TARBALL_URL}" | \
tar -C "${MODULES_DIR}" --strip-components=4 -xzvf - \
fuel-plugin-elasticsearch-kibana-master/deployment_scripts/puppet/modules/disk_management