Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more parameters to the bicep files #15

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions azure/driver-vm.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ param adminUsername string
param pgHost string
param pgUser string
param pgPassword string
param pgPort int
param pgVersion string

param location string
param zone string
param size string

param vmName string
Expand All @@ -25,6 +27,7 @@ param runVirtualUsers int
param allWarehouses bool
param duration int
param rampup int
param delay int
param timeprofile bool

// Interpolating booleans directly will result in capitalized words, i.e. True/False
Expand All @@ -50,47 +53,50 @@ sed -i -e "s/vuset vu .*/vuset vu {3}/" run.tcl
sed -i -e "s/diset tpcc pg_allwarehouse .*/diset tpcc pg_allwarehouse {4}/" run.tcl
sed -i -e "s/diset tpcc pg_duration .*/diset tpcc pg_duration {5}/" run.tcl
sed -i -e "s/diset tpcc pg_rampup .*/diset tpcc pg_rampup {6}/" run.tcl
sed -i -e "s/diset tpcc pg_timeprofile .*/diset tpcc pg_timeprofile {7}/" run.tcl
sed -i -e "s/vuset delay .*/vuset delay {7}/" run.tcl
sed -i -e "s/diset tpcc pg_timeprofile .*/diset tpcc pg_timeprofile {8}/" run.tcl
'''

var sedCommands = format(sedCommandsTemplate, buildWarehouses, runWarehouses, buildVirtualUsers, runVirtualUsers, allWarehousesString, duration, rampup, timeprofileString)

var sedCommands = format(sedCommandsTemplate, buildWarehouses, runWarehouses, buildVirtualUsers, runVirtualUsers, allWarehousesString, duration, rampup, delay, timeprofileString)

var driverBootTemplate = '''
echo export PGHOST='{0}' >> .bashrc
echo export PGUSER={1} >> .bashrc
echo export PGPASSWORD='{2}' >> .bashrc
echo export PGPORT={3} >> .bashrc

# Use the same environment variables right now, sourcing bashrc doesn't work
# since we are not in an interactive shell
export PGHOST='{0}'
export PGUSER={1}
export PGPASSWORD='{2}'
export PGPORT={3}

# Make sure we can open enough connections
echo 'ulimit -n "$(ulimit -Hn)"' >> .bashrc

cat >> .bashrc << '__ssh_connection_bashrc__'
{3}
{4}
__ssh_connection_bashrc__

sudo apt-get install -y postgresql-client-{4}
sudo apt-get install -y postgresql-client-{5}
git clone https://github.com/citusdata/citus-benchmark.git
cd citus-benchmark

{5}
{6}

