July 29, 2016

Techno Bits vol. 77: Summer Engineering Project

The first week back is always the most hectic, and this week has been no exception. I spent last week with my parents in California, and taking Charlie to see the otters at the Monterey Bay Aquarium. Dude loves him some otters, and really, can you blame him? They're pretty cool. You can look at some of my favorite pictures from the trip if you want.

I purposefully left my laptop at home on this trip, and I went iPad-only for the duration, which turned out to be crazy and wonderful all at once. Some of our VPNs aren't L2TP over IPSEC yet, and so they were unavailable to me on the trip, and of course that was one I needed. Goes to show you: make sure your configs stay up to date, so changes don't catch you off-guard. This serves as your reminder that PPTP VPNs are going away in Sierra and iOS 10. Don't sleep on this one.

Anyhow, as part of our speaker's gift for the MacDevOps conference, Mat gave all of us talky-types Raspberry Pi 3 computers. If you've missed the boat on what a Raspberry Pi is, it's simple: it's a powerful computer with a quad-core ARM CPU, 4 USB 2 ports, an Ethernet port, HDMI and audio out, and runs off a standard micro USB power supply drawing 5 volts. It's smaller than a deck of cards. Here's mine:


When I got it from Mat, it was just the raw computer, though, and I ended up buying a kit from Fry's and MCM Electronics to get the rest of what I needed. I got a 16GB memory card already flashed with NOOBS, a case, a power supply, and an HDMI cable. You can source all these parts separately and probably do better than $65, but I was at Fry's and it seemed like a good deal at the time. ¯\_(ツ)_/¯ 

The Raspberry Pi comes out of the kit box with just a bare circuit board, so you're going to need a case ($7). You're also going to need a keyboard ($16) and mouse ($7) to start. It'll run off a spare iPhone charger or other 5V charger and a USB Micro cable ($5). You will also need a Micro SD card, and you get one pre-loaded with NOOBS ($18).

NOOBS is a basic boot loader than includes the Raspberry Pi-focused release of the Debian OS called Raspbian. If you've ever used Debian anywhere, Raspbian will feel instantly at home for you. Setup is really straight forward. Tell it to install the OS and go get a snack and come back in 10-15 minutes.

When Raspbian is done, you've got a device with a basic Linux desktop ready to go, GUI included. So, now what do you want to do with it? If you're me, you want to think about setting up your deployment stack on the box. The best way to do this? Docker. 

Installing Docker on your Raspberry Pi is a trivial exercise. I started to read this guide on Github for doing it, but I realized that the current state of the release of NOOBS and Raspbian means you only need to do step 4. And that's it. You can now grab Docker images left, right and center. Here's me grabbing imagr-server from docker hub:

Now that I had established that I could do the basics of what I needed for deployment, I turned to other ideas for the Raspberry Pi. Rich Trouton reminded me that it was a capable game machine for older games, and so I started looking at RetroPie. I didn't want to flash the card in the Pi, mostly because I didn't have a great way of doing that on vacation, so I used RetroPie-Setup to handle the whole deal.

I used my Dad's PS4 controller, attached via USB cable, to play Zelda, Zaxxon, Super Mario Bros. and Mega Man 3 while I was home. Please note: these were all games we owned in one format or another. Only play ROMs you own, etc, etc, lawyers with briefcases, etc.

A couple commands I found it super helpful to know, and you might need as well. These are ones I didn't ever need to pick up in the Mac-using world:

startx - Starts the GUI for your environment. I am embarrassed I didn't know this.
emulationstation - Starts the RetroPie emulator to play your ROMs.
shutdown -h now - Shutdown your Raspberry Pi from the command line. I always remembered the -r, for restart, but not -h for halt.

Networking in the Raspberry Pi world is not as simple as maybe you'd like, especially if you're in the command line for wireless stuff. But don't give up, this is a fixable problem.

Now, go forth and get yourself a kit like this one ($90), or this one ($60), and have a good time. Computing should be fun, and you can do a ton of fun stuff with this one. Take on a little summer engineering project to get you out of your head.