Created
July 16, 2015 16:05
-
-
Save morganestes/052f7c8509991b987b8c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- mode: ruby -*- | |
| # vi: set ft=ruby : | |
| vagrant_dir = File.expand_path(File.dirname(__FILE__)) | |
| Vagrant.configure("2") do |config| | |
| # Store the current version of Vagrant for use in conditionals when dealing | |
| # with possible backward compatible issues. | |
| vagrant_version = Vagrant::VERSION.sub(/^v/, '') | |
| # Configuration options for the VirtualBox provider. | |
| config.vm.provider :virtualbox do |v| | |
| v.customize ["modifyvm", :id, "--memory", 1024] | |
| v.customize ["modifyvm", :id, "--cpus", 1] | |
| v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] | |
| v.customize ["modifyvm", :id, "--natdnsproxy1", "on"] | |
| end | |
| # SSH Agent Forwarding | |
| # | |
| # Enable agent forwarding on vagrant ssh commands. This allows you to use ssh keys | |
| # on your host machine inside the guest. See the manual for `ssh-add`. | |
| config.ssh.forward_agent = true | |
| # Default Ubuntu Box | |
| # | |
| # This box is provided by Ubuntu vagrantcloud.com and is a nicely sized (332MB) | |
| # box containing the Ubuntu 14.04 Trusty 64 bit release. Once this box is downloaded | |
| # to your host computer, it is cached for future use under the specified box name. | |
| config.vm.box = "ubuntu/trusty64" | |
| config.vm.hostname = "vvv-core" | |
| config.vm.define "vvv-core" do |vvv| end | |
| # Local Machine Hosts | |
| # | |
| # Use vagrant-ghost to update the hosts files | |
| # By default, we'll include the domains set up by VVV through the vvv-hosts file | |
| # located in the www/ directory. | |
| # | |
| # Other domains can be automatically added by including a vvv-hosts file containing | |
| # individual domains separated by whitespace in subdirectories of www/. | |
| # Recursively fetch the paths to all vvv-hosts files under the www/ directory. | |
| paths = Dir[File.join(vagrant_dir, 'www', '**', 'vvv-hosts')] | |
| # Parse the found vvv-hosts files for host names. | |
| hosts = paths.map do |path| | |
| # Read line from file and remove line breaks | |
| lines = File.readlines(path).map(&:chomp) | |
| # Filter out comments starting with "#" | |
| lines.grep(/\A[^#]/) | |
| end.flatten.uniq # Remove duplicate entries | |
| # Pass the found host names to the ghost plugin so it can perform magic. | |
| config.ghost.hosts = hosts | |
| config.vm.network :private_network, ip: "192.168.50.23" | |
| # Public Network (disabled) | |
| # | |
| # Using a public network rather than the default private network configuration will allow | |
| # access to the guest machine from other devices on the network. By default, enabling this | |
| # line will cause the guest machine to use DHCP to determine its IP address. You will also | |
| # be prompted to choose a network interface to bridge with during `vagrant up`. | |
| # | |
| # Please see VVV and Vagrant documentation for additional details. | |
| # | |
| # config.vm.network :public_network | |
| # Port Forwarding (disabled) | |
| # | |
| # This network configuration works alongside any other network configuration in Vagrantfile | |
| # and forwards any requests to port 8080 on the local host machine to port 80 in the guest. | |
| # | |
| # Port forwarding is a first step to allowing access to outside networks, though additional | |
| # configuration will likely be necessary on our host machine or router so that outside | |
| # requests will be forwarded from 80 -> 8080 -> 80. | |
| # | |
| # Please see VVV and Vagrant documentation for additional details. | |
| # | |
| # config.vm.network "forwarded_port", guest: 80, host: 8080 | |
| # Drive mapping | |
| # | |
| # The following config.vm.synced_folder settings will map directories in your Vagrant | |
| # virtual machine to directories on your local machine. Once these are mapped, any | |
| # changes made to the files in these directories will affect both the local and virtual | |
| # machine versions. Think of it as two different ways to access the same file. When the | |
| # virtual machine is destroyed with `vagrant destroy`, your files will remain in your local | |
| # environment. | |
| # /srv/database/ | |
| # | |
| # If a database directory exists in the same directory as your Vagrantfile, | |
| # a mapped directory inside the VM will be created that contains these files. | |
| # This directory is used to maintain default database scripts as well as backed | |
| # up mysql dumps (SQL files) that are to be imported automatically on vagrant up | |
| config.vm.synced_folder "database/", "/srv/database", type: 'nfs', map_uid: 0, map_gid: 0 | |
| # If the mysql_upgrade_info file from a previous persistent database mapping is detected, | |
| # we'll continue to map that directory as /var/lib/mysql inside the virtual machine. Once | |
| # this file is changed or removed, this mapping will no longer occur. A db_backup command | |
| # is now available inside the virtual machine to backup all databases for future use. This | |
| # command is automatically issued on halt, suspend, and destroy if the vagrant-triggers | |
| # plugin is installed. | |
| if File.exists?(File.join(vagrant_dir,'database/data/mysql_upgrade_info')) then | |
| config.vm.synced_folder "database/data/", "/var/lib/mysql", type: 'nfs', map_uid: 0, map_gid: 0 | |
| end | |
| # /srv/config/ | |
| # | |
| # If a server-conf directory exists in the same directory as your Vagrantfile, | |
| # a mapped directory inside the VM will be created that contains these files. | |
| # This directory is currently used to maintain various config files for php and | |
| # nginx as well as any pre-existing database files. | |
| config.vm.synced_folder "config/", "/srv/config", type: 'nfs', map_uid: 0, map_gid: 0 | |
| # /srv/log/ | |
| # | |
| # If a log directory exists in the same directory as your Vagrantfile, a mapped | |
| # directory inside the VM will be created for some generated log files. | |
| config.vm.synced_folder "log/", "/srv/log", type: 'nfs', map_uid: 0, map_gid: 0 | |
| # /srv/www/ | |
| # | |
| # If a www directory exists in the same directory as your Vagrantfile, a mapped directory | |
| # inside the VM will be created that acts as the default location for nginx sites. Put all | |
| # of your project files here that you want to access through the web server | |
| config.vm.synced_folder "www/", "/srv/www/", type: 'nfs', map_uid: 0, map_gid: 0 | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment