Thoughts about DevOps

I have had quite a few DevOps interviews lately, and it is just about to come off of my resume completely. I think that I genuinely confuse people, because I have a security patent from IBM, I seem to make little dashboard widgets, I talk in very abstract ways about agile thinking (functional scripting no less) but have not been a paid ‘developer’, but rather an Operations Person. Actually making code run consistently and streamlining processes, migrating from one solutions to the next, and then downloading, installing, and supporting all the fancy packages that you guys need has just always seemed more important to me. When I first started at IBM, there was so much work to do that was fulfilling that didn’t necessarily involve writing code.

I bring your legacy solutions directly to the door of Amazon and roll forward with a reasonable plan to get your entire infrastructure ported over to it, shut down your servers and pack them up to ship away, but I am not a developer. I am IT infrastructure, and if your team if of a certain size, then you really need a couple of guys like me. I live in the shell and code or learn new stuff like docker or aws because I enjoy it, but I really think that your dream Linux Admin/DBA/aws/Java coder is much rarer than you might imagine.

So maybe there are two very different sorts of DevOps people that need to be working together, like we always have.

http://insights.wired.com/profiles/blogs/what-is-devops#axzz4oca6v6Es

Exploring BlueMix

I just got a trial BlueMix account from IBM.  I will begin to play with it.  I like to map out such efforts in a special shell solution which I call sbshell.  Generally, I iterate between the shell and editor to begin to create a functional library.  In many cases, shell will not be part of the final solution, but it gives me a good place to start and allows me to quickly turn incidents and problems into working prototypes.

 

john@purple:/var/www/html$ sb.init
Reload web...
Reload site5...
Reload web...
Reload svg...
> sb.vi bluemix  

This creates an initial set of bash library files named ‘bluemix’, the first is local to my user, and the second is global. Both libraries are sourced into the environment after each save. I will then create a bluemix function that will run successfully, but will just ssh into my remote instance by default. In it I will store everything that I know about bluemix and begin to add functionality. It is like a scratchpad that becomes a launchpad.

#!/bin/bash

-() { return; }
---() { return; }

bluemix() {

--- bluemix
  - Image ID:c3432649-385b-4b7a-909d-80ba79d5e84b
  - flavor ID:1
  
ssh linux1@148.100.5.125
}

The build just finished a new instance that I created, so I grabbed a bit of information that might be useful later and set up my ssh keys.

john@purple:~/.ssh$ bluemix
Last login: Wed Jul 19 14:48:00 2017 from 173.175.254.4
==============================================================================
Welcome to LinuxONE Community Cloud!

This server is for authorized users only. All activity is logged and monitored. 
Individuals using this server must abide to the Terms and Conditions listed here: 
https://developer.ibm.com/linuxone/linuxone-community-cloud-terms-conditions/. 
Your access will be revoked for any non-compliance.
=============================================================================
[linux1@bleugren ~]$ 

So now I have a pretty basic Jailshell to begin working from and some rough documentation of what I did. If come back and structure the
lines that start with ‘-‘ a bit better, then I can overload the – function to act in certain ways, the following line could be caused to execute a curl against the api, if I were to be allowed access to imageId. What is nice is that I don’t have to fully define that functionality right now.

- bluemix.imageId c3432649-385b-4b7a-909d-80ba79d5e84b

This way of thinking and coding is to supplement work in other languages, such as Nodejs or python and make Enterprise level connections which can be, for instance, scripted in conjunction with an ansible hostlist.

Enterprise DevOps (like System Administration) is often done it tiny burst between meetings or incidents, and I may work on something one day and not look at it again for two weeks.  These conventions may seem trivial, but over time I am able to keep track of many different projects.

[ note: I recommend getting a free trial of bluemix, it was easy to configure and get to a point where docker was installed and available. ]

 

Functional Scripting tricks

As I code and work more and more in this field of Information Technology that is now begin called DevOps, I begin to develop certain tricks that I form into a style.

Here are a few to play with:

- () { return; }

Now you can use the ‘-‘ at the beginning of a line as way
to leave comments. You should probably use this for structured comments that you might want to grab via reflection.

