Varying Vagrant Vagrants is an evolving Vagrant configuration with a goal of providing a system to pass development projects between team members for easy ramp up on projects.
- Version: 0.5
- Contributors: @jeremyfelt, @carldanley, @ericmann, @lkwdwrd, @TheLastCicada, @tddewey, @johnpbloch and @kadamwhite
- Contributing: Contributions are more than welcome. Please submit pull requests against the develop branch. Pull requests against master will be met with a friendly comment asking you to redo. Thanks!
Vagrant is a "tool for building and distributing development environments". It works with virtualization software such as VirtualBox to provide a virtual machine that is sandboxed away from your local environment.
- Start with any operating system. Vagrant and VirtualBox have installation packages for Windows, OSX and Linux.
- Install VirtualBox 4.2.10.
- Install Vagrant 1.1.5
vagrant
will now be available as a command in the terminal
- Clone the Varying Vagrant Vagrants repository into a local directory
git clone git://github.com/10up/varying-vagrant-vagrants.git vagrant-local
- OR download and extract the repository master zip file
- Change into the new directory
cd vagrant-local
- Start the Vagrant environment
vagrant up
- omg magic happens- Be patient, this could take a while, especially on the first run.
- Add a record to your local machine's hosts file
192.168.50.4 local.wordpress.dev local.wordpress-trunk.dev
- Visit
http://local.wordpress.dev/
in your browser for WordPress 3.5.1 orhttp://local.wordpress-trunk.dev
for WordPress trunk.
Fancy, yeah?
The first time you run vagrant up
, a pre-packaged virtual machine box is downloaded to your local machine and cached for future use. The file used by Varying Vagrant Vagrants is about 280MB.
After this box is download, it begins to boot as a sandboxed VirtualBox virtual machine. When ready, it runs the provisioning script also provided with this repository. This initiates the download and installation of around 80MB of packages to be installed on the new virtual machine.
The time for all of this to happen depends a lot on the speed of your Internet connection. If you are on a fast cable connection, it will more than likely only take a few minutes.
On future runs of vagrant up
, the pre-packaged box will already be cached on your machine and Vagrant will only need to deal with provisioning. If the machine has been destroyed with vagrant destroy
, it will need to download the full 80MB of packages to install. If the vagrant has been powered off with vagrant halt
, the provisioning script will run but will not need to download anything.
Now that you're up and running with a default configuration, start poking around and modifying things.
- Access the server with
vagrant ssh
from yourvagrant-local
directory. You can do pretty much anything you would do with a standard Ubuntu installation on a full server. - Destroy the box and start from scratch with
vagrant destroy
- As explained before, the initial 280MB box file will be cached on your machine. the next
vagrant up
command will initiate the complete provisioning process again.
- As explained before, the initial 280MB box file will be cached on your machine. the next
- Power off the box with
vagrant halt
or suspend it withvagrant suspend
. If you suspend it, you can bring it back quickly withvagrant resume
, if you halt it, you can bring it back withvagrant up
. - Start modifying and adding local files to fit your needs.
- The network configuration picks an IP of 192.168.50.4. This works if you are not on the 192.168.50.x sub domain, it could cause conflicts on your existing network if you are on a 192.168.50.x sub domain already. You can configure any IP address in the
Vagrantfile
and it will be used on the nextvagrant up
- If you require any custom SQL commands to run when the virtual machine boots, move
database/init-custom.sql.sample
todatabase/init-custom.sql
and edit it to add whicheverCREATE DATABASE
andGRANT ALL PRIVILEGES
statements you want to run on startup to prepare mysql for SQL imports (see next bullet). - Have any SQL files that should be imported in the
database/backups/
directory and named asdb_name.sql
. Theimport-sql.sh
script will run automatically when the VM is built and import these databases into the new mysql install as long as the proper databases have already been created via the previous step's SQL. - Check out the example nginx configurations in
config/nginx-config/sites
and create any other site specific configs you think should be available on server start. The web directory is/srv/www/
and default configs are provided for basic WordPress 3.5.1 and trunk setups. - Once a database is imported on the initial
vagrant up
, it will persist on the local machine a mapped mysql data directory. - Other stuff. Familiarize and all that.
- The network configuration picks an IP of 192.168.50.4. This works if you are not on the 192.168.50.x sub domain, it could cause conflicts on your existing network if you are on a 192.168.50.x sub domain already. You can configure any IP address in the
A bunch of stuff!
- Ubuntu 12.04 (Precise Pangolin)
- nginx 1.1.19
- mysql 5.5.29
- php-fpm 5.3.10
- memcached 1.4.13
- PECL memcache extension 2.2.7
- PECL xdebug extension 2.2.1
- PEAR PHPUnit 3.7.18
- ack-grep 1.92
- curl
- vim
- git
- make
- ngrep
- dos2unix
- WordPress 3.5.1
- WordPress trunk
Startup times for this Vagrant setup can vary widely, especially when booting from scratch, due to the downloads required to install all packages the first time. Here are some real world scenarios.
vagrant up
aftervagrant destroy
(or from scratch) with only the initial ~280M box cached took about 3 minutesvagrant provision
on running box took about 30 secondsvagrant up
on powered off box (vagrant halt
) took about 30 seconds
vagrant up
after avagrant destroy
(or from scratch) with only the initial ~280M box cached took about 15 minutesvagrant up
after avagrant halt
took about 1 minute.vagrant resume
after avagrant suspend
took about 12 seconds
Let us have it! If you have tips that we need to know, open a new issue, send them our way at @jeremyfelt, or find us in other ways. Some blog posts have been written documenting the process that may provide insight....