Skip to content

Instantly share code, notes, and snippets.

@benyanke
Created July 1, 2017 04:52
Show Gist options
  • Save benyanke/a36a47ed0da5fa8c903fd7cfe55b1803 to your computer and use it in GitHub Desktop.
Save benyanke/a36a47ed0da5fa8c903fd7cfe55b1803 to your computer and use it in GitHub Desktop.
Vagrant Files
# -*- mode: ruby -*-
# vi: set ft=ruby :
##############
# Box Config #
##############
# Currently supporting Parallels and VirtualBox
Vagrant.configure("2") do |config|
# Forward web port to local 8080 and 80 (for failover)
config.vm.network :forwarded_port, guest: 80, host: 8080, auto_correct: true
# Setup local private network
# Not sure about this one
# config.vm.network :private_network, ip: "10.10.55.2"
# VirtualBox-specific config lines
config.vm.provider "virtualbox" do |vb|
# Define base box for Virtualbox
config.vm.box = "ubuntu/xenial64"
# Display the VirtualBox GUI when booting the machine
vb.gui = false
# Set the name of the development box in VirtualBox
vb.name = "vagrant-web-dev"
# Specify memory and cup of the vm
vb.memory = "512"
vb.cpus = 1
end
# Parallels-specific config lines
config.vm.provider "parallels" do |prl|
# Define base box for Virtualbox
config.vm.box = "parallels/ubuntu-16.04"
# Set the name of the development box in VirtualBox
prl.name = "vagrant-web-dev"
# Specify memory and cup of the vm
prl.memory = "512"
prl.cpus = 1
# Keep Guest tools up to date
prl.update_guest_tools = true
end
# Share www directory to host
config.vm.synced_folder "www/", "/var/www", create: true
# Load bootstrap shell script into vm
config.vm.provision :shell, :path => "provision/bootstrap.sh"
end
# Potential future config options to consider
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine and only allow access
# via 127.0.0.1 to disable public access
# config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"
# config.vm.provision "shell", inline: <<-SHELL
# apt-get update
# apt-get install -y apache2
# SHELL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment