I had a trip to Porto for WordCamp Porto earlier this month and I gave a talk on my experience with “WordPress Setup for Large Projects“. Porto is a great city with an active community from Portugal (Porto, Lisbon and other cities too) and it was a pleasure to hang out there for a few days, drink some sangrias, eat some francesinhas and definitely spend a great hack day with the folks that attended the Sunday fun.
Video from my session is now available:
We had some issues with the VGA so I had to present at Daniel’s Mac which was a last minute change and it took me a minute or two to get used to it (and find my remote in one of my numerous pockets, for that matter).
A narrative coming below, since the sound isn’t perfect and I am a fan of the reading part mostly (especially when there is a summary)
It’s a well-known fact that random people outside of the community still find WordPress to be a “simple blogging platform” and many developers are not used to building larger systems (which is a common standard for other platforms and languages, i.e. the Java/.NET communities).
I have outlined the popular LAMP/LEMP stacks for setting a project, and shared my experience with version control. While I was working at NASD here, we used to SVN our PowerPoint presentations as the training team was distributed (7-8 people on-site and at least a dozen freelance speakers), somewhere in 2005-2006. Since WordPress relies mostly on SVN so far, I had to share my thoughts on the power of Git and the GitHub social platform, and how handy could it be to fork a plugin and use it in your project, being able to give back your changes or keep in sync with the original library/project.
Three more frameworks mentioned during my talk were Behat, Mink and Selenium.
Behat and Mink are the equivalents of Cucumber and Capybara in Ruby, for Behavioral-Driven Development (BDD) which is a think that could be implemented in more projects that are not separated enough to be tested with unit tests. Selenium is another animal that could be integrated with Mink for web testing, additionally there’s a Firefox plugin for recording web actions as a macro and repeating them later (if you have repetitive UI tasks), could be used for automated UI testing and supports numerous scripting languages that could help you with the specifics.
WP-CLI is a natural thing I use in my projects and I’m super happy that it’s available by default on SiteGround’s servers! Although UI is easier even for some developers, there are numerous tasks that could be automated with WP-CLI, not to mention that most of the role/capabilities work has no UI, nor the options management, or other features that could be found there.
Vagrant and VVV were on the table, too. I’m a Linux user myself and my stack is actually quite compatible with the servers I work with, but I’m still using it for different PHP versions and especially Ubuntu servers (the VVV stack comes with that by default). Puppet and Chef had their presence for configuring and setting larger servers (and nodes) from a larger network for larger project, which is the case when we’re building a scalable infrastructure.
The “let’s FTP everything” part has been annoying for me for quite some time, and Capistrano was my deployment advise. The major perks were sync’ing with different servers from different repos/branches and mainly the fact that new versions are uploaded without interfering with the existing production release, but rather just pointing the webroot symlink to the new uploaded version. It takes milliseconds (if not microsecs ) and a rollback happens in a blink – just pointing to the previous version!
WP-Stack by Mark Jaquith (who had been mentioned twice earlier during the talk for his major presence in the WordPress community when it comes to larger setups and toolkit) and Capistrano-WP are two of the helper plugins one could use to put Capistrano in place for WordPress.
Git hooks come in place all the time, especially if you’re like me and write something custom to catch your personal coding errors during a night coding shift. I managed to find a leftover comment in Core with that and the code base is now cleaner (and I’m no longer leaving some debugger; or so statements over there).
Composer was presented at WCEU by Rarst too, and it’s another dependency management helper. Grunt is the thing that builds a lot of the WordPress core for a few months now, with numerous scripts for everything, and both projects tend to remind me Ant and Maven in the Java ecosystem.
Travis CI is the Continuous Integration server that I first tried while pushing my first commits to WP-CLI (Scribu set that in place, I believe). The CI server is responsible for setting everything in place, as the “grand manager” in a large corporation. You can set several environments that would get your latest commits, test your code there (by running all sorts of tests on various setups), and confirming that the code is legit according to what is known to cause troubles.
I didn’t have the time to go further (actually I have to apologize to Jose for getting a bit late with the talk!), but there is a lot more to be covered, especially when it comes to debugging, security, more scalability (benchmark testing), monitoring and so forth. However, most projects would still need a decent stack, testing implemented here and there (on the top of a repo in version control) and various tools to automate that and keep it error-free at least from manual “Oops!” moments.
I’m always open to research and try other tools from the development and devops world that come handy while working on larger projects, so – comments are welcome!