lawik

lawik

Nerves Core Team

I don’t know why I did not try this sooner:

System.cmd("epmd", ["-daemon"])
Node.start(:"nerves@#{Toolshed.hostname()}.local")
Node.set_cookie(:mycookie)

And voíla you can connect the regular Livebook app to your device as an attached node and you can run and re-run entire experiments over and over again.

The fact that you keep your livebook can make this a fair bit more practical than the IEx session I use so much during Nerves development.

Need to try it with some sensors and graphs as well.

When I mentioned this on Slack Frank brought up the need for port forwarding on NervesHub so you can connect to you devices. That would be quite rad and I need to read more about wireguard :smiley:

I imagine this would allow having runbooks for checking the status of a device. Fixes for known problems. That kind of stuff. And of course working with a specific troubled device over time. Without pasting stuff over and over.

Any other ideas about how to use it?

Showing Posts 1 to 8

jonatanklosko

jonatanklosko

Creator of Livebook

For completeness, depending on the use case, you can also use the “Remote execution” smart cell. This should remove restriction on Elixir version compatibility between Livebook and the Nerves device. Also, this way you can offload some computation to the local machine, and you can bring extra dependencies for charting data and whatnot. Finally, it has a lower footprint, because attaching Livebook temporarily loads some Livebook-specific modules into the node, whereas the cell only does an :erpc call : )

lawik

lawik OP

Nerves Core Team

That is a very good note. I just happened to be on recent versions that match I suppose.

D4no0

D4no0

Doesn’t nerves hub already provide ssh connectivity to the devices? If yes, then you can use port forward via ssh.

lawik

lawik OP

Nerves Core Team

Not quite. Nerves provides SSH into IEx.

NervesHub provides IEx terminal in the browser over WebSocket without needing a direct network path from you to the device. Device connects to NervesHub over WebSocket. You connect to NervesHub via browser. Meaning free NAT traversal and so on but no general networking.

Two similar features but quite different.

D4no0

D4no0

Makes sense, a pretty optimal solution that is easy to manage.

I was investigating a few years ago about potential solutions to overcome restricted networks and I am positive SSH can set a reverse tunnel, the only thing you need to do is monitor the connection and restart it from time to time, otherwise it should behave in the same manner as the websocket connection you are currently establishing from client devices.

lawik

lawik OP

Nerves Core Team

Yes. SSH can establish a tunnel for any traffic you like pretty much. We would need the device to connect to a NervesHub service and your device to connect as well and then make those sockets have a chat.

Wireguard can do the same. But to my understanding Wireguard is way less overhead and operates more like a VPN giving you a flat network. You would be able to treat it as if your Nerves device was on the local network. SSH is only port forwarding.

Wireguard would enable you to access a web UI, SSH and so on.

lawik

lawik OP

Nerves Core Team

SSH remote tunnels were a blessing for me on restricted networks in my teens. I could expose any port I liked if could SSH to my home server and my home server ran SSH on port 443.

Not ehat I would do for a good dev flow with Livebook and Nerves though. Maybe some nice MNDP (mndp | Hex) for discovery which I guess could work over Wireguard. (Edit: seems like Wireguard does not support broadcast/multicast so no discovery)

D4no0

D4no0

On this topic, there are also commercial solutions like cloudflare that offer a generous free tier. Their service is battery included, however their service is not protocol agnostic and you have to select one from the list when creating a tunnel.

The only big concern with the tunnel they provide is that you need to use their client, there is cloudflared that is most probably too resource heavy for an IOT device, it’s more oriented to be deployed on a proxy server, and warp that they market as the lightweight replacement, but the one I never managed to get working on linux.

— All posts loaded —

Where Next? Top

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 94592 917
New
cblavier
Hey there, It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
caslu
I want to open this thread for you all to discuss and help those who really like Ash but are still hesitant to use it in a real project. ...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
heathen
Quite interesting article Google brought me. Didn’t find any mentions about it here. What do you think in general? Would you use togethe...
New
maennchen
:warning: Security advisory: Decimal DoS vulnerability A vulnerability has been published for decimal where very large exponents can cau...
New
marciol
It would be helpful to have a list of companies worldwide that hire engineers without prior experience in Elixir. Often, it can be quite ...
New

Other Trending Topics Top

marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
Aludel - LLM Evaluation Workbench Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews