fuel-plugin-influxdb-grafana/pre_build_hook

61 lines
2.2 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 required for grafana
NGINX_TARBALL_URL="https://forgeapi.puppetlabs.com/v3/files/jfryman-nginx-0.2.2.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"
# 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 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
# Install puppet manifests
# Clean-up first
rm -rf "${MODULES:?}"/{nginx,stdlib,concat,inifile,disk_management,lvm}
mkdir -p "${MODULES}"/nginx
# Include nginx.
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_COMMIT}/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