Skip to content

Instantly share code, notes, and snippets.

@bkuberek
Created July 19, 2014 19:04
Show Gist options
  • Save bkuberek/027b2b7830c9650e42e0 to your computer and use it in GitHub Desktop.
Save bkuberek/027b2b7830c9650e42e0 to your computer and use it in GitHub Desktop.
This is a sample Vagrantfile I use for bootstrapping new projects. You need to replace `PROJECT_NAME` with the project name.
# -*- coding: utf-8 -*-
# -*- mode: ruby -*-
# vi: set ft=ruby :
#
# Shared Folders
# --------------
# => http://docs.vagrantup.com/v2/synced-folders/index.html
#
# Customize Machine Settings
# --------------------------
# => http://docs.vagrantup.com/v2/providers/configuration.html
# => http://docs.vagrantup.com/v2/virtualbox/configuration.html
# => http://docs.vagrantup.com/v2/vmware-fusion/configuration.html
#
# Provisioning
# ------------
# => http://docs.vagrantup.com/v2/provisioning/shell.html
# => http://docs.vagrantup.com/v2/provisioning/puppet_apply.html
# => http://docs.vagrantup.com/v2/provisioning/puppet_agent.html
#
PROJECT_NAME = 'PROJECT_NAME'
GUEST_PATH = '/home/vagrant/src/PROJECT_NAME'
Vagrant.configure('2') do |config|
# Name of the vagrant box
config.vm.box = 'ubuntu-14.04-amd64-vmwarefusion'
# URL where to download the vagrant box from
config.vm.box_url = 'https://oss-binaries.phusionpassenger.com/vagrant/boxes/latest/ubuntu-14.04-amd64-vmwarefusion.box'
###########################################################################
# Port forwarding #
###########################################################################
# One can avoid forwarding ports by adding the IP address to the host's /etc/hosts file
# Uncomment the lines below to enable port forwarding for your service
# Forward webserver
#config.vm.network :forwarded_port, guest: 8000, host: 8000
# Forward karma continuously running test debugging
#config.vm.network :forwarded_port, guest: 9876, host: 9876
###########################################################################
# Machines #
###########################################################################
# Define the machine named default
# For multi machine setup, duplicate the block below defining different names
# e.g. web, database, etc. See: http://docs.vagrantup.com/v2/multi-machine/index.html
config.vm.define :default do |machine|
# Hostname of the machine
machine.vm.hostname = "dev.#{PROJECT_NAME}.com"
# This is the IP address of your VM.
# You will be able to access the machine via this IP
# Add this IP to your host's /etc/hosts file in order to avoid port forwarding above
machine.vm.network :private_network, ip: '15.10.10.123'
###########################################################################
# Synced Folders #
###########################################################################
# vagrnat will mount the current working dir at /vagrant. But we want it
# to be somewhere else. Uncomment nfs => true if you care about speed
machine.vm.synced_folder '.', GUEST_PATH #, nfs => true
###########################################################################
# Guest Machine Customization #
###########################################################################
# VirtualBox Settings
machine.vm.provider :virtualbox do |p|
p.gui = false
p.customize ['modifyvm', :id, '--memory', 768] # Memory
p.customize ['modifyvm', :id, '--cpus', '1'] # Number of CPUs
p.customize ['modifyvm', :id, '--ioapic', 'on'] # I/O Advanced Programmable Interrupt Controller (IOAPIC)
end
# VMWare Settings -- Requires the VMWare provider and basebox.
machine.vm.provider :vmware_fusion do |p|
p.gui = false
p.disable_setuid = true
p.vmx['memsize'] = '768' # Memory
p.vmx['numvcpus'] = '1' # Number of CPUs
end
###########################################################################
# Machine Provisioning #
###########################################################################
# add a shell or other machine specific provisioning here
end
#############################################################################
# Global Provisioning #
#############################################################################
# add custom provisioners here to be run such as puppet
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment