Profile photo

from miller import blake

Hello, I'm a systems administrator, I get paid to be a software developer, I like Python, I'm a fan of good design, and I don't think things always have to be so stupid.
You can follow me @bltmiller, subscribe via RSS, and email me.

Use SaltStack as a Data Source in Grafana

April 24, 2017

For visualizing and alerting on your infrastructure and services, Grafana is awesome, and its power gets amplified when dashboards and alerts and be templated to work with your constantly evolving infrastructure. So how do we decide how to apply templates to the right set of servers and services? Well, of course you can preseed key-value pairs on your servers and have your collector agents like Telegraf work off of your seeded data. However, if you are familiar with or favor an externally managed source of record like node groups in Salt, templating in Grafana works a little different.

Continue reading »

How to Clean Apple Watch Sport Bands

April 23, 2017

If you’re like me and constantly tint everything around you a slight shade of indigo from your raw denim jeans, then your white Apple Watch Sport Band is starting to look a little shabby after 2 years of everyday use. Luckily, it only takes about 5-10 minutes of effort to restore your band to its original color.

Continue reading »

Send Kapacitor Alerts to Slack Through a Proxy

February 20, 2017

Kapacitor does not have the ability to work behind an HTTP(S) proxy, and while that is indeed in the works, you might need something working today.

Continue reading »

Docker Swarm 1.12 Cluster Orchestration with SaltStack

November 27, 2016

Starting in v1.12.0 of Docker Engine, there is a new way to manage your container orchestration layer in swarm mode. For starters, it now comes with its own service discovery baked in. With the drastic improvements to the simplicity of swarm mode, let’s see how we can automate the spin-up of a cluster using SaltStack.

Continue reading »

SaltStack Best Practices Cheat Sheet

October 26, 2016

By design, Salt is not opinionated. That means that its flexibility allows you to create your own patterns and designs for concepts where it makes sense. The best practices outlined here are meant to be suggestions – not doctrine. Thus, this is a living document that evolves over time as your infrastructure’s needs change.

Continue reading »

Sanpai – Inspect Subject Alternative Names on SSL Certificates

October 17, 2016

There are plenty of ways to inspect and work with SSL certificates, but I could not come across anything quick and easy that allows me to visually and programmatically inspect the contents of an SSL certificate’s SANs. Sure, I can bust out a nasty one-liner from the command line, but nothing beats the ease of a quick Python script.

Continue reading »

Use Jenkins to Run a Function as a Service Platform

October 13, 2016

Most shops use Jenkins as a continuous integration/delivery solution - the unequivocal primary role for Jenkins. Hidden in plain sight, however, Jenkins also comes with all the tools necessary, right-out-of-the-box, to supply your infrastructure team with a function as a service platform. In fact, Jenkins was doing FaaS long before it was the hot new thing.

Continue reading »

iOS 10 Landscape Rotation Lock Bug

October 3, 2016

I encounter this periodically whenever I’m laying in bed with my iPhone at an angle, but I could never nail down exactly why the home screen kept reverting to landscape orientation. What adds to the frustration is that a mechanism like rotation lock always seems to sneak in an annoying bug into each major iOS release. Whether this bug was introduced with iOS 10 or was already present, I figured out the steps necessary to reproduce it.

Continue reading »

Diff Files Across Salt Minions

August 15, 2016

Simple file management in Salt is trivial with the file.managed function, and it can quickly get extended with some Jinja templating. Say, for instance, each collection of minions for a given data center has its own NTP server it needs to hit, then you might like a way to check that each minion’s NTP config file is identical without having to run a high state. Of course templating abstracts problems like this away, but in environments where it’s possible for manual changes to sneak in, this becomes useful.

Continue reading »

Get Nginx Version With grep

August 5, 2016

It’s really easy to get the version of Nginx installed through your package manager or just from visual inspection, but there’s a small hurdle to overcome if you need to programmatically check the version when a package manager isn’t available.

Continue reading »

How to Smoke Test Nginx Server Block Routes

August 1, 2016

When your Nginx routes start getting complex it can be time-consuming to makes heads or tails of the configs. I wanted an easy and automated way to make sure that my Nginx server blocks were routing correctly to my backend apps/websites and replying with the right response code, a simple 200 OK in most cases would suffice. Call it functional testing if you like. So I whipped up a simple Python script to make it happen.

Continue reading »

Install SaltStack Without Root Privileges

May 23, 2016

I found documentation on running SaltStack, both the master and minions, to be lacking. It’s easy to forget how painful not having system access is when you’re use to the power and convenience of simple things like apt and yum, so this guide is intended to be the fresh glass of water to those of you in you-don’t-get-root-because-shutup hell looking for an alternative solution for making things suck less. It is totally doable! For the record, I don’t encourage this kind of behavior, so avoid it if you can.

