Skip to content

Latest commit

 

History

History
156 lines (114 loc) · 10.9 KB

README.md

File metadata and controls

156 lines (114 loc) · 10.9 KB

WP Archive

WP Archive is a fun tool built for comparing past and present versions of WordPress. It uses Vagrant and builds off of Varying Vagrant Vagrants (VVV).

There should not be any need to modify any Vagrant files. Just make sure you follow the instructions below for setting up VVV, including adding a record in your hosts file pointing wp-archive.local to 192.168.50.4. WP Archive uses a subdirectory structure to house the different WordPress versions on the same domain, and you can find links to all the versions in the menu of the default installation.

Note that there may be some broken features or errors here and there, especially in the older versions, but most of it works well in our (limited) testing.

If you want to delete all the WordPress databases so you can start from scratch, you can cd to the wp_archive directory, run vagrant ssh, then run /vagrant/database/drop-wordpress-databases.sh.

Varying Vagrant Vagrants

Varying Vagrant Vagrants is an evolving Vagrant configuration focused on WordPress development.

Overview

The Purpose of Varying Vagrant Vagrants

The primary goal of Varying Vagrant Vagrants (VVV) is to provide an approachable way for developers to work in a development environment that matches a project's production environment as closely as possible.

The default configuration provided by VVV is intended to match what 10up finds to be a common server setup when working with high traffic WordPress sites.

How To Use Varying Vagrant Vagrants

The best part is that it's ready to use as is. Clone or download the repository and vagrant up to get a sandboxed Ubuntu server on your computer with everything needed to develop a WordPress theme or plugin.

You should also feel free to treat VVV as a scaffold.

Entirely different server configurations can be configured through the use of a custom provisioning script or by modifying the config files included with this repository. The existing configuration can also be extended significantly through the use of provision-pre.sh and provision-post.sh.

The Future of Varying Vagrant Vagrants

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 describing environment requirements at a project level so that developers joining a project can ramp up quickly. This includes code, database, and content files.

Getting Started

What is Vagrant?

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.

The First Vagrant Up

  1. Start with any operating system. Vagrant and VirtualBox have installation packages for Windows, OSX and Linux.
  2. Install VirtualBox 4.2.12.
  3. Install Vagrant 1.2.2
    • vagrant will now be available as a command in the terminal
  4. 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
  5. Change into the new directory
    • cd vagrant-local
  6. Start the Vagrant environment
    • vagrant up - omg magic happens
    • Be patient, this could take a while, especially on the first run.
  7. Add a record to your local machine's hosts file
    • 192.168.50.4 local.wordpress.dev local.wordpress-trunk.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 local.wordpress.dev local.wordpress-trunk.dev" >>/private/etc/hosts'
  8. Visit http://local.wordpress.dev/ in your browser for WordPress 3.5.1, http://local.wordpress-trunk.dev for WordPress trunk, or http://192.168.50.4 for a default web page.

Fancy, yeah?

What Did That Do?

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 virtual machine using VirtualBox. When ready, it runs the provisioning script also provided with this repository. This initiates the download and installation of around 85MB 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 several 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 85MB 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 What?

Now that you're up and running with a default configuration, start poking around and modifying things.

  1. Access the server with vagrant ssh from your vagrant-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.
  2. 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.
  3. Power off the box with vagrant halt or suspend it with vagrant suspend. If you suspend it, you can bring it back quickly with vagrant resume, if you halt it, you can bring it back with vagrant up.
  4. 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 next vagrant up
    • If you require any custom SQL commands to run when the virtual machine boots, move database/init-custom.sql.sample to database/init-custom.sql and edit it to add whichever CREATE DATABASE and GRANT 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 as db_name.sql. The import-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.

Credentials and Such

WordPress Default - Stable Release

  • URL: http://local.wordpress.dev
  • DB Name: wordpress_default
  • DB User: wp
  • DB Pass: wp
  • Admin User: admin
  • Admin Pass: password

WordPress Trunk

  • URL: http://local.wordpress-trunk.dev
  • DB Name: wordpress_trunk
  • DB User: wp
  • DB Pass: wp
  • Admin User: admin
  • Admin Pass: password

MySQL Root

WordPress Unit Tests

  • DB Name: wordpress_unit_tests
  • DB User: wp
  • DB Pass: wp

What do you get?

A bunch of stuff!

  1. Ubuntu 12.04 LTS (Precise Pangolin)
  2. nginx 1.4.1
  3. mysql 5.5.31
  4. php-fpm 5.4.14
  5. memcached 1.4.13
  6. PECL memcache extension 2.2.7
  7. xdebug 2.2.1
  8. PHPUnit 3.7.19
  9. ack-grep 1.92
  10. git 1.8.2.2
  11. subversion 1.7.9
  12. ngrep
  13. dos2unix
  14. WordPress 3.5.1
  15. WordPress trunk
  16. WP-CLI
  17. WordPress Unit Tests
  18. Composer

Feedback?

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....