Skip to content

Commit

Permalink
Merge pull request #55 from couchbase-partners/FixScriptsFor722Plus
Browse files Browse the repository at this point in the history
Fixed url generation for 7.2.2+
  • Loading branch information
malscent authored Feb 20, 2024
2 parents abeefd8 + 684a3d2 commit 41e0879
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 32 deletions.
24 changes: 16 additions & 8 deletions common/constants.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
6 changes: 4 additions & 2 deletions common/utils.sh
Original file line number Diff line number Diff line change
@@ -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/urandom | head -c 13 ; echo '')
Expand Down
8 changes: 4 additions & 4 deletions compose-files/UbuntuClusterCompose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
networks:
- cb-net-ubuntu
container_name: ubuntu-clusterhost
command: --version 7.0.2 -u couchbase -p foo123! -ch clusterhost -d -os UBUNTU -r -w 3
command: --version 7.2.4 -u couchbase -p foo123! -ch clusterhost -d -os UBUNTU -r -w 3
privileged: true
nodeone:
image: couchbase/ubuntu
Expand All @@ -25,7 +25,7 @@ services:
ports:
- "8081:8091"
container_name: ubuntu-node-one
command: --version 7.0.2 -u couchbase -p foo123! -ch ubuntu-clusterhost -d -os UBUNTU -r
command: --version 7.2.4 -u couchbase -p foo123! -ch ubuntu-clusterhost -d -os UBUNTU -r
privileged: true
nodetwo:
image: couchbase/ubuntu
Expand All @@ -38,7 +38,7 @@ services:
ports:
- "8082:8091"
container_name: ubuntu-node-two
command: --version 7.0.2 -u couchbase -p foo123! -ch ubuntu-clusterhost -d -os UBUNTU -r
command: --version 7.2.4 -u couchbase -p foo123! -ch ubuntu-clusterhost -d -os UBUNTU -r
privileged: true
nocluster:
image: couchbase/ubuntu
Expand All @@ -51,7 +51,7 @@ services:
ports:
- "8083:8091"
container_name: ubuntu-no-cluster
command: --version 7.0.2 -u couchbase -p foo123! -ch ubuntu-clusterhost -d -os UBUNTU -r --no-cluster --services data,index,query,analytics,eventing,fts -dm 256 -im 256 -qm 256 -am 1024 -em 256 -sm 256
command: --version 7.2.4 -u couchbase -p foo123! -ch ubuntu-clusterhost -d -os UBUNTU -r --no-cluster --services data,index,query,analytics,eventing,fts -dm 256 -im 256 -qm 256 -am 1024 -em 256 -sm 256
privileged: true
gateway:
image: couchbase/ubuntu
Expand Down
91 changes: 76 additions & 15 deletions installers/installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -365,14 +365,25 @@ function __install_couchbase_centos() {
local tmp=$2
__log_info "Installing Couchbase Server v${version}..."
__log_debug "Downloading installer to: ${tmp}"
local ARCH
ARCH=$(uname -m)
local file_path="${tmp}/couchbase-server-enterprise-${version}-centos${OS_VERSION}.x86_64.rpm"
# example urls pulled from the couchbase.com website
#https://packages.couchbase.com/releases/7.0.0-beta/couchbase-server-enterprise-7.0.0-beta-centos8.x86_64.rpm
#https://packages.couchbase.com/releases/6.6.2/couchbase-server-enterprise-6.6.2-centos8.x86_64.rpm
#https://packages.couchbase.com/releases/6.6.2/couchbase-server-enterprise-6.6.2-centos7.x86_64.rpm
wget -O "${tmp}/couchbase-server-enterprise-${version}-centos${OS_VERSION}.x86_64.rpm" \
"https://packages.couchbase.com/releases/${version}/couchbase-server-enterprise-${version}-centos${OS_VERSION}.x86_64.rpm" -q
local download_url="https://packages.couchbase.com/releases/${version}/couchbase-server-enterprise-${version}-centos${OS_VERSION}.x86_64.rpm"
# New for 7.2.2+
#https://packages.couchbase.com/releases/7.2.4/couchbase-server-enterprise-7.2.4-linux.x86_64.rpm
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}.rpm"
file_path="${tmp}/couchbase-server-enterprise-${version}-linux.${ARCH}.rpm"
fi
wget -O "$file_path" "$download_url" -q
__log_debug "Beginning Installation"
yum install "${tmp}/couchbase-server-enterprise-${version}-centos${OS_VERSION}.x86_64.rpm" -y -q
yum install "$file_path" -y -q
}

function __install_couchbase_rhel() {
Expand All @@ -384,26 +395,55 @@ function __install_couchbase_amazon() {
local tmp=$2
__log_info "Installing Couchbase Server v${version}..."
__log_debug "Downloading installer to: ${tmp}"
local ARCH
ARCH=$(uname -m)
local file_path="${tmp}/couchbase-server-enterprise-${version}-amzn2.${ARCH}.rpm"
# examples from packages.couchbase.com
#https://packages.couchbase.com/releases/7.0.0-beta/couchbase-server-enterprise-7.0.0-beta-amzn2.x86_64.rpm
#https://packages.couchbase.com/releases/6.6.2/couchbase-server-enterprise-6.6.2-amzn2.x86_64.rpm
#https://packages.couchbase.com/releases/6.6.2/couchbase-server-enterprise-7.1.3-amzn2.aarch64.rpm
ARCH=$(uname -m)
wget -O "${tmp}/couchbase-server-enterprise-${version}-amzn2.x86_64.rpm" \
"https://packages.couchbase.com/releases/${version}/couchbase-server-enterprise-${version}-amzn2.${ARCH}.rpm" -q
local download_url="https://packages.couchbase.com/releases/${version}/couchbase-server-enterprise-${version}-amzn2.${ARCH}.rpm"
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}.rpm"
file_path="${tmp}/couchbase-server-enterprise-${version}-linux.${ARCH}.rpm"
fi
wget -O "$file_path" "$download_url" -q
__log_debug "Beginning Installation"
yum install "${tmp}/couchbase-server-enterprise-${version}-amzn2.x86_64.rpm" -y -q
yum install "$file_path" -y -q
}

function __install_couchbase_ubuntu() {
local version=$1
local tmp=$2
__log_info "Installing Couchbase Server v${version}..."
__log_debug "Downloading installer to: ${tmp}"
wget -O "${tmp}/couchbase-server-enterprise_${version}-ubuntu${OS_VERSION}_amd64.deb" "http://packages.couchbase.com/releases/${version}/couchbase-server-enterprise_${version}-ubuntu${OS_VERSION}_amd64.deb" -q
local ARCH
ARCH=$(uname -m)
local download_url="http://packages.couchbase.com/releases/${version}/couchbase-server-enterprise_${version}-ubuntu${OS_VERSION}_amd64.deb"
local file_path="${tmp}/couchbase-server-enterprise_${version}-ubuntu${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
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
__log_debug "Download link: $download_url"
__log_debug "Download Path: $file_path"
wget -O "$file_path" "$download_url" -q
__log_debug "Download Complete. Beginning Unpacking"
until dpkg -i "${tmp}/couchbase-server-enterprise_${version}-ubuntu${OS_VERSION}_amd64.deb" > /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"
Expand All @@ -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
}
Expand All @@ -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"
Expand All @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 41e0879

Please sign in to comment.