Connecting cluster with different cookies

José Valim jose.valim@REDACTED
Tue Aug 10 13:14:49 CEST 2021


Hi Raimo, we are using this feature in Livebook
<https://github.com/livebook-dev/livebook>. Livebook is a web application
for writing interactive code notebooks. In Livebook you can connect to any
other Erlang node, with its own name and cookie, to programmatically
extract information from a node, either of production data or of the VM
itself, and build graphs, visualizations tables, etc. You can find a quick
example on this tweet by Michał Slaski
<https://twitter.com/michalslaski/status/1402243589720117255> of using it
for VM instrumentation.

The way it works is that we have a web app cluster running Livebook (the
server). Then for each code notebook we spawn a separate VM to run the
notebook code. So the Livebook cluster is managing several code runners.
At this point, all server instances and all runners are using the same
cookie. Then, if you want to connect to a separate production cluster, to
gather information from it, you would call erlang:set_cookie(ProdNode,
ProdCookie) from your code notebook.

We could just change the runner's main cookie before we connect to ProdNode
but that would make it impossible for other and new instances of the
Livebook server to connect to said runner. Supporting a list of cookies
would work for us though (and perhaps it could have other benefits too,
such as secret rotation in live systems. you would temporarily support the
old and new cookies for a time period while migration happens).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20210810/1f437808/attachment.htm>


More information about the erlang-questions mailing list