Skip to content

Commit 2ec70c8

Browse files
Vagrant setup instructions
1 parent 43e180f commit 2ec70c8

File tree

2 files changed

+142
-0
lines changed

2 files changed

+142
-0
lines changed

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,41 @@ AWS setup
5050
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html
5151

5252

53+
Vagrant setup
54+
-------------
55+
A Vagrantfile is provided to help with the setup of a development environment with all the required tools.
56+
It defines a Ubuntu VM and the tools that will be installed on it.
57+
Following tools will be installed as part of VM creation: aws cli, docker, google cloud cli, helm, kubectl, minikube
58+
Follow the below steps to get your Vagrant VM running.
59+
60+
1) Install Vagrant:
61+
- https://developer.hashicorp.com/vagrant/docs/installation
62+
63+
2) Install VirtualBox:
64+
- https://www.virtualbox.org/wiki/Downloads
65+
66+
3) vagrant box add bento/ubuntu-18.04
67+
68+
4) vagrant up
69+
70+
5) vagrant ssh
71+
72+
Once you login to the VM:
73+
- Check /vagrant directory.
74+
it will be the directory on your host machine where you have the Vagrantfile
75+
- Any files that you want to copy from your host machine to the VM, place them in the directory where you have the Vagrantfile and access them from /vagrant path inside your VM.
76+
- Any work that you do inside the /vagrant directory from inside the VM, it will be available from your host machine as well.
77+
78+
- Check the tools have been installed properly.
79+
- aws --version
80+
- docker --version
81+
- gcloud --version
82+
- kubectl version
83+
- minikube version
84+
- helm version
85+
86+
87+
5388
Examples
5489
---------
5590
1) VM:

Vagrantfile

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
# All Vagrant configuration is done below. The "2" in Vagrant.configure
5+
# configures the configuration version (we support older styles for
6+
# backwards compatibility). Please don't change it unless you know what
7+
# you're doing.
8+
Vagrant.configure("2") do |config|
9+
# The most common configuration options are documented and commented below.
10+
# For a complete reference, please see the online documentation at
11+
# https://docs.vagrantup.com.
12+
13+
# Every Vagrant development environment requires a box. You can search for
14+
# boxes at https://vagrantcloud.com/search.
15+
config.vm.box = "bento/ubuntu-18.04"
16+
17+
# Disable automatic box update checking. If you disable this, then
18+
# boxes will only be checked for updates when the user runs
19+
# `vagrant box outdated`. This is not recommended.
20+
# config.vm.box_check_update = false
21+
22+
# Create a forwarded port mapping which allows access to a specific port
23+
# within the machine from a port on the host machine. In the example below,
24+
# accessing "localhost:8080" will access port 80 on the guest machine.
25+
# NOTE: This will enable public access to the opened port
26+
# config.vm.network "forwarded_port", guest: 80, host: 8080
27+
28+
# Create a forwarded port mapping which allows access to a specific port
29+
# within the machine from a port on the host machine and only allow access
30+
# via 127.0.0.1 to disable public access
31+
# config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
32+
33+
# Create a private network, which allows host-only access to the machine
34+
# using a specific IP.
35+
config.vm.network "private_network", ip: "192.168.33.10"
36+
37+
# Create a public network, which generally matched to bridged network.
38+
# Bridged networks make the machine appear as another physical device on
39+
# your network.
40+
# config.vm.network "public_network"
41+
config.vm.network "forwarded_port", guest: 5000, host: 5000
42+
config.vm.network "forwarded_port", guest: 9090, host: 9090
43+
config.vm.network "forwarded_port", guest: 5002, host: 5002
44+
config.vm.network "forwarded_port", guest: 65500, host: 65500
45+
config.vm.network "forwarded_port", guest: 65498, host: 65498
46+
config.vm.network "forwarded_port", guest: 65499, host: 65499
47+
48+
# Enable X11 forwarding
49+
config.ssh.forward_agent = true
50+
config.ssh.forward_x11 = true
51+
52+
# Share an additional folder to the guest VM. The first argument is
53+
# the path on the host to the actual folder. The second argument is
54+
# the path on the guest to mount the folder. And the optional third
55+
# argument is a set of non-required options.
56+
# config.vm.synced_folder "../data", "/vagrant_data"
57+
58+
# Provider-specific configuration so you can fine-tune various
59+
# backing providers for Vagrant. These expose provider-specific options.
60+
# Example for VirtualBox:
61+
#
62+
config.vm.provider "virtualbox" do |vb|
63+
# # Display the VirtualBox GUI when booting the machine
64+
# vb.gui = true
65+
#
66+
# # Customize the amount of memory on the VM:
67+
# vb.memory = "1024"
68+
vb.customize ["modifyvm", :id, "--cpus", 2]
69+
vb.customize ["modifyvm", :id, "--memory", "3072"]
70+
end
71+
#
72+
# View the documentation for the provider you are using for more
73+
# information on available options.
74+
75+
# Enable provisioning with a shell script. Additional provisioners such as
76+
# Ansible, Chef, Docker, Puppet and Salt are also available. Please see the
77+
# documentation for more information about their specific syntax and use.
78+
config.vm.provision "shell", inline: <<-SHELL
79+
apt-get update
80+
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
81+
sudo apt-get install -y apt-transport-https ca-certificates gnupg zip
82+
sudo curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
83+
sudo apt-get update && sudo apt-get install -y google-cloud-sdk apt-transport-https ca-certificates curl gnupg lsb-release
84+
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
85+
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
86+
sudo apt-get update
87+
sudo apt-get install -y docker-ce docker-ce-cli containerd.io xauth libjpeg8-dev zlib1g-dev python3-pip jq
88+
#sudo groupadd docker
89+
sudo pip3 install --ignore-installed pillow
90+
sudo usermod -aG docker $USER
91+
sudo curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
92+
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
93+
94+
sudo curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
95+
sudo install minikube-linux-amd64 /usr/local/bin/minikube
96+
97+
sudo curl https://get.helm.sh/helm-v3.6.3-linux-amd64.tar.gz --output helm-v3.6.3-linux-amd64.tar.gz
98+
sudo tar -zxvf helm-v3.6.3-linux-amd64.tar.gz
99+
sudo mv linux-amd64/helm /usr/local/bin/helm
100+
sudo wget -c https://dl.google.com/go/go1.14.5.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local
101+
102+
sudo curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
103+
sudo unzip awscliv2.zip
104+
sudo ./aws/install
105+
106+
SHELL
107+
end

0 commit comments

Comments
 (0)