while ! psql -c 'select 1'; do echo failed; sleep 1; done
tmux new-session -d -t main -s cloud-init \; send-keys './build-and-run.sh {6}' Enter
tmux new-session -d -t main -s cloud-init \; send-keys './build-and-run.sh {7}' Enter
'''
var driverBootScript = format(driverBootTemplate, pgHost, pgUser, pgPassword, bashrcTmuxAutoAttach, pgVersion, sedCommands, replace(buildAndRunFlags, '\'', '\'\\\'\''))
var driverBootScript = format(driverBootTemplate, pgHost, pgUser, pgPassword, pgPort, bashrcTmuxAutoAttach, pgVersion, sedCommands, replace(buildAndRunFlags, '\'', '\'\\\'\''))

module vm 'vm.bicep' = {
name: '${vmName}-driver-module'
params: {
adminPublicKey: adminPublicKey
adminUsername: adminUsername
location: location
zone: zone
size: size
vmName: vmName
nicName: nicName
Expand Down
7 changes: 6 additions & 1 deletion azure/hyperscale-pre-created.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ param pgAdminPassword string
param vmAdminPublicKey string
param vmAdminUsername string = 'azureuser'
param pgHost string

param pgPort int = 5432

param location string = resourceGroup().location
param zone string = '1'

param buildAndRunFlags string = ''
param warehouses int = 1000
Expand All @@ -18,6 +19,7 @@ param allWarehouses bool = true
param duration int = 60
param rampup int = 5
param timeprofile bool = true
param delay int = 20


// Configuration of the postgres server group
Expand Down Expand Up @@ -61,7 +63,9 @@ module driverVm 'driver-vm.bicep' = {
params: {
adminPublicKey: vmAdminPublicKey
adminUsername: vmAdminUsername
pgPort: pgPort
location: location
zone: zone
size: driverSize
vmName: driverVmName
nicName: driverNicName
Expand All @@ -81,6 +85,7 @@ module driverVm 'driver-vm.bicep' = {
allWarehouses: allWarehouses
duration: duration
rampup: rampup
delay: delay
timeprofile: timeprofile
}
}
Expand Down
6 changes: 6 additions & 0 deletions azure/hyperscale.bicep
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
@secure()
param pgAdminPassword string
param pgPort int = 5432
@secure()
param vmAdminPublicKey string
param vmAdminUsername string = 'azureuser'

param location string = resourceGroup().location
param zone string = '1'

param buildAndRunFlags string = ''
param warehouses int = 1000
Expand All @@ -15,6 +17,7 @@ param runVirtualUsers int = 250
param allWarehouses bool = true
param duration int = 60
param rampup int = 3
param delay int = 20
param timeprofile bool = true


Expand Down Expand Up @@ -106,6 +109,7 @@ module driverVm 'driver-vm.bicep' = {
adminPublicKey: vmAdminPublicKey
adminUsername: vmAdminUsername
location: location
zone: zone
size: driverSize
vmName: driverVmName
nicName: driverNicName
Expand All @@ -117,6 +121,7 @@ module driverVm 'driver-vm.bicep' = {
pgUser: 'citus'
pgPassword: pgAdminPassword
pgVersion: pgVersion
pgPort: pgPort
buildAndRunFlags: '--name "${namePrefix}" ${buildAndRunFlags}'
buildWarehouses: buildWarehouses
runWarehouses: runWarehouses
Expand All @@ -125,6 +130,7 @@ module driverVm 'driver-vm.bicep' = {
allWarehouses: allWarehouses
duration: duration
rampup: rampup
delay: delay
timeprofile: timeprofile
}
}
Expand Down
5 changes: 4 additions & 1 deletion azure/vm.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ param adminPublicKey string
param adminUsername string

param location string
param zone string
param size string

param vmName string
Expand Down Expand Up @@ -50,12 +51,13 @@ resource nic 'Microsoft.Network/networkInterfaces@2021-03-01' = {

resource ip 'Microsoft.Network/publicIpAddresses@2019-02-01' = {
name: ipName
zones: array( zone )
location: location
properties: {
publicIPAllocationMethod: 'Static'
}
sku: {
name: 'Basic'
name: 'Standard'
}
}

Expand Down Expand Up @@ -136,6 +138,7 @@ var driverBootScript = format(bootTemplate, adminUsername, tmuxConf, bootScript)
resource vm 'Microsoft.Compute/virtualMachines@2021-07-01' = {
name: vmName
location: location
zones: array( zone )
properties: {
hardwareProfile: {
vmSize: size
Expand Down
14 changes: 3 additions & 11 deletions download-hammerdb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,8 @@ cd "$(dirname "$0")"


# no-op if the directory already exists
if test -d "HammerDB-$HAMMERDB_VERSION"; then
echo "HammerDB-$HAMMERDB_VERSION exists, skipping download" 1>&2
exit
fi

# no-op if the directory already exists
if [ "$1" = "master" ]; then
./download-hammerdb.sh 4.4
git clone https://github.com/TPC-Council/HammerDB --branch master HammerDB-master
cp -R HammerDB-4.4/{lib,include,bin} HammerDB-master
Comment on lines -14 to -17
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove the option to download from git?

if test -d "HammerDB-$1"; then
echo "HammerDB-$1 exists, skipping download" 1>&2
exit
fi

Expand All @@ -39,7 +31,7 @@ then
OUTPUT=HammerDB-3.3-Linux.tar.gz
URL=https://github.com/TPC-Council/HammerDB/releases/download/v3.3/$OUTPUT
else
echo 'Expects version parameter. Supported versions: 3.3 4.0 4.3' 1>&2
echo 'Expects version parameter. Supported versions: 3.3 4.0 4.3 4.4' 1>&2
exit 1
fi

Expand Down