Web Development

  • Hosting a nonprofit website for free with WordPress, Azure, Trellis, and Terraform

    I open sourced the WordPress stack and Azure web server infrastructure used for awakeningchurch.com.

    Azure can host WordPress at no cost because Microsoft offers $3,500 a year in Azure credits for nonprofits. You only need about $360 of these credits to serve a simple website with a staging and production servers.

    WordPress stack

    The WordPress repo is a combination of Trellis and Bedrock which provide server provisioning and dependency management powered by Ansible and Composer. You can manage it all with the simple Trellis CLI.

    Inside you will find:

    We are using Composer to install and update WordPress plugins like these:

    Some custom plugins we developed for custom post types like teaching and events are not yet open source. We are moving from Azure DevOps to GitHub for hosting repositories and these plugins will make the move soon.

    Infrastructure with Terraform

    The infrastructure repo contains a Terraform configuration to setup a blue-green deployment of a staging and production servers.

    You can get a lot of performance out of a small server with Trellis when using FastCGI caching.

    The setup is simple: a single Standard B1s server and a Premium SSD P4 32 GB for each environment. This costs about $30/month for two servers with one per environment. We only use about $360 of our $3,500 credits so the hosting is free.

    Other infrastructure

    We also use Azure storage for storing WordPress uploads and the Azure CDN for delivering uploaded assets. Uploads and CDN URLs are handled by the Azure Storage Plugin. Costs are minimal and there are plenty of left over credits to spend.

    This storage infrastructure is not included in our web Terraform infrastructure because it was created long ago.

    What’s next

    As I need to recreate servers to upgrade them, I plan to extend the Terraform repo to include a wrapper stack to switch Cloudflare DNS to new servers. I do DNS changes manually for now.

    Self-hosting is great

    I hope this example of hosting a WordPress website will help you in creating websites of your own.

    Nonprofits with nerds on staff (or volunteering) can make use of the $3,500 in Azure credit to make their website hosting free.

    I believe owning your web presence is important. Most folks can grab a domain and pay a provider to host WordPress. Since you control your site’s data, you can easily grow your site later and have hundreds of hosting options, plugins, and themes to build your site.

    And if you are comfortable on the command line, you can use the Trellis CLI to create a new WordPress installation and start a $5 DigitalOcean droplet which is more than powerful enough to host most websites. You can locally develop your changes and deploy them to your production site with little effort.

    Getting started looks something like this:

    brew install roots/tap/trellis-cli vagrant virtualbox
    trellis new example.com
    trellis up

    This very site uses Trellis. I host several more websites using similar tools which makes self-hosting WordPress much easier.

    WordPress block editing has made WordPress into a very flexible tool for content. I recommend you try WordPress out if you haven’t used it in a while — it’s good.

  • Three Talks

    I’ve been busy this month speaking at HackSI, YUIConf, and Bayjax. The videos will be available soon, but you can check out the slides now:

    My testing talks reveal what I’ve been working on for a few months: yo/tests, a commit-based test report for YUI that helps us ship quality releases. Compared to Jenkins’ build-based test silos and build-based CI dashboards, yo/tests actually lets engineers know what’s broken by organizing results around commits instead of build numbers and hiding flaky tests and infrastructure.

  • Commas for Developers

    Brent Simmons pays attention to the details and gets right to the point:

    If your writing — in tweets and especially on your blog and product pages — is full of misspellings and improper capitalization and other errors, I will lose trust in you and your product. If you’re careless with language, are you also careless with software development?

    I make misspellings and other errors more often than I’d like. Everybody makes these mistakes. Yet, I think it’s important to put as much care into finding errors in language at least as much as finding errors in code.

    (The crux of his post is something that I was instructed to avoid over and over again in middle school. I can relate.)

  • Sharding & IDs at Instagram (2012)

    Back in 2012, Instagram Engineering wrote about sharding & IDs. I re-read it yesterday and this particular requirement for their ID generation system still stands out:

    The system should introduce as few new ‘moving parts’ as possible—a large part of how we’ve been able to scale Instagram with very few engineers is by choosing simple, easy-to-understand solutions that we trust.

    “Simple, easy-to-understand solutions that we trust.” Their solution skipped fancier alternatives for something that worked. Remember: you’re paid to write code that works.

  • Why mobile web apps are slow

    Drew Crawford wrote a very long and well-cited article about why mobile web apps are slow.

    Now I am going to warn you–this is a very freaking long article, weighing in at very nearly 10k words. That is by design. I have recently come out in favor of articles that are good over articles that are popular. This is my attempt at the former, and my attempt to practice what I have previously preached: that we should incentivize good, evidence-based, interesting discussion and discourage writing witty comments.

    The article primarily discusses JavaScript performance. After reading Drew’s article, you’ll understand why JS usage on mobile has to be relatively light compared to what you can get away with on desktop.

    I’d love to see more of this good discussion on non-JavaScript impediments to creating good mobile web apps.