WordPress local development using WP Stack
I’ve been working with a local development extension of WP Stack for a couple months at Knewton, and this now my workflow. I can usually develop in local master, but when needed I’ll work in a local development branch first.
My point is, it’s much simpler to do this than it used to be—so easy a marketing guy can do it. I don’t know of many places where the marketing team has developed this level of self-sufficiency.
Development
- Open iTerm2
The dev guys told me this is better than Terminal. I use these three panes to manage my stuff. They use like 12.
cd projects/marketing-deploy/vagrant/knewton.com- “marketing-deploy” is a private repo (hosted on Github) that handles all our deployment configuration
- “vagrant” is Vagrant, which handles virtualized development. I’m basically running a second computer on my computer.
- “knewton.com” is a copy of our WordPress-based site, including database and server configs
git pullFetch and merge from the repo’s origin (Github)
vagrant upBoot up the Vagrant virtualization
vagrant knewton:syncSync the database from production to local
vagrant knewton:localdev onChange my hosts file to point www.knewton.com to my local version
- Do some work
- preview my work on www.knewton.com
git add&&git commit&&git push
vagrant knewton:localdev offRevert hosts file
vagrant suspendShut down the Vagrant virtualization
Deployment
- ssh to the admin box
The admin box is a separate instance hosted on AWS that handles deployment, rollback, restarting nginx/memcached/etc., and more with single-line commands
- switch to the deploy user
cap deploy
