From 4a401db4d2d434fe93243b75d1a0374ebd8f5748 Mon Sep 17 00:00:00 2001 From: Andrew Davison Date: Wed, 30 Mar 2016 17:04:57 +0100 Subject: [PATCH 1/3] Allow passing version to bootstrap.sh as a cli parameter, to download a specific tag's setup files. --- setup/amazon_linux/bootstrap.sh | 12 +++++++++++- setup/ubuntu/bootstrap.sh | 11 ++++++++++- setup/ubuntu_docker/bootstrap.sh | 12 ++++++++++-- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/setup/amazon_linux/bootstrap.sh b/setup/amazon_linux/bootstrap.sh index b508d6bae..5a33ad27d 100755 --- a/setup/amazon_linux/bootstrap.sh +++ b/setup/amazon_linux/bootstrap.sh @@ -2,7 +2,17 @@ set -eu REDASH_BASE_PATH=/opt/redash -FILES_BASE_URL=https://raw.githubusercontent.com/getredash/redash/master/setup/amazon_linux/files/ + +# Default version to master +version=master + +# If a version is specified on the command line, use it instead +if [[ -n "$1" ]]; then + version=$1 +fi + +FILES_BASE_URL=https://raw.githubusercontent.com/getredash/redash/$version/setup/amazon_linux/files/ + # Verify running as root: if [ "$(id -u)" != "0" ]; then if [ $# -ne 0 ]; then diff --git a/setup/ubuntu/bootstrap.sh b/setup/ubuntu/bootstrap.sh index 04bfa0dc7..f6f132c54 100644 --- a/setup/ubuntu/bootstrap.sh +++ b/setup/ubuntu/bootstrap.sh @@ -2,7 +2,16 @@ set -eu REDASH_BASE_PATH=/opt/redash -FILES_BASE_URL=https://raw.githubusercontent.com/getredash/redash/master/setup/ubuntu/files/ + +# Default version to master +version=master + +# If a version is specified on the command line, use it instead +if [[ -n "$1" ]]; then + version=$1 +fi + +FILES_BASE_URL=https://raw.githubusercontent.com/getredash/redash/$version/setup/ubuntu/files/ # Verify running as root: if [ "$(id -u)" != "0" ]; then diff --git a/setup/ubuntu_docker/bootstrap.sh b/setup/ubuntu_docker/bootstrap.sh index 5daa92a78..3f7802b16 100644 --- a/setup/ubuntu_docker/bootstrap.sh +++ b/setup/ubuntu_docker/bootstrap.sh @@ -2,8 +2,16 @@ set -eu REDASH_BASE_PATH=/opt/redash_docker -# TODO: change this to master after merging: -FILES_BASE_URL=https://raw.githubusercontent.com/getredash/redash/docker/setup/ubuntu_docker/files/ + +# Default version to master +version=master + +# If a version is specified on the command line, use it instead +if [[ -n "$1" ]]; then + version=$1 +fi + +FILES_BASE_URL=https://raw.githubusercontent.com/getredash/redash/$version/setup/ubuntu_docker/files/ # Verify running as root: if [ "$(id -u)" != "0" ]; then From ad2a5601bf6562a6e4b2dce90174a2d3d244ce64 Mon Sep 17 00:00:00 2001 From: Andrew Davison Date: Mon, 4 Apr 2016 15:37:38 +0100 Subject: [PATCH 2/3] Use a REDASH_BRANCH environment variable instead, in the same way as REDASH_VERSION. Move REDASH_VERSION var setup to top of file where it is more visible and easier to update. --- setup/amazon_linux/bootstrap.sh | 22 ++++++++-------------- setup/ubuntu/bootstrap.sh | 21 ++++++++------------- setup/ubuntu_docker/bootstrap.sh | 11 +++-------- 3 files changed, 19 insertions(+), 35 deletions(-) diff --git a/setup/amazon_linux/bootstrap.sh b/setup/amazon_linux/bootstrap.sh index 5a33ad27d..47dcf587d 100755 --- a/setup/amazon_linux/bootstrap.sh +++ b/setup/amazon_linux/bootstrap.sh @@ -3,15 +3,16 @@ set -eu REDASH_BASE_PATH=/opt/redash -# Default version to master -version=master +# Default branch/version to master if not specified in REDASH_BRANCH env var +REDASH_BRANCH="${REDASH_BRANCH:-master}" -# If a version is specified on the command line, use it instead -if [[ -n "$1" ]]; then - version=$1 -fi +# Install latest version if not specified in REDASH_VERSION env var +REDASH_VERSION=${REDASH_VERSION-0.9.2.b1536} +LATEST_URL="https://github.com/getredash/redash/releases/download/${REDASH_BRANCH}/redash.${REDASH_VERSION}.tar.gz" +VERSION_DIR="/opt/redash/redash.${REDASH_VERSION}" +REDASH_TARBALL=/tmp/redash.tar.gz -FILES_BASE_URL=https://raw.githubusercontent.com/getredash/redash/$version/setup/amazon_linux/files/ +FILES_BASE_URL=https://raw.githubusercontent.com/getredash/redash/${REDASH_BRANCH}/setup/amazon_linux/files/ # Verify running as root: if [ "$(id -u)" != "0" ]; then @@ -113,13 +114,6 @@ if [ ! -f "/opt/redash/.env" ]; then sudo -u redash wget $FILES_BASE_URL"env" -O /opt/redash/.env fi -# Install latest version -REDASH_VERSION=${REDASH_VERSION-0.9.1.b1377} -LATEST_URL="https://github.com/getredash/redash/releases/download/v${REDASH_VERSION}/redash.$REDASH_VERSION.tar.gz" -VERSION_DIR="/opt/redash/redash.$REDASH_VERSION" -REDASH_TARBALL=/tmp/redash.tar.gz -REDASH_TARBALL=/tmp/redash.tar.gz - if [ ! -d "$VERSION_DIR" ]; then sudo -u redash wget $LATEST_URL -O $REDASH_TARBALL sudo -u redash mkdir $VERSION_DIR diff --git a/setup/ubuntu/bootstrap.sh b/setup/ubuntu/bootstrap.sh index f6f132c54..18c6f5438 100644 --- a/setup/ubuntu/bootstrap.sh +++ b/setup/ubuntu/bootstrap.sh @@ -3,15 +3,16 @@ set -eu REDASH_BASE_PATH=/opt/redash -# Default version to master -version=master +# Default branch/version to master if not specified in REDASH_BRANCH env var +REDASH_BRANCH="${REDASH_BRANCH:-master}" -# If a version is specified on the command line, use it instead -if [[ -n "$1" ]]; then - version=$1 -fi +# Install latest version if not specified in REDASH_VERSION env var +REDASH_VERSION=${REDASH_VERSION-0.9.2.b1536} +LATEST_URL="https://github.com/getredash/redash/releases/download/${REDASH_BRANCH}/redash.${REDASH_VERSION}.tar.gz" +VERSION_DIR="/opt/redash/redash.${REDASH_VERSION}" +REDASH_TARBALL=/tmp/redash.tar.gz -FILES_BASE_URL=https://raw.githubusercontent.com/getredash/redash/$version/setup/ubuntu/files/ +FILES_BASE_URL=https://raw.githubusercontent.com/getredash/redash/${REDASH_BRANCH}/setup/ubuntu/files/ # Verify running as root: if [ "$(id -u)" != "0" ]; then @@ -107,12 +108,6 @@ if [ ! -f "/opt/redash/.env" ]; then sudo -u redash wget $FILES_BASE_URL"env" -O /opt/redash/.env fi -# Install latest version -REDASH_VERSION=${REDASH_VERSION-0.9.1.b1377} -LATEST_URL="https://github.com/getredash/redash/releases/download/v${REDASH_VERSION}/redash.$REDASH_VERSION.tar.gz" -VERSION_DIR="/opt/redash/redash.$REDASH_VERSION" -REDASH_TARBALL=/tmp/redash.tar.gz - if [ ! -d "$VERSION_DIR" ]; then sudo -u redash wget "$LATEST_URL" -O "$REDASH_TARBALL" sudo -u redash mkdir "$VERSION_DIR" diff --git a/setup/ubuntu_docker/bootstrap.sh b/setup/ubuntu_docker/bootstrap.sh index 3f7802b16..ec798428d 100644 --- a/setup/ubuntu_docker/bootstrap.sh +++ b/setup/ubuntu_docker/bootstrap.sh @@ -3,15 +3,10 @@ set -eu REDASH_BASE_PATH=/opt/redash_docker -# Default version to master -version=master +# Default branch/version to master if not specified in REDASH_BRANCH env var +REDASH_BRANCH="${REDASH_BRANCH:-master}" -# If a version is specified on the command line, use it instead -if [[ -n "$1" ]]; then - version=$1 -fi - -FILES_BASE_URL=https://raw.githubusercontent.com/getredash/redash/$version/setup/ubuntu_docker/files/ +FILES_BASE_URL=https://raw.githubusercontent.com/getredash/redash/${REDASH_BRANCH}/setup/ubuntu_docker/files/ # Verify running as root: if [ "$(id -u)" != "0" ]; then From 70f7219057d0063a5edd5da33506e51167a024bd Mon Sep 17 00:00:00 2001 From: Andrew Davison Date: Mon, 4 Apr 2016 16:02:58 +0100 Subject: [PATCH 3/3] Release download path must use the version, not the branch --- setup/amazon_linux/bootstrap.sh | 2 +- setup/ubuntu/bootstrap.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup/amazon_linux/bootstrap.sh b/setup/amazon_linux/bootstrap.sh index 47dcf587d..9c6b640eb 100755 --- a/setup/amazon_linux/bootstrap.sh +++ b/setup/amazon_linux/bootstrap.sh @@ -8,7 +8,7 @@ REDASH_BRANCH="${REDASH_BRANCH:-master}" # Install latest version if not specified in REDASH_VERSION env var REDASH_VERSION=${REDASH_VERSION-0.9.2.b1536} -LATEST_URL="https://github.com/getredash/redash/releases/download/${REDASH_BRANCH}/redash.${REDASH_VERSION}.tar.gz" +LATEST_URL="https://github.com/getredash/redash/releases/download/v${REDASH_VERSION}/redash.${REDASH_VERSION}.tar.gz" VERSION_DIR="/opt/redash/redash.${REDASH_VERSION}" REDASH_TARBALL=/tmp/redash.tar.gz diff --git a/setup/ubuntu/bootstrap.sh b/setup/ubuntu/bootstrap.sh index 18c6f5438..d32ef7ff6 100644 --- a/setup/ubuntu/bootstrap.sh +++ b/setup/ubuntu/bootstrap.sh @@ -8,7 +8,7 @@ REDASH_BRANCH="${REDASH_BRANCH:-master}" # Install latest version if not specified in REDASH_VERSION env var REDASH_VERSION=${REDASH_VERSION-0.9.2.b1536} -LATEST_URL="https://github.com/getredash/redash/releases/download/${REDASH_BRANCH}/redash.${REDASH_VERSION}.tar.gz" +LATEST_URL="https://github.com/getredash/redash/releases/download/v${REDASH_VERSION}/redash.${REDASH_VERSION}.tar.gz" VERSION_DIR="/opt/redash/redash.${REDASH_VERSION}" REDASH_TARBALL=/tmp/redash.tar.gz