Recent Blog Posts

Ansible for DevOps - 50% off on LeanPub for Black Friday 2017

Though I've had a little less time to work on the book lately, I'm still very much invested in keeping Ansible for DevOps the best and most up-to-date guide to using Ansible for infrastructure automation. It's been over two years since the first '100% complete' edition was released, and in that time I have published over 200 updates on LeanPub—and even have full test coverage for all the book's examples, which are open-sourced and available in the Ansible for DevOps GitHub repo!

Ansible for DevOps - 50% off for Black Friday 2017

For this year's Black Friday, I'm discounting the book—50% off—but only on LeanPub. I like to push readers to LeanPub, because:

Stripping the 'Vary: Host' header from an Apache response using Varnish

A colleague of mine found out that many static resource requests which should've been cached upstream by a CDN were not being cached, and the reason was an extra Vary http header being sent with the response—in this case Host.

It was hard to reproduce the issue, but in the end we found out it was related to Apache bug #58231. Basically, since we used some RewriteConds that evaluated the HTTP_HOST value before a RewriteRule, we ran into a bug where Apache would dump a Vary: Host header into the request response. When this was set, it effectively bypassed Varnish's cache, as well as our upstream CDN... and since it applied to all image, css, js, xml, etc. requests, we saw a lot of unexpected volume hitting the backend Apache servers.

To fix the issue, at least until the upstream bug is fixed in Debian, we decided to strip Host from the Vary header inside our Varnish default.vcl. Inside the vcl_backend_response, we added:

Photos of St. Michael the Archangel Catholic Parish

I was recently invited to take some pictures of the campus and interior of St. Michael the Archangel Catholic Church in Shrewsbury, MO (nestled in a neighborhood just outside of the City of St. Louis), and I just finished processing and uploading them to Flickr; see my St. Michael the Archangel photos.

St. Michael the Archangel Catholic Parish sanctuary

There are so many of these little Catholic churches in St. Louis and around the country, with so much hidden beauty. I always try to find a neat little parish near where I stay in any city I visit; usually these parishes showcase more artwork than even the diocesan cathedrals—though that's not the case in St. Louis!

Stopping Docker containers via fuzzy matching on the name

I recently needed to hack together a setup where Docker containers are spawned by an automated process, then later, a garbage collector runs and kills off all spawned containers. This is on a system where there could be anywhere from tens to hundreds of containers running at any given moment, and I needed traceability of different containers while they're running.

One of the easiest ways to have at-a-glance traceability is to have named containers, e.g. spawned-worker-1, spawned-worker-2, etc.

So if I do a docker ps --format '{{.Names}}', I can get a full list of all running containers by name. And then if I want to filter that list to only show me spawned-worker- prefixed container names, I can pipe the output through grep, awk, and xargs to use the container names in a Docker command, like so:

docker ps --format '{{.Names}}' | grep "^spawned-worker-" | awk '{print $1}' | xargs -I {} docker stop {}

In this case, I'm stopping all containers with spawned-worker- as the start of the name.

Pages

Subscribe to Jeff Geerling's Blog