Be Nice to Sysadmins, Add a version.txt to Your App

One best practice that I rarely see used by companies is a version file that denotes what is currently in Production. Let’s step back a bit and use a real-life situation. A company released a new version of their Web application to Production from master (using the git-flow model). Some hours go by and its now late into the night when the application fails. Unfortunately, all of the developers are now at home and only the poor operator (who is on-call support) is left wondering what happened. The software didn’t fail in the test environment, what could possibly have gone wrong. ...

November 10, 2014 · 2 min · 411 words · Scott Brown

Be Careful with the Order of Ansible Handlers

I recently stumbed across an gotcha with Ansible that I wasn’t aware of. It happened when I was writing notification handlers that should run after a new version of code is downloaded to a server. In my task file I was downloading (via Git) the latest code from the repository: --- # roles/app-code/tasks/install_code.yml - name: ensure code repository is downloaded git: > accept_hostkey=yes key_file={{ app_code_bitbucket_private_key_file }} repo={{ app_code_git_repository }} dest={{ app_code_home_dir }} version={{ app_code_git_version }} sudo: yes sudo_user: '{{ app_user_name }}' notify: - update gems - precompile assets - add hash marker file - restart app server Whenever new code is downloaded to the system, the task will show CHANGED and each notification handler will be called. In this case, we want each notification to happen in a specific order because you don’t want to restart the application server before the assets and third-party libraries are configured. In this case, using an array may not execute the handlers in this order even though you’d expect it to. ...

November 9, 2014 · 2 min · 385 words · Scott Brown

Simple Per-User Bash Profile Configuration

While creating Ansible scripts to automate the configuration of servers, I frequently stumble across an issue where I need to setup a user’s profile on the server that has a custom path. The issue that arises is that the .bash_profile file is a single file where any number of PATH exports can be provided. Any step in a provisioning tool like Ansible should be aware that this only adds state. I have seen other DevOps workers use modules like lineinfile, which I abhor because you can never be certain that the module will work. You will always ask yourself, “did the PATH on line 5 get set correctly, or did someone change one character (or perhaps add a comment) that now breaks the lineinfile module task?” ...

November 6, 2014 · 3 min · 483 words · Scott Brown

Gathering Requirements Properly

Today I want to highlight a bit issue with the tech industry, and that is the gathering of requirements from customers. I’ve seen far too many product and project managers gather requirements from the client, then pass them to developers to implement without batting an eye as to their feasibility. Let’s use a specific example pulled from my work today: users can post images but post needs to go through approval before going live ...

October 3, 2014 · 2 min · 375 words · Scott Brown

Most of Your Time At Work Will Not Be Coding

…at least, not in the traditional, hands-on-keyboard sense. This is one of the things that a lot of CompSci graduates don’t realize when they head out into the workforce. When I look back at all my jobs and put on my PHB’s hat, I would say that I spend less than 25% of time coding. Another 25% of the time is reading code, yak-shaving or searching for solutions. The rest of the time is spent talking with people; this is a skill that neither CompSci, nor most university courses teach. These numbers always fluctuate (some days, I put my head down and code almost 100%), but it says a lot about how much “coding” I do. Also note that I wrote “talking with people”, not “talking to people” because there is a big difference. ...

September 26, 2014 · 3 min · 636 words · Scott Brown

Harvesting Usernames from Websites

I am working with a client right now on their Web application. While creating an account to do testing, I noticed a glaring security issue that allows people to harvest usernames. This topic has been covered before, I am still surprised that it keeps popping up around the Web, but this time is a bit different. I should note that the client knows about the issue, but what I want to point out in this article is how insidious the issue becomes. ...

September 10, 2014 · 6 min · 1182 words · Scott Brown

Boolean Columns Answer Too Few Questions

One of the things that I dislike seeing in an application’s database architecture is the use of booleans. They do not convey enough information to any party to be meaningful, other than to ask a question that expects a yes/no answer. Often, questions such as those as a follow-up question that the field cannot answer. For example, in many databases I see the following fields on a User model: User ==== id primary key username the user's username credential password_encrypted authenticates the username ... other fields ... enabled true if the user is active, false otherwise When a user has been banned for doing something inappropriate, an application simply sends this query: ...

September 8, 2014 · 3 min · 563 words · Scott Brown

My Personal Tech Radar Chart

I finished speaking on the phone with a recruiter and, yet again, I had to spell out exactly what I look for in a job. It’s difficult to explain the same thing and have people understand what I mean, so I decided to be even more opaque and put it in a radar chart. That, and I love radar charts. To read the chart, higher numbers mean things I like doing more. And things I like to do more of, mean jobs that make me happy. And a happy Scott is a very productive Scott. ...

August 22, 2014 · 1 min · 130 words · Scott Brown

Adding Test Data Through Metaprogramming

Note: Contrary to what you are about to read, I am still against metaprogramming on the whole, as it adds an unnecessary amount of magic that may confuse other developers. That being said, I would hate working in a language without it. Use sparingly, like junk food. “With great power…” Yadda yadda. Enjoy the article. I am currently writing a gem to wrap the Cleanspeak API and I was using the JSON examples in my test cases that they supply in their API docs. I wrote the test cases like so: ...

August 22, 2014 · 4 min · 642 words · Scott Brown

Learning to Fib Correctly

I have been looking into Elixir and I am enjoying the language (mainly from both a readability standpoint, I haven’t done enough to form an opinion about its performance benefits). I read the chapter on recursion and then applied it to a quick and dirty Fibonacci implementation (my favourite way to learn recursion in a new language). It is as easy ascreating a new file called fib.ex and adding the following: ...

August 21, 2014 · 5 min · 1005 words · Scott Brown