diff --git a/.gitignore b/.gitignore index 5903150..c3cb57d 100644 --- a/.gitignore +++ b/.gitignore @@ -81,4 +81,6 @@ fabric.properties # Android studio 3.1+ serialized cache file .idea/caches/build_file_checksums.ser + +.DS_Store # -- END \ No newline at end of file diff --git a/marketplace/images/logos/hero.png b/marketplace/images/logos/hero.png deleted file mode 100755 index 8372797..0000000 Binary files a/marketplace/images/logos/hero.png and /dev/null differ diff --git a/marketplace/images/logos/large.png b/marketplace/images/logos/large.png deleted file mode 100755 index 5567cc9..0000000 Binary files a/marketplace/images/logos/large.png and /dev/null differ diff --git a/marketplace/images/logos/medium.png b/marketplace/images/logos/medium.png deleted file mode 100755 index 8df16b6..0000000 Binary files a/marketplace/images/logos/medium.png and /dev/null differ diff --git a/marketplace/images/logos/small.png b/marketplace/images/logos/small.png deleted file mode 100755 index f3d7955..0000000 Binary files a/marketplace/images/logos/small.png and /dev/null differ diff --git a/marketplace/images/logos/wide.png b/marketplace/images/logos/wide.png deleted file mode 100755 index 5134a6f..0000000 Binary files a/marketplace/images/logos/wide.png and /dev/null differ diff --git a/marketplace/images/screenshots/original/Screen Shot 1.png b/marketplace/images/screenshots/original/Screen Shot 1.png deleted file mode 100644 index 96f047d..0000000 Binary files a/marketplace/images/screenshots/original/Screen Shot 1.png and /dev/null differ diff --git a/marketplace/images/screenshots/original/Screen Shot 2.png b/marketplace/images/screenshots/original/Screen Shot 2.png deleted file mode 100644 index 1ae50b5..0000000 Binary files a/marketplace/images/screenshots/original/Screen Shot 2.png and /dev/null differ diff --git a/marketplace/images/screenshots/original/Screen Shot 3.png b/marketplace/images/screenshots/original/Screen Shot 3.png deleted file mode 100644 index c0fc0f5..0000000 Binary files a/marketplace/images/screenshots/original/Screen Shot 3.png and /dev/null differ diff --git a/marketplace/images/screenshots/original/Screen Shot 4.png b/marketplace/images/screenshots/original/Screen Shot 4.png deleted file mode 100644 index a7056ce..0000000 Binary files a/marketplace/images/screenshots/original/Screen Shot 4.png and /dev/null differ diff --git a/marketplace/images/screenshots/original/Screen Shot 5.png b/marketplace/images/screenshots/original/Screen Shot 5.png deleted file mode 100644 index 58d4747..0000000 Binary files a/marketplace/images/screenshots/original/Screen Shot 5.png and /dev/null differ diff --git a/marketplace/images/screenshots/resized/Screen Shot 1.png b/marketplace/images/screenshots/resized/Screen Shot 1.png deleted file mode 100644 index f196b62..0000000 Binary files a/marketplace/images/screenshots/resized/Screen Shot 1.png and /dev/null differ diff --git a/marketplace/images/screenshots/resized/Screen Shot 2.png b/marketplace/images/screenshots/resized/Screen Shot 2.png deleted file mode 100644 index 3e54c45..0000000 Binary files a/marketplace/images/screenshots/resized/Screen Shot 2.png and /dev/null differ diff --git a/marketplace/images/screenshots/resized/Screen Shot 3.png b/marketplace/images/screenshots/resized/Screen Shot 3.png deleted file mode 100644 index 1e6dc88..0000000 Binary files a/marketplace/images/screenshots/resized/Screen Shot 3.png and /dev/null differ diff --git a/marketplace/images/screenshots/resized/Screen Shot 4.png b/marketplace/images/screenshots/resized/Screen Shot 4.png deleted file mode 100644 index 5b88490..0000000 Binary files a/marketplace/images/screenshots/resized/Screen Shot 4.png and /dev/null differ diff --git a/marketplace/images/screenshots/resized/Screen Shot 5.png b/marketplace/images/screenshots/resized/Screen Shot 5.png deleted file mode 100644 index d7618a8..0000000 Binary files a/marketplace/images/screenshots/resized/Screen Shot 5.png and /dev/null differ diff --git a/marketplace/images/screenshots/test drive/Screen Shot 1.png b/marketplace/images/screenshots/test drive/Screen Shot 1.png deleted file mode 100644 index 621e473..0000000 Binary files a/marketplace/images/screenshots/test drive/Screen Shot 1.png and /dev/null differ diff --git a/marketplace/images/screenshots/test drive/Screen Shot 2.png b/marketplace/images/screenshots/test drive/Screen Shot 2.png deleted file mode 100644 index c041719..0000000 Binary files a/marketplace/images/screenshots/test drive/Screen Shot 2.png and /dev/null differ diff --git a/marketplace/images/screenshots/test drive/Screen Shot 3.png b/marketplace/images/screenshots/test drive/Screen Shot 3.png deleted file mode 100644 index eb13a1e..0000000 Binary files a/marketplace/images/screenshots/test drive/Screen Shot 3.png and /dev/null differ diff --git a/marketplace/images/screenshots/test drive/Screen Shot 4.png b/marketplace/images/screenshots/test drive/Screen Shot 4.png deleted file mode 100644 index 3058710..0000000 Binary files a/marketplace/images/screenshots/test drive/Screen Shot 4.png and /dev/null differ diff --git a/marketplace/images/screenshots/test drive/Screen Shot 5.png b/marketplace/images/screenshots/test drive/Screen Shot 5.png deleted file mode 100644 index 1b1c56b..0000000 Binary files a/marketplace/images/screenshots/test drive/Screen Shot 5.png and /dev/null differ diff --git a/marketplace/mainTemplate-byol_2019.json b/marketplace/mainTemplate-byol_2019.json index a1c8339..f0c3478 100644 --- a/marketplace/mainTemplate-byol_2019.json +++ b/marketplace/mainTemplate-byol_2019.json @@ -1,5 +1,5 @@ { - "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "serverNodeCount": { @@ -69,7 +69,7 @@ } }, { - "apiVersion": "2016-06-01", + "apiVersion": "2019-11-01", "type": "Microsoft.Network/networkSecurityGroups", "name": "networksecuritygroups", "location": "[parameters('location')]", diff --git a/marketplace/mainTemplate-hourly_pricing_mar19.json b/marketplace/mainTemplate-hourly_pricing_mar19.json index d22ce53..c6fbe9c 100644 --- a/marketplace/mainTemplate-hourly_pricing_mar19.json +++ b/marketplace/mainTemplate-hourly_pricing_mar19.json @@ -1,5 +1,5 @@ { - "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "serverNodeCount": { @@ -69,7 +69,7 @@ } }, { - "apiVersion": "2016-06-01", + "apiVersion": "2019-11-01", "type": "Microsoft.Network/networkSecurityGroups", "name": "networksecuritygroups", "location": "[parameters('location')]", diff --git a/marketplace/test/ResourceGroupCleanup.template.json b/marketplace/test/ResourceGroupCleanup.template.json new file mode 100644 index 0000000..2791ee1 --- /dev/null +++ b/marketplace/test/ResourceGroupCleanup.template.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { }, + "variables": { }, + "resources": [ ], + "outputs": { } + } \ No newline at end of file diff --git a/marketplace/test/backout.sh b/marketplace/test/backout.sh new file mode 100755 index 0000000..e662693 --- /dev/null +++ b/marketplace/test/backout.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +############################################################################### +# Dependencies: # +# azure cli # +# JQ # +############################################################################### + +############################################################################### +# Parameters # +# -g : Resource Group # +# usage: -g ja-test-1 # +# purpose: Specifies the name of the resource group to use. Will create # +# if not exists # +# -s : Save Resource Group # +# usage: -s # +# purposes: Specifies whether resource group should be maintained # +############################################################################### + +############################################################################### +# WARNING; THIS WILL DELETE ALL RESOURCES WITHIN A RESOURCE GROUP # +############################################################################### + +while getopts g:s flag +do + case "${flag}" in + g) RESOURCE_GROUP=${OPTARG};; + s) SAVE=1;; + *) exit 1;; + esac +done + +echo "Resource Group: ${RESOURCE_GROUP}" +echo "Save Resource Group: ${SAVE}" + + +if [ "$SAVE" -eq "1" ]; then + echo "Save was passed, deleting resources but leaving group." + az deployment group create --verbose --template-file ResourceGroupCleanup.template.json --resource-group $RESOURCE_GROUP --mode Complete + exit 0 +fi + +az group delete --name $RESOURCE_GROUP --yes diff --git a/marketplace/test/deploy.sh b/marketplace/test/deploy.sh new file mode 100755 index 0000000..595082b --- /dev/null +++ b/marketplace/test/deploy.sh @@ -0,0 +1,69 @@ +#!/bin/sh + +############################################################################### +# Dependencies: # +# azure cli # +# JQ # +############################################################################### + +############################################################################### +# Parameters # +# -l : Location # +# usage: -l useast1 # +# purpose: Location based on az account list-locations # +# -p : Parameters # +# usage: -p mainTemplateParameterss.json # +# purpose: Pass in a parameters file for the mainTemplate # +# -g : Resource Group # +# usage: -g ja-test-1 # +# purpose: Specifies the name of the resource group to use. Will create # +# if not exists # +# -n : Deployment Name # +# usage: -n test_deployment_one # +# purposes: names the deployment in azure # +# -b : BYOL Template # +# purpose: specify the BYOL template # +# -h : Hourly Template # +# purpose: Specify the Hourly Template # +############################################################################### + +TEMPLATE="../mainTemplate-byol_2019.json" + +while getopts l:p:g:n:h:b flag +do + case "${flag}" in + l) LOCATION=${OPTARG};; + p) PARAMETERS=${OPTARG};; + g) RESOURCE_GROUP=${OPTARG};; + n) NAME=${OPTARG};; + h) TEMPLATE="../mainTemplate-hourly_pricing_mar19.json";; + b) TEMPLATE="../mainTemplate-byol_2019.json";; + *) exit 1;; + esac +done + +echo "Location: ${LOCATION}" +echo "Parameters: ${PARAMETERS}" +echo "Resource Group: ${RESOURCE_GROUP}" +echo "Deployment Name: ${NAME}" + +if [ -f "$PARAMETERS" ]; then + echo "${PARAMETERS} exists" +else + echo "Parameters file does not exist." + exit 1 +fi +location_exists=$(az account list-locations -o json | jq ".[] | .name" | grep ${LOCATION} -c) + +if [ "$location_exists" = 0 ]; then + echo "Invalid location." + exit 1 +fi + +if [ "$(az group exists --name ${RESOURCE_GROUP})" = "true" ]; then + echo "Group Exists, skipping creation" +else + az group create --name $RESOURCE_GROUP --location $LOCATION --output table +fi + +az deployment group create --verbose --template-file $TEMPLATE --parameters $PARAMETERS --resource-group $RESOURCE_GROUP --name $NAME --output table diff --git a/marketplace/test/parameters.json b/marketplace/test/parameters.json new file mode 100644 index 0000000..f1cf633 --- /dev/null +++ b/marketplace/test/parameters.json @@ -0,0 +1,38 @@ +{ + "serverNodeCount": { + "value": 3 + }, + "serverDiskSize": { + "value": 30 + }, + "serverVersion": { + "value": "6.6.1" + }, + "syncGatewayNodeCount": { + "value": 1 + }, + "syncGatewayVersion": { + "value": "2.7.3" + }, + "vmSize": { + "value": "Standard_DS3_v2" + }, + "adminUsername": { + "value": "couchbase" + }, + "adminPassword": { + "value": "Foo123!" + }, + "location": { + "value": "eastus" + }, + "license": { + "value": "byol_2019" + }, + "_artifactsLocation": { + "value": "https://raw.githubusercontent.com/malscent/azure-resource-manager-couchbase/master/scripts/" + }, + "_artifactsLocationSasToken": { + "value": "" + } + } \ No newline at end of file diff --git a/marketplace/test/test_parameters/NoSyncGateway.json b/marketplace/test/test_parameters/NoSyncGateway.json new file mode 100644 index 0000000..93d7e21 --- /dev/null +++ b/marketplace/test/test_parameters/NoSyncGateway.json @@ -0,0 +1,38 @@ +{ + "serverNodeCount": { + "value": "32" + }, + "serverDiskSize": { + "value": "30" + }, + "serverVersion": { + "value": "6.6.1" + }, + "syncGatewayNodeCount": { + "value": "0" + }, + "syncGatewayVersion": { + "value": "2.7.3" + }, + "vmSize": { + "value": "Standard_DS3_v2" + }, + "adminUsername": { + "value": "couchbase" + }, + "adminPassword": { + "value": "Foo123!" + }, + "location": { + "value": "useast1" + }, + "license": { + "value": "byol_2019" + }, + "_artifactsLocation": { + "value": "string" + }, + "_artifactsLocationSasToken": { + "value": "" + } + } \ No newline at end of file diff --git a/scripts/server.sh b/scripts/server.sh index 22d13ea..e5215db 100755 --- a/scripts/server.sh +++ b/scripts/server.sh @@ -16,6 +16,28 @@ echo adminPassword \'$adminPassword\' echo uniqueString \'$uniqueString\' echo location \'$location\' +FILE="/var/lib/dpkg/lock-frontend" +DB="/var/lib/dpkg/lock" +if [[ -f "$FILE" ]]; then + PID=$(lsof -t $FILE) + echo "lock-frontend locked by $PID" + echo "Killing $PID" + kill -9 "${PID##p}" + echo "$PID Killed" + rm $FILE + PID=$(lsof -t $DB) + echo "DB locked by $PID" + kill -9 "${PID##p}" + if ps -p "${PID##p}" > /dev/null + then + __log_error "${PID} was not successfully killed, Installation cannot continue" + exit 1 + fi + rm $DB + dpkg --configure -a +fi + + echo "Installing prerequisites..." apt-get update apt-get -y install python-httplib2 @@ -43,15 +65,16 @@ echo "Configuring Couchbase Server..." nodeIndex="null" while [[ $nodeIndex == "null" ]] do - nodeIndex=`curl -H Metadata:true "http://169.254.169.254/metadata/instance/compute?api-version=2017-04-02" \ + nodeIndex=$(curl -H Metadata:true "http://169.254.169.254/metadata/instance/compute?api-version=2017-04-02" \ | jq ".name" \ | sed 's/.*_//' \ - | sed 's/"//'` + | sed 's/"//') done nodeDNS='vm'$nodeIndex'.server-'$uniqueString'.'$location'.cloudapp.azure.com' rallyDNS='vm0.server-'$uniqueString'.'$location'.cloudapp.azure.com' - +echo "Node DNS: ${nodeDNS}" +echo "Rally DNS: ${rallyDNS}" echo "Adding an entry to /etc/hosts to simulate split brain DNS..." echo " # Simulate split brain DNS for Couchbase @@ -86,8 +109,8 @@ echo "Running couchbase-cli node-init" --node-init-data-path=/datadisk/data \ --node-init-index-path=/datadisk/index \ --node-init-analytics-path=/datadisk/analytics \ - -u=$adminUsername \ - -p=$adminPassword + --user=$adminUsername \ + --pass=$adminPassword if [[ $nodeIndex == "0" ]] then @@ -109,16 +132,16 @@ then else echo "Running couchbase-cli server-add" output="" - while [[ ! "$output" =~ "SUCCESS" ]] + while [[ $output != "Server $nodeDNS:8091 added" && ! $output == *"Node is already part of cluster."* ]] do - output=`./couchbase-cli server-add \ + output=$(./couchbase-cli server-add \ --cluster=$rallyDNS \ - -u=$adminUsername \ - -p=$adminPassword \ + --username=$adminUsername \ + --password=$adminPassword \ --server-add=$nodeDNS \ --server-add-username=$adminUsername \ --server-add-password=$adminPassword \ - --services=$services` + --services=$services) echo server-add output \'$output\' sleep 10 done @@ -127,10 +150,10 @@ else output="" while [[ ! $output =~ "SUCCESS" ]] do - output=`./couchbase-cli rebalance \ + output=$(./couchbase-cli rebalance \ --cluster=$rallyDNS \ - -u=$adminUsername \ - -p=$adminPassword` + --username=$adminUsername \ + --password=$adminPassword) echo rebalance output \'$output\' sleep 10 done diff --git a/scripts/syncGateway.sh b/scripts/syncGateway.sh index ca472c8..667c770 100755 --- a/scripts/syncGateway.sh +++ b/scripts/syncGateway.sh @@ -5,20 +5,54 @@ echo "Running syncGateway.sh" version=$1 echo "Sleeping to prevent dpkg lock" -sleep 20s #workaround for dpkg lock issue +sleep 60s #workaround for dpkg lock issue echo "Using the settings:" echo version \'$version\' +echo "Setting up sync gateway user" +useradd sync_gateway +echo "Creating sync_gateway home directory" +mkdir -p /home/sync_gateway/ +chown sync_gateway:sync_gateway /home/sync_gateway + echo "Installing Couchbase Sync Gateway..." -wget https://packages.couchbase.com/releases/couchbase-sync-gateway/${version}/couchbase-sync-gateway-enterprise_${version}_x86_64.deb -dpkg -i couchbase-sync-gateway-enterprise_${version}_x86_64.deb +wget https://packages.couchbase.com/releases/couchbase-sync-gateway/${version}/couchbase-sync-gateway-enterprise_${version}_x86_64.deb --quiet +echo "Download Complete. Installing..." + +FILE="/var/lib/dpkg/lock-frontend" +DB="/var/lib/dpkg/lock" +if [[ -f "$FILE" ]]; then + PID=$(lsof -t $FILE) + echo "lock-frontend locked by $PID" + echo "Killing $PID" + kill -9 "${PID##p}" + echo "$PID Killed" + rm $FILE + PID=$(lsof -t $DB) + echo "DB locked by $PID" + kill -9 "${PID##p}" + rm $DB + dpkg --configure -a +fi +RESULT=$(dpkg -i couchbase-sync-gateway-enterprise_${version}_x86_64.deb 2>&1) +COUNT=0 + +while [[ $RESULT == *"dpkg frontend is locked by another process"* && $COUNT -le 50 ]] +do + printf "%s: %s\n" "$COUNT" "$RESULT" + RESULT=$(dpkg -i couchbase-sync-gateway-enterprise_${version}_x86_64.deb 2>&1) + COUNT=$((COUNT + 1)) + sleep 3s +done +echo "Installation of Sync Gateway Complete" echo "Calling util.sh..." source util.sh adjustTCPKeepalive -echo "Configuring Couchbase Sync Gateway..." +echo "Configuring Couchbase Sync Gateway..."\ + file="/home/sync_gateway/sync_gateway.json" echo ' {