fuel-plugin-influxdb-grafana/pre_build_hook

66 lines
2.5 KiB
Bash
Executable File

#!/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 influx
INFLUXDB_TARBALL_URL="https://forgeapi.puppetlabs.com/v3/files/jdowning-influxdb-0.3.0.tar.gz"
STAGING_TARBALL_URL="https://forgeapi.puppetlabs.com/v3/files/nanliu-staging-1.0.3.tar.gz"
# Puppet manifests required for grafana
NGINX_TARBALL_URL="https://forgeapi.puppetlabs.com/v3/files/jfryman-nginx-0.2.2.tar.gz"
# Puppet manifests from fuel-lib
FUEL_LIB_VERSION="6.0"
FUEL_LIB_TARBALL_URL="https://github.com/stackforge/fuel-library/archive/${FUEL_LIB_VERSION}.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"
# Downloads needed RPM or DEB packages
function download {
case "$1" in
deb) REPO=$DEB_REPO;;
rpm) REPO=$RPM_REPO;;
esac
shift
while [ $# -gt 0 ]; do
FILE=$(basename $1)
wget -qO - $1 > $REPO/$FILE
shift
done
}
download deb http://get.influxdb.org/influxdb_0.8.8_amd64.deb
download rpm http://get.influxdb.org/influxdb-0.8.8-1.x86_64.rpm
# Install puppet manifests
# Clean-up first
rm -rf ${MODULES}/{influxdb,nginx,staging,stdlib,concat,inifile,disk_management,lvm}
mkdir -p ${MODULES}/{influxdb,nginx,staging}
# Include influxdb manifests, its dependendy and nginx.
wget -qO- "${INFLUXDB_TARBALL_URL}" | tar -C "${MODULES}/influxdb" --strip-components=1 -xz
wget -qO- "${STAGING_TARBALL_URL}" | tar -C "${MODULES}/staging" --strip-components=1 -xz
wget -qO- "${NGINX_TARBALL_URL}" | tar -C "${MODULES}/nginx" --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_VERSION}/deployment/puppet/{stdlib,concat,inifile,lvm}
# Include disk_management
wget -qO- "${MODULE_DISK_MANAGEMENT}" | \
tar -C "${MODULES}" --strip-components=4 -xzvf - \
fuel-plugin-elasticsearch-kibana-master/deployment_scripts/puppet/modules/disk_management
# We need to embed grafana sources into the lma_monitoring_analytics module.
GRAFANA_TARBALL_URL="http://grafanarel.s3.amazonaws.com/grafana-1.9.1.tar.gz"
GRAFANA_FOLDER="${MODULES}/lma_monitoring_analytics/files/grafana/sources"
mkdir -p ${GRAFANA_FOLDER}
wget -qO- "${GRAFANA_TARBALL_URL}" | tar -C "${GRAFANA_FOLDER}" --strip-components=1 -xz