color() {
# The next line is functionally a comment too.
- alp color white red green blue
# If you overload the '-' function, then
# the color comment will become a function call
 if [ -n $1 ]; then
     case $1 in
       white)  FG='00m' ;;
       red)    FG='31m' ;;
       green)  FG='32m' ;; 
       blue)   FG='34m' ;;
      esac;
      printf "\033[$FG";
  fi
}

You can experiment around with what symbols you can overload in this way. So far, I found:

, . - + @

In what my structured comment line, I begin with the word ‘alp’. I will now define what ‘alp’ does.

# alp creates a function for each option defined
alp ()
{
- alp $1 $2
T=/tmp/$$
echo "$1.$2() { $1 $2; }" > $T
source $T
rm $T
}
alp color red
alp color blue
alp color white
alp color green

Now you have four new functions, one for each color.

declare -f color.red
color.red ()
{
    color red
}

So this is how I play with bash. It is very similar to how one might approach golang, python, or other functional languages.

Dealing with the “Silicon Valley” tabs versus spaces argument

The whole issue, of tabs versus spaces, which was dealt with on “Silicon Valley” last week, is easily resolved. No need to lose your super-genius girlfriend. In the show, she is shown hitting the space bar over and over when she could just hit tab a few times.

Of course the issue is that tabs can be interpreted visually in very different ways. Microsoft Word seems to want you to reset your tab stops for each line, or some other foolishness that I can’t quite wrap my brain around.

The answer is that you can use whatever you want, and can use .vimrc to change tabs to spaces if necessary. Since I am not working on the Linux Kernel, and often work with YAML, I have expandtab and tabstop set to 2. This allows me to nest loops with 2 spaces and never create a YAML file with tabs (which throws an error).

set tabstop=2 softtabstop=0 expandtab shiftwidth=2
— from .vimrc
 

 http://tedlogan.com/techblog3.html

Realtime OOP PHP SVG coding

Today I am devoted a bit of time to object oriented laser cutter controls. Although the 3d printer is wildly useful, I find that the things that I can create with it are simply too small and too fragile. The laser cutter, on the other hand, allows me to create large and stable objects. By creating jigsaw pieces, large boxes can be made. The pathing is tricky because the width of the laser must to taken into account. Each segment must be moved slightly in various directions in order to create a tight fit.

toolpath

Above is the finished product, ready to go to the Dallas Makerspace for test cutting.  I will only cut the green line, because it takes into account the width of the laser.  Below is a screen capture which shows how I work.  I run with a 5 second page refresh so that I can keep my fingers working on the code instead of mousing over to my browser.  Below is a snipped from the heat of the battle.  I just hardcoded in my path, as you see that I wasn’t quite finished defining my polygon below.   Next I will need a better separation of data and code, but I had to just get a prototype up and running first.  This way I know what is possible and reasonable and can now refactor in more flexibility.

Screenshot from 2016-05-30 11:13:12

http://secretbeachsolutions.com/svg

https://github.com/johnrigler/svg

box

Now I see the next calculation that I need to make. The male and female pieces fit snugly together, but now I need to adjust the side lengths and how deep the joining sections go. One problem solved, and on to the next.

Introducing sbstats (DevOps performance tracking)

For many years now, I have been capturing vmstat output and displaying it in a graphical LAMP solution.  It can load quickly into various graphing images that can be easily pulled down to your computer to annotate, or attached directly into emails.

sbstats

The page above shows many servers, one after another, in an easy-to-view stream.  Each line of graphs represents one week, so that one can quickly learn “the story” of how a server has been performing over time.  Memory leaks and i/o waits are especially easy to spot.  But the interface is also flexible enough to handle other data, provided that it is saved in the correct format.

sbstats2

sbstats4

 

Minecraft circle creator

I am spending some time revisiting and documenting some of my favorite php solutions.  They are all very light-weight and flexible.  This first one is a minecraft circle generator. You are supposed to pull up a circle size and then use it as a template in minecraft.  As you build levels upon levels, you will create large domes.

minecrafthttp://rigler.org/minecraft/

Here is an example of just starting out on the side of a hill.

ingame