Creates a Vagrant machine running on OSX, with the following auto-installed and configured.
- Docker Tools: docker, docker-compose
- Kubernetes Tools: kubectl, minikube, helm, kops
- Cloud tools: Terraform
- Amazon AWS Cloud Tools: awscli, ecs-cli
- Google Cloud Tools: gcloud
- Vmware Tools: govc
- Languages: golang, nodejs
- Programming tools: hub, direnv, virtualenv, jinja2, yq, gitslave, emacs
- Network Tools: nmap, traceroute, whois
- Golang Tools: glide, protocol buffers
- Openstack Tools: nova, supernova, superglance
For your dotfiles and dotdirectories in ~/
, it creates files or directories
in /vagrant/custom, and then symbolically links from ~/
. This ensures that
your configuration files are persisted on the host, between rebuilding of
vagrant machines.
These instructions are geared towards OSX, although this box should work in Windows (intructions not included).
- Install Brew (http://brew.sh/)
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Install a few other packages
brew install git python wget curl gitslave brew-cask tree nmap ssh-copy-id
- Install vagrant and virtualbox
# Virtualbox version 5.1.14 is known to be good
# Some newer versions have issues
# You may want to manually install virtualbox
brew cask install virtualbox
brew cask install vagrant
All of these will make your life easier:
Set defaults for your git configuration (email, name, aliases, etc)
Edit ~/.gitconfig, which is actually a symlink to /vagrant/custom/dot.gitconfig
[user]
email = you@domain.com
name = Firstname Lastname
# login to google cloud
gcloud auth login
# disable usage reporting to google
gcloud config set disable_usage_reporting true
# locate your project id
gcloud projects list
# set default project
gcloud config set core/project <project_id>
# locate your zone
gcloud compute zones list
# set default zone
gcloud config set compute/zone <zone_id>
# locate your cluster
gcloud container clusters list
# set default cluster
gcloud config set container/cluster <cluster_id>
# configure kubectl in google's environment
gcloud container clusters get-credentials <cluster_id>
# check your config
gcloud config list
The pre-installed AWS cli commands require configuration to work.
Documentation for configuration is found here [http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-config-files](AWS CLI Configuration)
Example ~/.aws/config file
[profile project_alpha]
output = json
region = us-west-1
[profile project_beta]
output = json
region = us-west-1
Example ~/.aws/credentials file
[project_alpha]
aws_access_key_id = <alpha_key_id>
aws_secret_access_key = <alpha_access_key>
[project_beta]
aws_access_key_id = <beta_key_id>
aws_secret_access_key = <beta_access_key>
Then, to switch between AWS accounts, set the right AWS_PROFILE environment variable.
export AWS_PROFILE=project_beta
If you'd like to mount a directory from your host machine directly into the vagrant machine, you may edit the synced folder directive in the Vagrant file. The default will mount the host ~/Dev directory to the vagrant /vagrant/Dev directory.
# edit ./Vagrantfile if you have your directories to mount
if File.directory?(File.expand_path("~/Dev"))
dev.vm.synced_folder "~/Dev", "/home/vagrant/Dev"
end
git clone git@github.com:dcwangmit01/vagrant-devenv.git
# Or if you don't have a github account, use:
# git clone https://github.com/dcwangmit01/vagrant-devenv.git
cd vagrant-devenv
vagrant up
vagrant ssh
vagrant suspend
Publish your keypair to every region in AWS that you will use
export KEY_NAME=${USER}
export PRIVATE_KEY="${HOME}/.ssh/id_rsa"
export PUBKEY_MATERIAL=`openssl rsa -in ${PRIVATE_KEY} -pubout 2>/dev/null|tail -n +2| head -n -1| tr -d '\n'`
export PROFILES='dev-us-west-1 dev-us-west-2 dev-us-east-1'
for i in ${PROFILES}; do
aws ec2 delete-key-pair --profile=$i --key-name ${KEY_NAME};
aws ec2 import-key-pair --profile=$i --key-name ${KEY_NAME} --public-key-material ${PUBKEY_MATERIAL};
done