What's the correct way to join Nitrogen nodes?

11 views
Skip to first unread message

ramkrishn...@gmail.com

unread,
Feb 8, 2021, 2:56:48 AM2/8/21
to Nitrogen Project / The Nitrogen Web Framework for Erlang
Hello Jesse,

I've an autoscaling environment (AWS ECS) where Nitrogen nodes are started and stopped based on user load. This works well where comets are not used.

Comets work in clustered environment when -sname option is provided in vm.args file which is required to join Erlang nodes. Since these nodes are auto spawned, I need a different sname every time an instance is started.

Please let me know if you have any suggestions as to how Nitrogen nodes should be started so that they auto join the cluster of existing nodes.

Thank you.

Jesse Gumm

unread,
Feb 8, 2021, 1:08:40 PM2/8/21
to nitrogenweb
Hey Ram,

Might be worth looking into a "setup" script that will add the -name or -sname. Doing something where you pull the IP Address (similar to the `make cookie` rule in the Makefile):

For example, if you add this to Makefile:

name:
     echo -name myapp@`ip -4 addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'` >> etc/vm.args    


That will add, on my machine on my local network, that adds:


...to the vm.args file

If you must use -sname, then you could generate a random name using the same process with something like:

sname:
    echo -sname myapp_`openssl rand -base64 10 | head -n1 | sed -e 's/[^a-zA-Z0-9]//g'` >> etc/vm.args

That would just add something like this to the vm.args file:

-sname myapp_34n9m873yvn938

Personally, I'd lean toward the -name and IP approach, but that's just me.

If that points you in the right direction, let me know what you come up with,

-Jesse

--
You received this message because you are subscribed to the Google Groups "Nitrogen Project / The Nitrogen Web Framework for Erlang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nitrogenweb...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nitrogenweb/93186277-7682-4f0d-969b-36f9ae6ae3ecn%40googlegroups.com.


--
Jesse Gumm
Owner, Sigma Star Systems
414.940.4866 || sigma-star.com || @jessegumm

Ramkrishna Kulkarni

unread,
Feb 8, 2021, 11:38:35 PM2/8/21
to Nitrogen Project / The Nitrogen Web Framework for Erlang
Hi Jesse,

It does look simpler to add a command in the container launch script to modify sname parameter before starting Nitrogen in foreground. I'll stick with this.

Thanks.

You received this message because you are subscribed to a topic in the Google Groups "Nitrogen Project / The Nitrogen Web Framework for Erlang" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nitrogenweb/h0GfB-0ta5o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nitrogenweb...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nitrogenweb/CAPTXyXd80YF51duPYrO%2B9h8Pr_BTADbZL3ViAoz%2BRQ9WER3QYg%40mail.gmail.com.

braun...@gmail.com

unread,
Feb 9, 2021, 2:09:24 PM2/9/21
to Nitrogen Project / The Nitrogen Web Framework for Erlang
Never tested multi node setup with Nitrogen. What happens to comet processes? Do they keep working transparently respect to wf:insert_bottom/2 and friends...? What about wf:send/2?

What other obvious considerations should comet definitions take to work in multi node setups?

Ramkrishna Kulkarni

unread,
Feb 10, 2021, 6:02:05 AM2/10/21
to Nitrogen Project / The Nitrogen Web Framework for Erlang
Hi,

Since Websockets are enabled by default in the latest version, comet should work in a multi node environment. However, in my case I'm disabling websockets to distribute load more evenly across nodes. I'm hoping the process registry will handle this transparently if the comet poll requests end up on other nodes just like it does with session. I'm still looking into this and will update this thread on what I find out.

Thanks.


You received this message because you are subscribed to a topic in the Google Groups "Nitrogen Project / The Nitrogen Web Framework for Erlang" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nitrogenweb/h0GfB-0ta5o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nitrogenweb...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nitrogenweb/53992bca-ff63-41b5-8a88-ed8dc2194028n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages