fuel-plugin-elasticsearch-k.../pre_build_hook

68 lines
2.8 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
#!/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
ELASTICSEARCH_TARBALL_URL="https://forgeapi.puppetlabs.com/v3/files/elasticsearch-elasticsearch-0.9.1.tar.gz"
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"
# Kibana 3 sources
KIBANA_TARBALL_URL="https://download.elasticsearch.org/kibana/kibana/kibana-3.1.2.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
}
# Packages needed to install JRE headless
download deb http://mirrors.kernel.org/ubuntu/pool/main/t/tzdata/tzdata_2015a-0ubuntu0.12.04_all.deb \
http://mirrors.kernel.org/ubuntu/pool/main/t/tzdata/tzdata-java_2015a-0ubuntu0.12.04_all.deb \
http://mirrors.kernel.org/ubuntu/pool/main/p/pcsc-lite/libpcsclite1_1.7.4-2ubuntu2_amd64.deb \
http://mirrors.kernel.org/ubuntu/pool/main/c/ca-certificates-java/ca-certificates-java_20110912ubuntu6_all.deb \
http://mirrors.kernel.org/ubuntu/pool/main/j/java-common/java-common_0.43ubuntu2_all.deb \
http://security.ubuntu.com/ubuntu/pool/universe/o/openjdk-7/openjdk-7-jre-headless_7u75-2.5.4-1~precise1_amd64.deb \
https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.4.4.deb
# For redhat only java 1.8 headless is needed
download rpm http://mirror.centos.org/centos/6/updates/x86_64/Packages/java-1.8.0-openjdk-headless-1.8.0.31-1.b13.el6_6.x86_64.rpm \
https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.4.4.noarch.rpm
# Install puppet manifests
# Clean-up first
rm -rf ${MODULES}/{stdlib,concat,lvm,elasticsearch,nginx}
mkdir -p ${MODULES}/{elasticsearch,nginx}
# Include elasticsearch and nginx manifests from puppetlabs
wget -qO- "${ELASTICSEARCH_TARBALL_URL}" | tar -C "${MODULES}/elasticsearch" --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,lvm}
# Untar kibana
KIBANA_FOLDER="${MODULES}/kibana/files/src"
mkdir -p ${KIBANA_FOLDER}
wget -qO- "${KIBANA_TARBALL_URL}" | tar -C "${KIBANA_FOLDER}" --strip-components=1 -xz