VirtualPress: easy, clean WordPress dev environments on your workstation

8 views
Skip to first unread message

Jason A. Lefkowitz

unread,
Dec 19, 2017, 4:05:27 PM12/19/17
to washington-...@googlegroups.com

Hey gang --

A few years ago, I put together a set of scripts that let you easily create isolated, virtualized development instances of WordPress on your workstation using VirtualBox, Vagrant and Ansible. I originally made it as an easy kick-starter for my own WP projects, but when I showed it to other WP developers they were interested in using it too, so I put it up on GitHub and I've been maintaining it ever since.

Anyway, those scripts worked well for a long time, but the stack they set up for you (PHP 5, Ubuntu 12.04 LTS) has gotten kind of long in the tooth. So to replace it, I've developed a new version that uses Ubuntu 16.04 LTS, PHP 7 and MySQL 5.7. As a bonus, it does all its Ansible stuff on the VM now, so you don't need to have Ansible installed on your workstation to use it anymore. Only two dependencies instead of three! Hooray!

You can get it here:

https://github.com/jalefkowit/virtualpress

Just clone it into a directory, then cd into that directory and do a "vagrant up" and (assuming you have the two dependencies installed) a minute later you'll have a complete, clean install of WordPress for you to hack on running at 192.168.50.50. (And you can change that IP address in the Vagrantfile, if you like.) Clone it again into a different directory and you'll get a different clean environment, completely isolated from the first. And the whole recipe for setting up those environments is specified in simple YAML text files, so you can easily tune it for each new project if you need something other than the default configuration.

Why use this instead of rolling your own WP setup for each new project? Beyond the time savings, this stack provides some nice conveniences and QA touches that it can be easy to overlook:

  • MySQL and WordPress are both set up automatically to use MySQL's UTF8MB4 character set, ensuring your project will be 100% emoji friendly 👍
  • XDebug is installed and configured for you, ready for you to use with your IDE of choice
  • WP-CLI (http://wp-cli.org/) is installed and ready to go
  • Point ansible-playbook (http://docs.ansible.com/ansible/latest/ansible-playbook.html) at the included setup.yml and a cloud VM you have SSH access to, and you'll get an identical environment set up there for easier deployment
These tools have saved me a ton of time and headaches over the years; I share them in hopes they can save you some as well. If you have questions or feedback, feel free to ping me.

-- Jason Lefkowitz

-- 
Jason A. Lefkowitz
web: http://www.jasonlefkowitz.net
email: ja...@jasonlefkowitz.net

"A statesman... is a dead politician.
Lord knows, we need more statesmen." -- Bloom County 

Sandy Smith

unread,
Dec 19, 2017, 4:11:09 PM12/19/17
to Jason A. Lefkowitz, DC PHP Developers Group Washington
Awesome, thanks for sharing this!

--
You received this message because you are subscribed to the Google
Group: "Washington, DC PHP Developers Group" - http://www.dcphp.net
To post, send email to washington-...@googlegroups.com
To unsubscribe, send email to washington-dcphp-...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/washington-dcphp-group?hl=en
---
You received this message because you are subscribed to the Google Groups "Washington, DC PHP Developers Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to washington-dcphp-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Oscar

unread,
Dec 19, 2017, 4:42:00 PM12/19/17
to Jason A. Lefkowitz, washington-...@googlegroups.com
Very nice. I bet it wouldn't be much effort (if any) to use with any PHP/MySQL application either, right?

Jason A. Lefkowitz

unread,
Dec 19, 2017, 4:46:43 PM12/19/17
to washington-...@googlegroups.com

That's correct -- all the WP-specific stuff is (or should be, anyway) isolated in the "wordpress" role, so it would be easy to just comment out or delete that role and just get a clean LAMP stack. Or replace it with your own role with instructions for installing/configuring whatever app you prefer on top of that stack; the MySQL, Apache and PHP roles all have handlers defined to restart those services, so if a step in your specific config needs to bounce one or more of them you can do that from within your custom role.

(More information about Ansible roles is available here: http://docs.ansible.com/ansible/latest/playbooks_reuse_roles.html)

- Jason

Tac Tacelosky

unread,
Dec 19, 2017, 5:24:55 PM12/19/17
to Jason A. Lefkowitz, DCPHP PHPDC
Works like a charm!  Thanks, Jason.

Tac

--
You received this message because you are subscribed to the Google
Group: "Washington, DC PHP Developers Group" - http://www.dcphp.net

For more options, visit this group at http://groups.google.com/group/washington-dcphp-group?hl=en
---
You received this message because you are subscribed to the Google Groups "Washington, DC PHP Developers Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to washington-dcphp-group+unsub...@googlegroups.com.

Michael Alaimo

unread,
Dec 23, 2017, 7:04:36 AM12/23/17
to Tac Tacelosky, Jason A. Lefkowitz, DCPHP PHPDC
Thanks Jason.  I am checking it out right now.


For more options, visit this group at http://groups.google.com/group/washington-dcphp-group?hl=en
---
You received this message because you are subscribed to the Google Groups "Washington, DC PHP Developers Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to washington-dcphp-group+unsubscri...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages