In my previous blog post, we looked at all the hardware that runs the HASSP module. These components power and analyze the capsule, but what about the rest of the setup: the software. In this post, we’ll take a tour of our system installation, SQL Server instance, and custom code that makes this all work.
Operating System: Ubuntu 16.04.2
The Joule probably could run Windows 10, but should it? After all, we only have 4GB of RAM and not a lot of storage. So for a small installation like the one we have here, Windows just wasn’t going to work out. Instead, we opted for the Ubuntu Server distribution of Linux. It’s small (< 800 MB), it sips power, works wonderfully with the hardware on the Joule.
Yes, Linux. Ever since Microsoft announced Linux support back in March of 2017, I’ve been waiting for this moment. There’s been lots of blog posts and speakers showing off how to install SQL Server on Linux (and not to mention Microsoft’s documentation pretty much puts it in easy-to-follow steps), but I haven’t as yet seen anyone actually showing anything off that runs it. One of our goals of the project was to highlight the full capabilities (and possibilities) of a SQL Server running Linux, and that’s what we’re doing here.
Recent updates to the Linux version of SQL Server include SQL Agent, which means we can use that to do what every person running SQL Server should do: run backups. Since the Joule has a MicroSD card slot in addition to it’s internal storage, we’re going to configure regular backups of the data in-flight. I figure if this thing craters, the thing most likely to survive is a MicroSD card.
The HASSP Software: Node.js
Installing node.js in Linux is done pretty much like every other software package you install. Using your package manager du jour, you run a command similar to:
apt-get install nodejs
apt-get install nodejs-legacy
apt-get install build-essential
(Note: if you’re installing this on a desktop version of Linux, you might already have build-essential installed)
Sensor Library: Johnny-Five
Installing Johnny-Five is pretty easy. From a command line, it’s essentially:
npm install johnny-five;
Source Code Management: GitHub
Of course we’re using Git and Github. Our software repository is out here: https://github.com/drewfurgiuele/HASSP Take a look at the code for yourself, and let me know what you think. This entire project was designed to be open source from the start, so take my code. Use it, abuse it, I don’t care! Go create!
Service Watchdog: PM2
So now we have our operating system and our software, the big question remains: how do we actually get it to run on the device? It’s not like we’re able to hook up a monitor and keyboard to the HASSP once it’s ready for flight. Instead, we opted to use PM2. PM2 is a node-based process manager. It can be configured to run at startup as a service in Linux, and you can specify which programs you want it to run, and when.
Our thought is that if, for whatever reason, the software stops responding or the hardware shuts down in flight, we want it to restart. When it does, we want our data collection to resume. PM2 should manage that for us.
Setting up PM2 is easy, and you install it via npm:
npm install pm2 -g
Once installed, you can specify a specific node application to run. You can find more info over on their web site.
We’ve been continuously improving and adding to our software over the past couple of months, and we have a rock-stable, easy to configure and use platform. Again, this all wouldn’t be possible if it weren’t for Microsoft’s commitment to Open Source. After all, this is the High Altitude SQL Server Project. Now that you’ve seen the hardware and the software that makes this thing tick, it’s time to fly it. Make sure you stay tuned to my twitter feed or this site for announcements. We’ll have some launch day streams we’re going to run. Thanks for reading!