From ac40a25b3ac5831133a6435408487c4fd7a98583 Mon Sep 17 00:00:00 2001 From: Telles Nobrega Date: Tue, 28 Jun 2016 10:44:55 -0300 Subject: [PATCH] Allow creation of Storm 1.0.1 images On the process of upgrading Storm to version 1.0.1 we need to provide images for the cluster. This patch allows the creation of Storm images using 1.0.1 version as well as 0.9.2. The default value is set to 1.0.1 Change-Id: I5fbe0c194d83aba1fc09f26bc259c59c4f8a27ce Partially-implements: blueprint upgrade-storm-1-0-1 --- diskimage-create/diskimage-create.sh | 24 ++++++++++++++++++++++-- elements/storm/install.d/60-storm | 14 ++++++++++---- elements/storm/root.d/50-download-storm | 5 +++++ 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/diskimage-create/diskimage-create.sh b/diskimage-create/diskimage-create.sh index 1cc30578..ed12aab3 100755 --- a/diskimage-create/diskimage-create.sh +++ b/diskimage-create/diskimage-create.sh @@ -15,6 +15,9 @@ DIB_DEFAULT_MAPR_VERSION="5.1.0" # The default version for Spark plugin DIB_DEFAULT_SPARK_VERSION="1.6.0" +# The default version for Storm plugin +DIB_DEFAULT_STORM_VERSION="1.0.1" + # Bare metal image generation is enabled with the -b flag, it is off by default SIE_BAREMETAL="false" @@ -32,6 +35,7 @@ usage() { echo " [-v 2|2.6|2.7.1|4|5.0|5.3|5.4|5.5]" echo " [-r 5.0.0|5.1.0]" echo " [-s 1.3.1|1.6.0]" + echo " [-t 0.9.2|1.0.1]" echo " [-d]" echo " [-u]" echo " [-j openjdk|oracle-java]" @@ -57,7 +61,7 @@ usage() { echo } -while getopts "p:i:v:dur:s:j:xhb" opt; do +while getopts "p:i:v:dur:s:t:j:xhb" opt; do case $opt in p) PLUGIN=$OPTARG @@ -77,6 +81,9 @@ while getopts "p:i:v:dur:s:j:xhb" opt; do s) DIB_SPARK_VERSION=$OPTARG ;; + t) + DIB_STORM_VERSION=$OPTARG + ;; u) DIB_UPDATE_REQUESTED=true ;; @@ -228,6 +235,19 @@ case "$PLUGIN" in ;; esac + case "$DIB_STORM_VERSION" in + "0.9.2" | "1.0.1");; + "") + echo "Storm version not specified" + echo "Storm ${DIB_DEFAULT_STORM_VERSION} will be used" + DIB_STORM_VERSION=${DIB_DEFAULT_STORM_VERSION} + ;; + *) + echo -e "Unknown Storm version selected.\nAborting" + exit 1 + ;; + esac + if [ -n "$HADOOP_VERSION" ]; then echo -e "You shouldn't specify hadoop version for '$PLUGIN'.\nAborting" exit 1 @@ -595,7 +615,7 @@ fi if [ -z "$PLUGIN" -o "$PLUGIN" = "storm" ]; then export DIB_CLOUD_INIT_DATASOURCES=$CLOUD_INIT_DATASOURCES - export DIB_STORM_VERSION=${DIB_STORM_VERSION:-0.9.2} + export DIB_STORM_VERSION export ubuntu_image_name=${ubuntu_storm_image_name:-"ubuntu_sahara_storm_latest_$DIB_STORM_VERSION"} ubuntu_elements_sequence="$JAVA_ELEMENT zookeeper storm" diff --git a/elements/storm/install.d/60-storm b/elements/storm/install.d/60-storm index e1e28c0c..589551f6 100755 --- a/elements/storm/install.d/60-storm +++ b/elements/storm/install.d/60-storm @@ -18,12 +18,17 @@ chmod 700 /app/home/storm chage -I -1 -E -1 -m -1 -M -1 -W -1 -E -1 storm echo "Extracting Storm" -# The user is not providing his own Spark distribution package +# The user is not providing his own Storm distribution package if [ -z "${STORM_DOWNLOAD_URL:-}" ]; then # Check storm version case "$DIB_STORM_VERSION" in 0.9.*) STORM_DOWNLOAD_URL="http://archive.apache.org/dist/incubator/storm/apache-storm-$DIB_STORM_VERSION-incubating/apache-storm-$DIB_STORM_VERSION-incubating.tar.gz" + STORM_FOLDER=apache-storm-$DIB_STORM_VERSION-incubating + ;; + 1.0.*) + STORM_DOWNLOAD_URL="https://archive.apache.org/dist/storm/apache-storm-$DIB_STORM_VERSION/apache-storm-$DIB_STORM_VERSION.tar.gz" + STORM_FOLDER=apache-storm-$DIB_STORM_VERSION ;; *) echo -e "WARNING: Storm version $DIB_STORM_VERSION not supported." @@ -34,10 +39,11 @@ if [ -z "${STORM_DOWNLOAD_URL:-}" ]; then fi storm_file=$(basename "$STORM_DOWNLOAD_URL") +echo $storm_file cd /usr/local tar -xvf $tmp_dir/$storm_file -chown -R storm:storm apache-storm-$DIB_STORM_VERSION-incubating -ln -s apache-storm-$DIB_STORM_VERSION-incubating storm +chown -R storm:storm $STORM_FOLDER +ln -s $STORM_FOLDER storm rm -r $tmp_dir @@ -46,7 +52,7 @@ mkdir -p /app/storm chown -R storm:storm /app/storm chmod 750 /app/storm -echo "Installing Supervisor Deamon" +echo "Installing Supervisor Daemon" update-rc.d supervisor defaults chmod 600 /etc/supervisor/supervisord.conf diff --git a/elements/storm/root.d/50-download-storm b/elements/storm/root.d/50-download-storm index 3388f3cf..8bab5fba 100755 --- a/elements/storm/root.d/50-download-storm +++ b/elements/storm/root.d/50-download-storm @@ -11,6 +11,7 @@ set -o pipefail tmp_dir=$TARGET_ROOT/tmp/storm mkdir -p $tmp_dir +echo $DIB_STORM_VERSION echo "Downloading Storm" # The user is not providing his own Spark distribution package if [ -z "${STORM_DOWNLOAD_URL:-}" ]; then @@ -19,6 +20,10 @@ if [ -z "${STORM_DOWNLOAD_URL:-}" ]; then 0.9.*) STORM_DOWNLOAD_URL="http://archive.apache.org/dist/incubator/storm/apache-storm-$DIB_STORM_VERSION-incubating/apache-storm-$DIB_STORM_VERSION-incubating.tar.gz" ;; + 1.0.*) + STORM_DOWNLOAD_URL="https://archive.apache.org/dist/storm/apache-storm-$DIB_STORM_VERSION/apache-storm-$DIB_STORM_VERSION.tar.gz" + echo $STORM_DOWNLOAD_URL + ;; *) echo -e "WARNING: Storm version $DIB_STORM_VERSION not supported." echo -e "WARNING: make sure STORM_DOWNLOAD_URL points to a compatible Storm version."