diff --git a/common/constants.sh b/common/constants.sh index 18056a0..426dc1b 100644 --- a/common/constants.sh +++ b/common/constants.sh @@ -2,11 +2,13 @@ # Main Constants export HELP=0 -export VERSION="7.0.1" +export VERSION="7.2.4" export OS="UBUNTU" -export readonly AVAILABLE_OS_VALUES=("UBUNTU" "RHEL" "CENTOS" "DEBIAN" "AMAZON") +readonly AVAILABLE_OS_VALUES=("UBUNTU" "RHEL" "CENTOS" "DEBIAN" "AMAZON") +export AVAILABLE_OS_VALUES export ENV="OTHER" -export readonly AVAILABLE_ENV_VALUES=("AZURE" "AWS" "GCP" "DOCKER" "KUBERNETES" "OTHER") +readonly AVAILABLE_ENV_VALUES=("AZURE" "AWS" "GCP" "DOCKER" "KUBERNETES" "OTHER") +export AVAILABLE_ENV_VALUES export DEFAULT_USERNAME="couchbase" export DEFAULT_PASSWORD="" DEFAULT_PASSWORD=$(__generate_random_string) @@ -36,8 +38,14 @@ export DISK="" export ALTERNATE_ADDRESS="" #Installer Constants -export readonly CENTOS_OS_SUPPORTED_VERSIONS=("8" "7") -export readonly DEBIAN_OS_SUPPORTED_VERSIONS=("10" "9" "8") -export readonly RHEL_OS_SUPPORTED_VERSIONS=("8" "7" "6") -export readonly UBUNTU_OS_SUPPORTED_VERSIONS=("14.04" "16.04" "18.04" "20.04") -export readonly AMAZON_LINUX_OS_SUPPORTED_VERSIONS=("2") +readonly CENTOS_OS_SUPPORTED_VERSIONS=("8" "7") +readonly DEBIAN_OS_SUPPORTED_VERSIONS=("10" "9" "8") +readonly RHEL_OS_SUPPORTED_VERSIONS=("8" "7" "6") +readonly UBUNTU_OS_SUPPORTED_VERSIONS=("14.04" "16.04" "18.04" "20.04") +readonly AMAZON_LINUX_OS_SUPPORTED_VERSIONS=("2") + +export CENTOS_OS_SUPPORTED_VERSIONS +export DEBIAN_OS_SUPPORTED_VERSIONS +export RHEL_OS_SUPPORTED_VERSIONS +export UBUNTU_OS_SUPPORTED_VERSIONS +export AMAZON_LINUX_OS_SUPPORTED_VERSIONS diff --git a/common/utils.sh b/common/utils.sh index 6b5519e..9a1f035 100755 --- a/common/utils.sh +++ b/common/utils.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash -export readonly DEFAULT_SERVICES=("data" "index" "analytics" "eventing" "fts" "query") -export readonly DEFAULT_7_SERVICES=("data" "index" "analytics" "eventing" "fts" "query" "backup") +readonly DEFAULT_SERVICES=("data" "index" "analytics" "eventing" "fts" "query") +readonly DEFAULT_7_SERVICES=("data" "index" "analytics" "eventing" "fts" "query" "backup") +export DEFAULT_SERVICES +export DEFAULT_7_SERVICES # Generates a 13 character random string function __generate_random_string() { NEW_UUID=$(LC_ALL=C tr -dc A-Za-z0-9 /dev/null; do - __log_error "Error while installing ${tmp}/couchbase-server-enterprise_${version}-ubuntu${OS_VERSION}_amd64.deb" + until dpkg -i "$file_path" > /dev/null; do + __log_error "Error while installing $file_path" sleep 1 done __log_debug "Unpacking complete. Beginning Installation" @@ -412,7 +452,7 @@ function __install_couchbase_ubuntu() { sleep 1 done until apt-get -y install couchbase-server -qq > /dev/null; do - __log_error "Error while installing ${tmp}/couchbase-server-enterprise_${version}-ubuntu${OS_VERSION}_amd64.deb" + __log_error "Error while installing $file_path" sleep 1 done } @@ -422,10 +462,31 @@ function __install_couchbase_debian() { local tmp=$2 __log_info "Installing Couchbase Server v${version}..." __log_debug "Downloading installer to: ${tmp}" - wget -O "${tmp}/couchbase-server-enterprise_${version}-debian${OS_VERSION}_amd64.deb" "http://packages.couchbase.com/releases/${version}/couchbase-server-enterprise_${version}-debian${OS_VERSION}_amd64.deb" -q + local ARCH + ARCH=$(uname -m) + local download_url="http://packages.couchbase.com/releases/${version}/couchbase-server-enterprise_${version}-debian${OS_VERSION}_amd64.deb" + local file_path="${tmp}/couchbase-server-enterprise_${version}-debian${OS_VERSION}_amd64.deb" + # Post 7.2.2 + #https://packages.couchbase.com/releases/7.2.2/couchbase-server-enterprise_7.2.2-linux_amd64.deb + #https://packages.couchbase.com/releases/7.2.2/couchbase-server-enterprise_7.2.2-linux_arm64.deb + #https://packages.couchbase.com/releases/7.2.4/couchbase-server-enterprise_7.2.4-linux_arm64.deb + if [[ "$ARCH" == "aarch64" ]]; then + ARCH=arm64 + fi + if [[ "$ARCH" == "x86_64" ]]; then + ARCH=amd64 + fi + local greaterThan722 + greaterThan722=$(__compareVersions "7.2.2" "$version") + if [[ "$greaterThan722" -le "0" ]]; then + download_url="https://packages.couchbase.com/releases/${version}/couchbase-server-enterprise_${version}-linux_${ARCH}.deb" + file_path="${tmp}/couchbase-server-enterprise-${version}-linux_${ARCH}.deb" + fi + + wget -O "$file_path" "$download_url" -q __log_debug "Download Complete. Beginning Unpacking" - until dpkg -i "${tmp}/couchbase-server-enterprise_${version}-debian${OS_VERSION}_amd64.deb" > /dev/null; do - __log_error "Error while installing ${tmp}/couchbase-server-enterprise_${version}-debian${OS_VERSION}_amd64.deb" + until dpkg -i "$file_path" > /dev/null; do + __log_error "Error while installing $file_path" sleep 1 done __log_debug "Unpacking complete. Beginning Installation" @@ -434,7 +495,7 @@ function __install_couchbase_debian() { sleep 1 done until apt-get -y install couchbase-server -qq > /dev/null; do - __log_error "Error while installing ${tmp}/couchbase-server-enterprise_${version}-debian${OS_VERSION}_amd64.deb" + __log_error "Error while installing $file_path" sleep 1 done } diff --git a/main.sh b/main.sh index 6de0ad8..267be2a 100755 --- a/main.sh +++ b/main.sh @@ -320,8 +320,8 @@ if [[ "$CB_PASSWORD" == "$DEFAULT_PASSWORD" ]]; then fi #Slap a warning if the user did not specify a username/passsword -if [[ "$CB_USERNAME" == "$DEFAULT_USERNAME" ]] || [[ "$CB_PASSWORD" == "$DEFAULT_PASSWORD" ]]; then - __log_warning "Default user name or password detected. You should immediately log into the web console and change the password on the couchbase user!" +if [[ "$CB_USERNAME" == "$DEFAULT_USERNAME" ]] && [[ "$CB_PASSWORD" == "$DEFAULT_PASSWORD" ]]; then + __log_warning "Default user name and password detected. You should immediately log into the web console and change the password on the couchbase user!" fi diff --git a/readme.md b/readme.md index 21fe62e..0b042d6 100644 --- a/readme.md +++ b/readme.md @@ -6,7 +6,7 @@ These scripts are intended for usage to install and cluster multiple VM's, conta These scripts are bundled into a single output file with [bash_bunder](https://github.com/malscent/bash_bundler). It can be installed with ``` -go get github.com/malscent/bash_bundler +go install github.com/malscent/bash_bundler@latest ``` Bundling: