Hey folks, my team at work is going to be deploying an increasing number of production Nerves devices over the coming weeks/months, and I’m hoping to start a conversation about the common issues many of us face or will face as we undertake production Nerves projects.
A little background
The main purpose of these devices will be to collect various environmental data from sensors and push it over network to a data lake for further use. Think temperature/humidity/pressure/vibration/light, etc.
For this data to be useful, it will be important to know which device/sensor it came from.
The Nerves devices will be at least Raspberry Pi Zero W’s, Pi 3 B+s, and possibly more.
The sensor hardware will be at least Si7021 temperature/humidity, TMP102 for temperature, and likely more soon.
Quantity wise, it will be something like 5-10 devices in the near term, likely with dozens following that as the team gets more capacity and we get approval for more applications.
We have investigated NervesHub and will likely be using it (and contributing) as we are able.
We control the network/environment the devices will be in, so we will have physical and network access.
We’ve had some good experience so far doing over-the-air updates to a small number of devices, but are starting to feel the growing pains of configuring these devices as their numbers grow.
Some initial questions/thoughts
- Naming: Do you autogenerate names? Do you give devices “human” names?
- What kind of hardware identifiers make sense to rely on? Which don’t?
- What approaches have you been sucessful using to push configuration (env vars, etc) to hardware deployments? Pubsub? Erlang distribution?
- Any general advice or experience reports regarding naming/provisioning fleet hardware like this? Any war stories that are good to know?
- Automated monitoring/alerting/logging: general experience with these on Nerves hardware. We previously used a Cloudwatch/Logger integration and found it pretty unreliable. Anybody have good luck with any approaches in this area?
Thanks in advance
You had lots of questions. Here are some thoughts on device naming or assigning serial numbers:
First off, it always seems like everyone involved with a product wants to offer some opinion on how serial numbers should be assigned. Mostly the concern is how much information is encoded into the serial number, ease of assignment in the factory, and ease of typing the serial numbers in.
The only surprises I’ve run into are mishaps in manufacturing that caused serial numbers to be repeated and assumed unique IDs not being unique. The latter one happened on a product where the serial number incorporated the CPU ID and then after enough devices were made, a device failed to register due to repeated serial number. (You can imagine how much engineering time was lost verifying that yes, indeed, that a unique CPU ID really did repeat)
Since you mentioned NervesHub, NervesHub has two restrictions: 1. IDs need to be unique to your organization and 2. if you’re using NervesKey modules to authenticate the connection to NervesHub then the ID must encode to 16 bytes or less.
Since you’re not making many devices, manually assigning IDs seems reasonable.
One company I worked at created a project in Jira to track and keep history on devices. Each device was an “issue” (well, they customized Jira so it wasn’t called an issue) and the serial number was the Jira issue identifier. That ended up working out really well for them, since tracking device history was really important and the non-technical people in the organization liked Jira.
Another option if you’re using NervesKeys is that the
nerves_key library can make a suggestion for a serial number that’s guaranteed unique. See the NervesHub provisioning docs and the
One last thing, nearly every place I’ve worked at has printed out barcodes (usually Code128 linear ones) on the serial number labels. IMHO, trying to figure out short, easy-to-type serial number schemes doesn’t feel like a good use of time. If anyone ends up needing to type in the serial numbers a lot, they always seem to get a scanner.