lawik

lawik

Nerves Core Team

TIL: Accessing a Nerves device from Livebook

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?

Most Liked

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

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.

lawik

lawik

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)

Where Next?

Popular in Discussions Top

New
WolfDan
After doing a port from a c++ library to my project in phoenix I’ve seen that I need a faster way to run this algorithm and I found this ...
New
mmport80
I have put far too much effort into Dialyzer over the last year or so - and basically - I doubt it’s worth the effort. It’s not as easy ...
New
arcanemachine
https://nitter.net/josevalim/status/1744395345872683471 https://twitter.com/josevalim/status/1744395345872683471
New
Ankhers
Just a little information upfront. Generally speaking, if I feel like I need to either break a pipe chain or use an anonymous function in...
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
PragTob
Hey everyone, this has been on my mind for some time and I’d love your input on it! TLDR: I feel like maps are superioer for storing and...
New
100phlecs
Are there any downsides, like perf issues, to putting all functional components in CoreComponents as long as you prefix it with the conte...
New
joeerl
I’m playing with Elixir - It’s fun. I think @rvirding does give Elixir courses these days. Re: files and database - when I given Erlang ...
New
kostonstyle
Hi all How can I compare haskell with elixir, included tools, webservices, ect. Thanks
New

Other popular topics Top

sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36128 110
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

We're in Beta

About us Mission Statement