Skip to content

Commit

Permalink
Shareable Vagrant Scripts && Azure NVMe Disk Support (m3db#2107)
Browse files Browse the repository at this point in the history
* Add shared scripts and nvme disk provisioning code.
  • Loading branch information
notbdu authored Jan 15, 2020
1 parent 0612404 commit 8c8aea1
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 6 deletions.
4 changes: 4 additions & 0 deletions scripts/vagrant/docker/daemon_nvme.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"data-root": "/mnt/nvme/docker",
"storage-driver": "vfs"
}
6 changes: 3 additions & 3 deletions scripts/vagrant/multi/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Vagrant.configure("2") do |config|
do_common_azure.call azure, override

azure.vm_name = "m3-dev-primary-" + $USER + $AZURE_GROUP0
azure.vm_size = "Standard_L16s"
azure.vm_size = "Standard_L32s_v2"
azure.resource_group_name = "vagrant-dev" + $AZURE_GROUP0
end

Expand Down Expand Up @@ -132,7 +132,7 @@ Vagrant.configure("2") do |config|
do_common_azure.call azure, override

azure.vm_name = "m3-dev-secondary-" + $USER + $AZURE_GROUP1
azure.vm_size = "Standard_L16s"
azure.vm_size = "Standard_L32s_v2"
azure.resource_group_name = "vagrant-dev" + $AZURE_GROUP1
end

Expand Down Expand Up @@ -189,7 +189,7 @@ Vagrant.configure("2") do |config|

azure.vm_name = "m3-dev-benchmarker-" + $USER + $AZURE_GROUP2

azure.vm_size = "Standard_D2s_v3"
azure.vm_size = "Standard_D32s_v3"
azure.resource_group_name = "vagrant-dev" + $AZURE_GROUP2
end

Expand Down
24 changes: 21 additions & 3 deletions scripts/vagrant/provision/setup_privileged.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,33 @@
# Use with Ubuntu 16.x+
set -xe

apt-get update

DOCKER_CONFIG_FILE=daemon.json

# Mount nvme devices (if present)
apt-get install -y mhddfs
DISKS=$(lsblk | grep nvme | awk '{ print $1 }')
for DISK in $DISKS; do
mkfs -t ext4 /dev/$DISK
mkdir /mnt/$DISK
mount -t ext4 /dev/$DISK /mnt/$DISK
done
MOUNTED_DISKS=$(df -h | grep nvme | awk '{ print $6 }' | paste -sd ',' -)
if [[ "$MOUNTED_DISKS" != "" ]]; then
mkdir /mnt/nvme
mhddfs $MOUNTED_DISKS /mnt/nvme
DOCKER_CONFIG_FILE=daemon_nvme.json
fi

DOCKER_USER=${DOCKER_USER:-$USER}

# Copy over docker daemon config for azure deployments.
if [[ "$AZURE_TENANT_ID" != "" ]]; then
cp -r /home/$DOCKER_USER/docker /etc/docker
mkdir /etc/docker
cp /home/$DOCKER_USER/docker/$DOCKER_CONFIG_FILE /etc/docker/daemon.json
fi

apt-get update

# Install git
apt-get install -y git

Expand Down
18 changes: 18 additions & 0 deletions scripts/vagrant/shared/ssh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

set -xe

if [[ "$USER" == "" ]]; then
echo "USER env var not set"
exit 1
fi
if [[ "$SSH_KEY" == "" ]]; then
echo "SSH_KEY env var not set"
exit 1
fi
if [[ "$IP_ADDRESS" == "" ]]; then
echo "IP_ADDRESS env var not set"
exit 1
fi

ssh -i $SSH_KEY $USER@$IP_ADDRESS
25 changes: 25 additions & 0 deletions scripts/vagrant/shared/tunnel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

set -xe

if [[ "$USER" == "" ]]; then
echo "USER env var not set"
exit 1
fi
if [[ "$SSH_KEY" == "" ]]; then
echo "SSH_KEY env var not set"
exit 1
fi
if [[ "$IP_ADDRESS" == "" ]]; then
echo "IP_ADDRESS env var not set"
exit 1
fi

# Run tunnels
echo "Tunnelling"
echo "Grafana available at http://localhost:3333"
ssh -i $SSH_KEY $USER@$IP_ADDRESS "cd provision && ./run_tunnels.sh" --\
-L 3333:localhost:3000 \
-L 7201:localhost:7201 \
-L 9003:localhost:9003 \
-L 9004:localhost:9004 \

0 comments on commit 8c8aea1

Please sign in to comment.