$30 off During Our Annual Pro Sale. View Details »

Extremely Powerful Local WordPress Development with Vagrant and Friends

Extremely Powerful Local WordPress Development with Vagrant and Friends

Brad Parbs

July 25, 2015
Tweet

More Decks by Brad Parbs

Other Decks in Technology

Transcript

  1. (and it has some real neat friends)

    View Slide

  2. I’m Brad Parbs
    • Developer @ WebDevStudios
    • Push code to http://github.com/bradp
    • http://brad.party

    View Slide

  3. Let’s talk about local development environments.

    View Slide

  4. Let’s talk about local development environments.

    View Slide

  5. Let’s talk about local development environments.

    View Slide

  6. So, what’s Vagrant?
    Create and configure lightweight, reproducible, and
    portable development environments.

    View Slide

  7. I ♥ Vagrant & friends.
    Vagrant
    VVV VV

    View Slide

  8. I ♥ Vagrant & friends.
    • Easy WPCLI
    • Setting up sites super fast
    • Always up-to-date
    • No more MAMP
    • Keeps your system clean

    View Slide

  9. wp cli

    View Slide

  10. What can you do with WPCLI?
    $ wp core update
    $ wp plugin install logout-roulette
    $ wp scaffold post-type books

    View Slide

  11. Setting up and managing
    sites super easily!

    View Slide

  12. Scripting site setup
    • Auto-create Sublime project
    • Add to SourceTree
    • Open in Chrome
    • Anything you can imagine

    View Slide

  13. Installing Vagrant

    View Slide

  14. View Slide

  15. View Slide

  16. Installing Vagrant
    • Any OS works!
    • Install VirtualBox (4.2.x or 4.3.6 recommended by VVV)
    • Install Vagrant
    http://www.vagrantup.com/downloads.html
    https://www.virtualbox.org/wiki/Downloads

    View Slide

  17. How does it actually work though?
    • VirtualBox runs a VM
    • Vagrant manages it

    View Slide

  18. How to use
    • Clone a box
    • Start up a virtual machine
    • Use it!
    • Pause / Destroy it anytime

    View Slide

  19. Commands
    $ vagrant init
    $ vagrant up
    $ vagrant halt
    $ vagrant destroy
    $ vagrant provision
    $ vagrant ssh

    View Slide

  20. View Slide

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

    View Slide

  22. Installation
    $ vagrant plugin install vagrant-hostsupdater
    $ git clone git://github.com/Varying-Vagrant-Vagrants/VVV.git
    $ cd VVV
    $ vagrant up

    View Slide

  23. How VVV works
    • Uses Ubuntu+Nginx
    • Automatic provisioning script for WP updates
    • Keeps database on host filesystem
    • Easy to modify / configure

    View Slide

  24. Sites VVV creates for you

    View Slide

  25. http://local.wordpress.dev/ for WordPress stable

    View Slide

  26. http://local.wordpress-trunk.dev/ for WordPress trunk

    View Slide

  27. http://src.wordpress-develop.dev/ for trunk
    WordPress development files

    View Slide

  28. http://build.wordpress-develop.dev/ for the version
    of those development files built with Grunt

    View Slide

  29. http://vvv.dev/
    Default dashboard
    containing several useful
    tools: PHPmyAdmin,
    OPCache, links to all sites,
    etc

    View Slide

  30. VV
    http://vvv.dev/
    Default dashboard containing several useful tools:
    PHPmyAdmin, OPCache, links to all sites, etc
    https://github.com/leogopal/VVV-Dashboard

    View Slide

  31. Helpful aliases
    $ alias v=vagrant
    $ alias vp="vagrant provision"
    $ alias vup="vagrant up --provision && vagrant ssh"

    View Slide

  32. Other things
    • Prefer Apache?
    https://github.com/ericmann/vvv-apache

    View Slide

  33. Scripting Site Setup
    https://github.com/varying-vagrant-vagrants/vvv/wiki/Auto-site-Setup

    View Slide

  34. VV
    https://github.com/bradp/vv

    View Slide

  35. Installation
    • $ brew install bradp/vv/vv

    View Slide

  36. How does it work?
    Gives you a super helpful “$ vv” command

    View Slide

  37. How does it work?
    Gives you a super helpful “$ vv” command

    View Slide

  38. Commands
    • $ vv create
    • $ vv delete
    • $ vv list

    View Slide

  39. Advanced Commands
    • $ vv --deployment-create
    • $ vv --blueprint-init
    • $ vv -v up

    View Slide

  40. Developer Workflow
    (live demo ?)

    View Slide

  41. Speeding up Vagrant Provision
    • VVV looks for custom-provision.sh in provision
    folder.
    • You can remove the WP updates and apt-get
    updates for more speed.

    View Slide

  42. View Slide

  43. View Slide

  44. More Tips and Tricks
    • Anything you do that’s repetitive, script it!
    • Learn to love ‘vagrant provision’

    View Slide

  45. View Slide