DEV Community

Cover image for DevOps and IoT: Better TOGETHER!
Davide 'CoderDave' Benvegnù
Davide 'CoderDave' Benvegnù

Posted on

DevOps and IoT: Better TOGETHER!

We all know and I think can agree that DevOps is good for Application Development.

But is DevOps a workable goal for IoT development? Do we really need DevOps in IoT?

Let's go over the challenges and some possible solutions for IoT DevOps, and see why I think DevOps is good for IoT as well.

Intro

Today I want to talk about two topics that you don't normally see discussed together: DevOps and IoT.

We all know that DevOps can bring many benefits to organizations adopting it (I have a whole video about it) but when it comes to applying DevOps in the IoT space those benefits may not be immediately evident or, perhaps, we need to look at them from another angle.

And I would argue that most of the time they are even more important than doing it on normal applications... more about this later.

Let me also say that even tho there are many different "kinds" of Internet of Things, if you will, from tiny sensors which perform a single task autonomously, to complex appliances. For the sake of this post, I will try to keep this as general as possible talking about things that can apply to any kind of IoT development.

Video

As usual, if you are a visual learner, or simply prefer to watch and listen instead of reading, here you have the video, which to be fair is much more complete than this post.

(Link to the video: https://youtu.be/LPNMlP165v4)

If you rather prefer reading, well... let's just continue :)

The Challenges

Alright, so... do we really need DevOps in IoT devices development?

Consumer IoT

From the consumer side of things, we are living in an age when customers test a device first, usually utilizing the product for their needs through its mobile app, and give feedback on the missing features directly to the developers. That is the only way for the developer teams to understand what the customers really want and how their device performs.

And think about wearables or personal assistants as well.

In those scenarios, how do you make sure you deliver the right quality to your end users?

And how do you improve the experience if there is any gap or problem?

These are just few of the challenges IoT developers face. And it gets even more complex when we talk about industrial IoT.

Industrial IoT

We now have millions if not billions of devices, from small autonomous sensors, to boards attached to other existing device to make them smarter, and all those devices help controlling many aspects of the processes which bring products and services through a production line.

Whether we are talking about controlling a factory floor, monitoring a cold cell for food storage, or tracking a shipping in real time... That's all done through IoT Devices.

Remember, those devices may be in difficult locations, and they are absolutely essentials for the production lines and the businesses they have been created for.

As an IoT developer, you need to make sure the device, its firmware, and its software are working properly and have the quality and reliability the client expects before they are installed.

Perhaps even more importantly, you need to make sure your devices are secure and secured, so to avoid any possible data breach and security issue.

You also need to be able to react as quickly as possible in case of incidents, because the economical impact of a bug, a malfunction, or a security breach is potentially huge.

This is probably where DevOps can have the most impact.

The Solutions

Alright, enough talking about the challenges. Let's see how DevOps can help when dealing with IoT.

If you are familiar with DevOps, you probably already have some ideas on how to tackle the challenges I've just described. I would categorize them into 4 areas:

  • Quality
  • Security
  • Responsiveness
  • Monitoring

Quality

Talking about quality, we need to make sure the end product we have is reliable, works well, and virtually bug free. It could be difficult updating the firmware remotely, or at least quite inconvenient for the user. And of course as we all know this is an area where DevOps really helps.

Feedback Loop

In fact, through the Feedback Loop that is proper of DevOps, we can and should iterate during the development of both the IoT software, which can be the firmware and any control application, and the hardware to ensure their quality is up to our standards.

Yes, you've read it right. We should apply DevOps to the Hardware development as well, or at least its core concepts.

If we talk about the firmware, it is basically just a piece of software and as such it can be, and should be I would say, version controlled. And then everything can be reviewed through pull requests and code review, tested automatically, and even deployed to either device emulators and even physical devices.

And if we talk about hardware, of course we cannot use the same tools but we can basically proceed through revisions and apply the same concepts of review, testing, and improving.

Security

And this is tightly related to the second point, Security.

We all know that security is important in any application, but as I've mentioned before, security is even more important in IoT.

Once again this applies to both hardware and software.

Because of its connected nature, an attacker could leverage a security vulnerability remotely to breach a network perimeter.

If this happens in a consumer environment it is bad because it could lead to the theft of personal information, but if it happens in a corporate or industrial environment, where business trade secrets are stolen, it could potentially be even worse.

Luckily, with DevOps and Shifting left on security, which basically means embedding security early in the development process, and testing for vulnerabilities as soon as possible, you can prevent that.

Alright, at this point we should have a batch of devices with good quality hardware and software, and which have been properly tested for bug and security. We ship it to the factories or to retailers, and our clients start to use them.

How do we know if everything works correctly?

This is where monitoring comes into the picture.

Monitoring

Thanks to the telemetry, we should be able to understand how our devices are functioning, if there is anything wrong and if we can enhance anything.

Monitoring is a crucial part of DevOps, and for IoT the only difference is that this feature may be either part of the software or the hardware. We should always collect telemetry and monitoring data, consider the results in our feedback loop, and learn from them.

Of course there may be cases in which collecting real time telemetry is either not possible, like in some highly protected or regulated industries, or not practical. In those scenarios we should either have a local-only telemetry collection, that then can be sanitized and analyzed, or try to collect the monitoring data at given intervals.

This is important because monitoring impacts our responsiveness, which is the last of my points.

Responsiveness

In case of failure, malfunction, bug or breach we want to be able to react as quickly as possible and to minimize the impact for the client or user.

Of course if it is a hardware failure, the only thing we can do is replacing the faulty device, but at least we can identify the problem as soon as possible thanks to the monitoring.

If instead the problem is on the software, we should have some process in place to identify the problem, after the telemetry and the monitoring alerted us, fix it, get it tested and get it deployed back to the device.

This is similar to what we would do in a normal application, but this is where it gets complex. We would need to deploy the changes to hundreds, thousands, or potentially even millions of affected devices.

Once again, DevOps can help us. We should build an effective CI\CD pipeline that builds and tests the firmware or the control software, and then creates a packaged version for deployment.

Remote Update

At this point, we should probably rely on some IoT management platform, like for example the Azure IoT Suite, that takes care of the update of device firmware over the air, remotely.

Our CI CD Pipelines should just upload the new software package to the IoT management platform and kick off the remote deployment.

And when it is done, and the new telemetry starts to come in... our job is complete, hopefully successfully!

Conclusions

Alright, I think that's it for today. Let me know in the comment section below what you think about DevOps for IoT, if you are already doing it or if you have other challenges that I haven't mentioned here.

Also, let me know if you would like me to do some other videos about DevOps for IoT but more in practice, to see what this would mean when working on real devices.

Once again, check the whole video here, which is more interesting :)

Discussion (1)

Collapse
n3wt0n profile image
Davide 'CoderDave' Benvegnù Author

Hey y'all let me know what you think about IoT DevOps.