Varying Vagrant Vagrants is an evolving Vagrant configuration focused on WordPress development.
- Version: 1.0-working
- Latest Stable: v0.9
- Contributors: @jeremyfelt, @carldanley, @ericmann, @lkwdwrd, @TheLastCicada, @tddewey, @johnpbloch, @kadamwhite, @scribu, @danielbachhuber, @tollmanz, @mbijon, @markjaquith, @curtismchale, @Mamaduka, @lgedeon, @pmgarman, @westonruter, @petemall, @cmmarslender, @mintindeed, @mboynes, @aaronjorbin, @tobiasbg, @simonwheatley, @ocean90, @lvnilesh, @alexw23, @zamoose, @leewillis77, @imichaeli, @andrezrv
- Contributing: Contributions are more than welcome. Please submit pull requests against the master branch. Thanks!
The primary goal of Varying Vagrant Vagrants (VVV) is to provide an approachable way for developers to work in an environment that matches a project's production environment as closely as possible.
The default server configuration provisioned by VVV is intended to match what 10up finds to be common when working with high traffic WordPress sites.
The default WordPress configurations provided by VVV are intended to create an environment ideal for developing themese and plugins as well as for contributing to WordPress core.
The best part is that VVV is ready to use as is. Setup VVV and then type vagrant up
to automatically build a sandboxed Ubuntu server on your computer containing everything needed to contribute to WordPress core or develop a WordPress theme or plugin.
Multiple projects can be developed at once in the same environment provided by VVV.
- Use
wp-content/themes
in either thewordpress-default
orwordpress-trunk
directories to develop multiple themes using the same test content. - Use
wp-content/plugins
in either thewordpress-default
orwordpress-trunk
directories to develop a plugin the same way. - Install additional instances of WordPress in
/srv/www/
and configure a few pieces of VVV accordingly to work with the new installation. - Use the
wordpress-develop
directory to participate in WordPress core development.
Entirely different server configurations can be created by modifying the files included with this repository or through the use of additional provisioning scripts, provision-pre.sh
and provision-post.sh
.
It is not necessary to track the changes made to the main repository. Feel free to check this project out and then change everything to make it your own.
Immediate goals for VVV include:
- Continue to work towards a stable state of software and configuration included in the default provisioning.
- Provide excellent and clear documentation throughout VVV to aid in both learning and scaffolding.
- Provide a method for easing the process of adding new sites to the VVV environment.
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.
- Install VirtualBox 4.3 or Virtualbox 4.2.18
- VVV (and Vagrant) has been tested with these versions. If a newer version appears on the downloads page and you don't feel like being a guinea pig, check out the older downloads page and download a previous release.
- It is worth noting some parts of Virtualbox were rewritten and it may be in your best interest to stay with 4.2.x for a bit before upgrading. There is no absolute need at this point to have 4.3.
- Install Vagrant 1.3.5
vagrant
will now be available as a command in the terminal, try it out.
- Install the vagrant-hostsupdater plugin.
vagrant plugin install vagrant-hostsupdater
- 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
- OR grab a stable release if you'd like some extra comfort.
- Change into the new directory
cd vagrant-local
- Start the Vagrant environment
vagrant up
- Be patient, magic happens. This could take a while, especially on the first run.
- Add a record to your local machine's hosts file
- Note: If you installed vagrant hostsupdater in step 4, this has automatically been done for you.
192.168.50.4 vvv.dev local.wordpress.dev local.wordpress-trunk.dev src.wordpress-develop.dev build.wordpress-develop.dev
- On -nix systems you can use: (note that location of host file after the >> may vary)
sudo sh -c 'echo "192.168.50.4 vvv.dev local.wordpress.dev local.wordpress-trunk.dev src.wordpress-develop.dev build.wordpress-develop.dev" >>/private/etc/hosts'
- Visit any of the following default sites in your browser:
- http://local.wordpress.dev/ for WordPress stable
- http://local.wordpress-trunk.dev/ for WordPress trunk
- http://src.wordpress-develop.dev/ for trunk WordPress development files
- http://build.wordpress-develop.dev/ for version of those development files built with Grunt
- http://vvv.dev/ for a default dashboard containing several useful tools
Fancy, yeah?
The first time you run vagrant up
, a packaged box containing a virtual machine is downloaded to your local machine and cached for future use. The file used by Varying Vagrant Vagrants contains an Ubuntu 12.04 installation (Precise release) and is about 280MB.
After this box is downloaded, it begins to boot as a sandboxed virtual machine using VirtualBox. Once booted, it runs the provisioning script included with VVV. This initiates the download and installation of around 100MB of packages 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 likely only take several minutes.
On future runs of vagrant up
, the packaged box will be cached on your local machine and Vagrant will only need to apply provisioning.
- If the virtual machine has been destroyed with
vagrant destroy
, it will need to download the full 100MB of package data. - If the virtual machine has been powered off with
vagrant halt
, the provisioning script will run but will not need to download anything large.
Now that you're up and running with a default configuration, start poking around and modifying things.
- Access the server via the command line 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.- If you are on a Windows PC, you may need to install additional software for this to work seamlessly. A terminal program such as Putty will provide access immediately.
- 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 stable, trunk, and develop setups. - Once a database is imported on the initial
vagrant up
, it will persist on the local machine in a mappeddatabase/data
directory.
- 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
All database usernames and passwords for WordPress installations included by default are wp
and wp
.
All WordPress admin usernames and passwords for WordPress installations included by default are admin
and password
.
- URL:
http://local.wordpress.dev
- DB Name:
wordpress_default
- URL:
http://local.wordpress-trunk.dev
- DB Name:
wordpress_trunk
- /src URL:
http://src.wordpress-develop.dev
- /build URL:
http://build.wordpress-develop.dev
- DB Name:
wordpress_develop
- DB Name:
wordpress_unit_tests
- User:
root
- Pass:
root
- See: Connecting to MySQL from your local machine
A bunch of stuff!
- Ubuntu 12.04 LTS (Precise Pangolin)
- WordPress Develop
- WordPress Stable
- WordPress Trunk
- WP-CLI
- nginx 1.4.3
- mysql 5.5.32
- php-fpm 5.4.20
- memcached 1.4.13
- PHP memcache extension 3.0.8
- PHP xdebug extension 2.2.3
- PHP imagick extension 3.1.0RC2
- xdebug 2.2.3
- PHPUnit 3.7.24
- ack-grep 2.04
- git 1.8.4
- subversion 1.7.9
- ngrep
- dos2unix
- Composer
- phpMemcachedAdmin 1.2.2 BETA
- phpMyAdmin 4.0.8
- Webgrind 1.1
- NodeJs Current Stable Version
- grunt-cli Current Stable Version
- There is a Mailing list for any topic related to WordPress and Vagrant that is a great place to get started.
- The VVV Wiki also contains documentation that might help you out
Let us have it! If you have tips that we need to know, open a new issue. Some blog posts have been written documenting the process that may provide insight....