<commit_before>#!/usr/bin/env bash

echo "Running node.sh"

adminUsername=$1
adminPassword=$2
nodeIndex=$3
uniqueString=$4
location=$5

echo "Using the settings:"
echo adminUsername \'$adminUsername\'
echo adminPassword \'$<PASSWORD>\'
echo nodeIndex \'$nodeIndex\'
echo uniqueString \'$uniqueString\'
echo location \'$location\'

#############################
##### Install Couchbase #####
#############################

# we're currently storing the binary in GitHub.  This is not a good solution.
wget https://github.com/couchbase-partners/azure-resource-manager-couchbase/raw/master/extensions/couchbase-server-enterprise_4.6.1-debian8_amd64.deb

# Using these instructions
# https://developer.couchbase.com/documentation/server/4.6/install/ubuntu-debian-install.html
dpkg -i couchbase-server-enterprise_4.6.1-debian8_amd64.deb
apt-get update
apt-get -y install couchbase-server

# There are some post config steps including paging, NIC settings, etc that we should add
# https://developer.couchbase.com/documentation/server/4.6/install/install-linux.html

###############################
##### Configure Couchbase #####
###############################

# Using these instructions
# https://developer.couchbase.com/documentation/server/4.6/install/init-setup.html
cd /opt/couchbase/bin/

# if we're the first node then we're going to create a new cluster, otherwise
# we'll just join the existing one.
if [[ $nodeIndex == "0" ]]
then
  totalRAM=$(grep MemTotal /proc/meminfo | awk '{print $2}')
  dataRAM=$((60 * $totalRAM / 10000))
  indexRAM=$((20 * $totalRAM / 10000))

  ./couchbase-cli cluster-init \
  --cluster-ramsize=$dataRAM \
  --cluster-index-ramsize=$indexRAM \
  --cluster-username=$adminUsername \
  --cluster-password=$adminPassword
else
  rallyPointDNS="vm0-"$uniqueString"."$location".cloudapp.azure.com"
  privateIP=`hostname -i`

  ./couchbase-cli server-add \
  --cluster=$rallyPointDNS \
  --user=$adminUsername \
  --pass=$<PASSWORD> \
  --server-add=$privateIP \
  --server-add-username=$adminUsername \
  --server-add-password=$<PASSWORD>
fi

# need to think about how to trigger a rebalance
<commit_msg>bah.  missing a 0<commit_after>#!/usr/bin/env bash

echo "Running node.sh"

adminUsername=$1
adminPassword=$2
nodeIndex=$3
uniqueString=$4
location=$5

echo "Using the settings:"
echo adminUsername \'$adminUsername\'
echo adminPassword \'<PASSWORD>\'
echo nodeIndex \'$nodeIndex\'
echo uniqueString \'$uniqueString\'
echo location \'$location\'

#############################
##### Install Couchbase #####
#############################

# we're currently storing the binary in GitHub.  This is not a good solution.
wget https://github.com/couchbase-partners/azure-resource-manager-couchbase/raw/master/extensions/couchbase-server-enterprise_4.6.1-debian8_amd64.deb

# Using these instructions
# https://developer.couchbase.com/documentation/server/4.6/install/ubuntu-debian-install.html
dpkg -i couchbase-server-enterprise_4.6.1-debian8_amd64.deb
apt-get update
apt-get -y install couchbase-server

# There are some post config steps including paging, NIC settings, etc that we should add
# https://developer.couchbase.com/documentation/server/4.6/install/install-linux.html

###############################
##### Configure Couchbase #####
###############################

# Using these instructions
# https://developer.couchbase.com/documentation/server/4.6/install/init-setup.html
cd /opt/couchbase/bin/

# if we're the first node then we're going to create a new cluster, otherwise
# we'll just join the existing one.
if [[ $nodeIndex == "0" ]]
then
  totalRAM=$(grep MemTotal /proc/meminfo | awk '{print $2}')
  dataRAM=$((60 * $totalRAM / 100000))
  indexRAM=$((20 * $totalRAM / 100000))

  ./couchbase-cli cluster-init \
  --cluster-ramsize=$dataRAM \
  --cluster-index-ramsize=$indexRAM \
  --cluster-username=$adminUsername \
  --cluster-password=<PASSWORD>
else
  rallyPointDNS="vm0-"$uniqueString"."$location".cloudapp.azure.com"
  privateIP=`hostname -i`

  ./couchbase-cli server-add \
  --cluster=$rallyPointDNS \
  --user=$adminUsername \
  --pass=<PASSWORD> \
  --server-add=$privateIP \
  --server-add-username=$adminUsername \
  --server-add-password=$<PASSWORD>
fi

# need to think about how to trigger a rebalance

{'fraction_non_alphanumeric': 0.1945616502578528, 'fraction_numerical': 0.019456165025785278, 'mean_word_length': 4.614473684210527, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '66627', 'n_tokens_mistral': 1430, 'n_tokens_neox': 1333, 'n_words': 297}