Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Painless WordPress Development
Environments with Vagrant and Ansible
October 7, 2014
You need a server
Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025
The Problem
● If you're building Web...
Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025
Making Do
● PHP's built-in web serve...
“There's got to be a better way!”
Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025
What Makes A Good Dev Environment?
A...
Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025
A Better Way
Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025
Three Tools
● VirtualBox: virtualiza...
Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025
Lock-in? Nah
These tools don't just ...
Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025
So Why Choose These Three Tools?
The...
Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025
VirtualBox
What is it? General-purpo...
Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025
VirtualBox
Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025
Vagrant
What is it? A tool for encap...
Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025
Ansible
What is it? A tool for orche...
Let's get to work
Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025
Step 1: The “Base Box”
● A packaged-...
Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025
Vagrant Cloud
Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025
Step 2: The Vagrantfile
● A Ruby scr...
Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025
Inside the Vagrantfile
Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025
Step 3: The Inventory File
● Tells A...
Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025
Inside The Inventory File
Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025
Step 4: The Playbook
● A text file i...
Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025
Inside the Playbook
Putting It All Together: A Case Study
Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025
VirtualBox + Vagrant + Ansible == Wo...
Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025
Thank You!
Jason A. Lefkowitz
Presid...
Upcoming SlideShare
Loading in …5
×

Painless WordPress Dev Environments with Vagrant and Ansible

1,464 views

Published on

How to use VirtualBox, Vagrant and Ansible to bootstrap ready-to-use WordPress development environments in seconds.

Published in: Technology
  • Be the first to comment

Painless WordPress Dev Environments with Vagrant and Ansible

  1. 1. Painless WordPress Development Environments with Vagrant and Ansible October 7, 2014
  2. 2. You need a server
  3. 3. Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025 The Problem ● If you're building Web applications, you can't do your work without a server ● But where should that server be? ● In other words, where should you be doing your work?
  4. 4. Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025 Making Do ● PHP's built-in web server? ● Installing everything locally? ● WAMP? ● Staging server? ● Directly on the production server?
  5. 5. “There's got to be a better way!”
  6. 6. Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025 What Makes A Good Dev Environment? A good development environment should be... ● Private ● Homogeneous ● Repeatable ● Easy
  7. 7. Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025 A Better Way
  8. 8. Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025 Three Tools ● VirtualBox: virtualization software ● Vagrant: encapsulates virtual environments ● Ansible: easy configuration management
  9. 9. Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025 Lock-in? Nah These tools don't just work with each other – others can be swapped in where appropriate ● VMWare, Docker, Amazon EC2 ● Real hardware, EC2, commodity VPSes ● Chef, Puppet, Salt
  10. 10. Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025 So Why Choose These Three Tools? They offer an appealing combination of: ● Power ● Desktop utility ● Ease of use
  11. 11. Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025 VirtualBox What is it? General-purpose virtualization software ● Can guest anything that runs on x86/AMD64: Windows, OS X, Linux, BeOS, MS-DOS, OS/2... ● Can host on Linux, Windows, OS X, or Solaris
  12. 12. Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025 VirtualBox
  13. 13. Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025 Vagrant What is it? A tool for encapsulating virtual environments ● Specify standard configurations for virtual machines... ● … then use Vagrant to bundle them all up in a clean, ready to go state ● Then you can roll out new instances of them just by copying a few text files
  14. 14. Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025 Ansible What is it? A tool for orchestrating machine configurations ● Create and run recipes that take you from bare OS to fully configured system ● Install software ● Change configuration files ● Create, modify and remove users and permissions ● Do anything you can do from the command line
  15. 15. Let's get to work
  16. 16. Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025 Step 1: The “Base Box” ● A packaged-up VirtualBox VM with operating system (and sometimes other software) already installed ● Download from Vagrant Cloud, directly from vendors, or roll your own ● You can then share your own boxes with others
  17. 17. Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025 Vagrant Cloud
  18. 18. Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025 Step 2: The Vagrantfile ● A Ruby script that controls the configuration of the virtual machine ● Base box to start with ● Networking setup ● Available memory, CPU, disk ● Synchronized folders ● Which “provisioner” to use, and where to find its configuration files
  19. 19. Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025 Inside the Vagrantfile
  20. 20. Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025 Step 3: The Inventory File ● Tells Ansible which machines you want to run your provisioning scripts against ● In our case, it's just one machine, the local VM ● Specified in the Vagrantfile as ansible.inventory_path ● Can also specify variables to pass to your Ansible “recipe” for system setup
  21. 21. Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025 Inside The Inventory File
  22. 22. Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025 Step 4: The Playbook ● A text file in YAML format, telling Ansible step by step how to provision your system ● What's YAML? http://www.yaml.org/ ● Each “play” in the playbook represents an action to be taken ● Playbooks can be nested, so they can be developed as discrete components ● Plays are (supposed to be) idempotent, so you can run them multiple times without side effects
  23. 23. Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025 Inside the Playbook
  24. 24. Putting It All Together: A Case Study
  25. 25. Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025 VirtualBox + Vagrant + Ansible == WordPress ● To aid in my own work, I have created a set of scripts that let you rapidly deploy a fully functional WordPress environment on your local workstation ● It's on GitHub for your forking pleasure ● https://github.com/jalefkowit/Vagrant-Ansible-Wordpress ● But you could do the same thing for Drupal, Symfony, Laravel, MediaWiki... whatever you want ● Learning these tools let you speed past futzing with system administration and get back to what you do best: writing beautiful PHP
  26. 26. Rogue Repairman Productions | Alexandria, VA | info@roguerepairman.com | 703-542-4025 Thank You! Jason A. Lefkowitz President, Rogue Repairman Productions http://roguerepairman.com jason@roguerepairman.com Technology sucks. We make it suck less.

×