Continue reading »

Dynamically Manage and Update a File with SaltStack

May 12, 2016

I had the problem recently of two functions infinitely changing each other every time a highstate was triggered. The requirement was that a given config file needed to contain some static content on every minion along with, potentially, some added content based on a minion’s given role (e.g. web server and database server have different needs).

Continue reading »

Beyond PEP 8

April 14, 2015

Ever a slave to foolish consistency, I must admit to falling into the PEP 8 distraction pit when Raymond started cleaning up the code. I really love listening to him speak – he’s the type of presenter that inspires me to learn better about when to be inconsistent and inwardly critical of my own work. Stop rearranging the deck chairs!

Continue reading »

Get a List of Keys From a Dictionary in Both Python 2 and Python 3

April 13, 2015

It was mentioned in an earlier post that there is a difference in how the keys() operation behaves between Python 2 and Python 3. If you’re adapting your Python 2 code to Python 3 (which you should), it will throw a TypeError when you try to operate on keys() like a list. So, if you depend on getting a list returned from keys(), here’s how to make it work for both Python 2 and Python 3.

Continue reading »

How to Provide Simple and Clean Global Configuration Variables in Python with YAML

April 11, 2015

I really despise software that keeps its configuration in the syntax of the language in which the software is written - I’m looking at you, Drupal. Users should not need to know PHP, Python, or Ruby in order to customize settings. That’s why storing settings as YAML is vastly superior since it’s easy for humans to parse at a casual glance. So, what’s the best and most Pythonic way to provide settings globally across a project?

Continue reading »

Represent File Structure as YAML with Python

March 17, 2015

I needed to collect some test cases for some shoddy software that kept breaking when files and folders were named or arranged a certain way. I was tired of manually copying and pasting folders back and forth trying to troubleshoot the issue, so I automated the whole task away and turned it into a great tool for unit testing and bug reporting at the same time.

Continue reading »

Remove or Change Content in an Already Pushed Commit to a Git Server

August 9, 2014

Rebasing with git is an extremely powerful and intimidating tool both new users and even those more familiar with basic git concepts. It can work across multiple branches and tags to massage complex commit structures, but the most common and useful feature of rebase is to delete or modify content in a single commit that has been pushed to a public-facing server (e.g. GitHub).

Continue reading »

Kickstarter Expectations

April 9, 2014

Facebook bought Oculus, virtual reality headset for gaming that began as a campaign on Kickstarter, and I think most reactions are being projected in the wrong direction. Facebook is clearly building a network of companies through the acquisitions of Instagram and WhatsApp, both of which seem to be siloed off from each other. No Facebook login or any cross-product sharing is required to use any product, and I think it’s reasonable to assume that this will hold true for the foreseeable future – Zuckerberg is nothing if not a student of tech industry history, trying to keep his company relevant before social networking fades away. In other words, Mark knows it’d be suicide to slap Like buttons and sharing features all over Oculus. Though, all of that still won’t keep the gaming community from shaming Facebook further.

Continue reading »

Should Internet Service Providers Be Able To Discriminate Data?

April 2, 2014

It must be Wednesday, because network neutrality has been popping up (again) recently around the tubes. The landscape is always evolving and the latest happenings include the dismantling of some FCC policies enforcing net neutrality, which we all knew was bound to happen anyway. The effects have been felt immediately and can have a huge impact on how we use and interact with the Internet. I often have trouble grasping the entire controversy surrounding net neutrality, so I’d first like to try to make some sense of it all and then I’ll provide the correct, albeit futile, solution.

Continue reading »

Building This Site

January 21, 2014

So, I decided to open source the code for my site. It’s generated using Jekyll and Twitter Bootstrap. Jekyll works by taking your HTML wireframes (in my instance, provided mostly by Bootstrap) and CSS and runs a templating engine through it. Then, when it’s time to make a post, I open up my favorite text editor and start typing away (in Markdown). Take 2014-01-21-building-this-site.md for example:

Continue reading »

Consumer-grade Hard Drives In A Server Environment

January 21, 2014

Brian Beach over at Backblaze has been doing some great analysis on their hard drives lately. It’s good to see respectable reliability numbers from the Western Digital drives since I use them as well. Backblaze, famously, doesn’t use enterprise-class drives for their Storage Pods; they instead use consumer-class drives from Hitachi, Western Digital, and Seagate to reduce costs. So far, the data seems to suggest that using consumer-grade hard drives in a server might actually be a good choice.

Continue reading »

Copyright © 2016, Blake Miller. All rights reserved. | Sitemap · RSS