Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The Internet of Gophers - Alexander Sowitzki - Loodse

GoDays
January 22, 2020

The Internet of Gophers - Alexander Sowitzki - Loodse

While a lot of research has been done around it, but the "Internet of Things" has developed into an Incompatible "Set of Networks of Things (ISONOT)" which is not really the original idea. If you want to go beyond basic implications like "Switch push -> Light toggle" you end up writing a lot of putty code that distracts you from your original goal. I want to show you that you can implement your own distributed Smart Environment with the help of Go. I discuss with you how to communicate with low level periphery, how you create a HA control plane for them and how to use a TSDB to store and visualize collected data.

GoDays

January 22, 2020
Tweet

More Decks by GoDays

Other Decks in Technology

Transcript

  1. Definition • Synonym is Smart Environment or Cyber Physical System

    • Environment full of components that can interact with each other • Those can be ubiquitous or plainly visible • Their Job: Sense - Reason - Act
  2. One Interpretation: Multi Agent Systems • Multiple ways to design

    such a System • A bunch of autonomous Agents • Each Agent is specialized for one job • Multiple Agents may cooperate to achieve a more complex goal
  3. What is the Goal? • Users can customize components to

    make life more easy • Users are often tech analphabets so ease of use is key • Those are contradicting goals
  4. What the Market has to Offer • “Security is complicated”

    • Complicated items don’t sell cheap • Uncomplicated items have predefined use cases, and are hard to customize • There is hardly a consumer market for ”programmer friendly” IoT devices
  5. What can the common Software Developer do? • If you

    can’t buy it, build it (and buy the subcomponents) • Software Skills and a bit of electronic knowledge are needed • Go fits perfectly in and works as a bridge between low and high level
  6. Measure & Control Things • Air (Temperature, Humidity, Pressure, Quality)

    • Plants • Light & Appliances • Common Wall Holes (Doors & Windows) • Yourself and your pets By Adafruit
  7. Use Breakout Boards • Beginners can use Breakout Boards for

    virtually every use case • Modules with very easy interfaces and requirements • Often well documented By Adafruit
  8. Or design your own PCB • Some problems require more

    integration • PCBs provide that and more • You can get exactly what you specify • Saves time and costs • Use Kicad to get started
  9. Add them to some System on a Chip • You

    could control everything with some microcontroller • Full OS simplifies development and reduces maintenance • Also increases connectivity and gives you more freedom • A fleet of SOCs has a lower power consumption than a regular desktop
  10. Get proper Tools • Precise tweezers • (Reflow) Soldering station

    • Lead free solder & smoke absorber (We learned from the Romans) • Poster glue pads • A bunch of tiny boxes
  11. Fetch Interesting External Data from the Internet • Weather forecast

    • Your commute • Postal tracking • Air traffic information
  12. ReST and JSON as Common Tongue • Messages Brokers bring

    advantages, but complicate your network • ReST+JSON is universal, relatively fast and easy to debug • In combination with DNS, High Availability is straight forward • You can just use your browser to interface with your system
  13. Use Secure Protocols • It’s 2020, use full TLS •

    Use the client authentication feature of TLS • Validation: LetsEncrypt for servers, Own CA with Vault or by hand for clients • If you have multiple sites, try WireGuard for a mesh VPN
  14. IPv6, nudge nudge • Again, it’s 2020 • Every service

    gets an IP-Address • No nginx frontend required, no TLS termination needed, easy to migrate • Don’t Masquerade, just tunnel the IP
  15. Don’t fear the Internet, fear the pain of not updating

    • Have a strategy in hand to keep your systems up to date • Use a system that only runs what you need (Ubuntu calls that “minimal”) • Having some endpoint exposed to the internet is still more safe than assuming your LAN is secure
  16. Interface with Hardware • Linux offers support for I2C, SPI,

    UART, Bluetooth and many more • You don’t need to use C or helper programs • Interface with drivers directly via syscalls like ioctl • If you actually have real time constraints, use a companion chip
  17. Split software into Agents • Things in your environment change,

    your Software also has to do so • Follow the microservice idea • While it looks harder to manage, isolation and testing is simpler • Draw some fancy diagrams
  18. Reinvent the Wheel, You need exactly four of those •

    Solutions exist in a multitude of different quality levels and use cases • If in doubt if a solution fit you, write it for your own specific use case • You create a combined solution that is mostly not generalizable
  19. Maybe even use K8s for management • Use some tool

    to manage your swarm of agents • You have your own cloud at home • Kubernetes makes things easy, use heavy SOCs or k3s • Ansible is for the traditionalists
  20. The constraints of your work • You don’t have a

    lot of free time • Use high quality components • They are still cheaper than a complete solution • Be safe