Running Phoenix projects on two nodes (laptops)

Hi guys.

I’m trying to run my phoenix app on 2 notebooks (ubuntu) in same time (distributed programming).
My goal is: Run application from 2 nodes(independent notebooks) in same time (it should increase throughput)

I found this article:

I created sys.config file:

    {sync_nodes_optional, ['n1@', 'n2@']},
    {sync_nodes_timeout, 10000}

Then I made release:

When I run application from release I can see error on console->

[error] Could not check origin for Phoenix.Socket transport.

This happens when you are attempting a socket connection to
a different host than the one configured in your config/
files. For example, in development the host is configured
to "localhost" but you may be trying to access it from
"". To fix this issue, you may either:

  1. update [url: [host: ...]] to your actual host in the
     config file for your current environment (recommended)

  2. pass the :check_origin option when configuring your
     endpoint or when configuring the transport in your
     UserSocket module, explicitly outlining which origins
     are allowed:

        check_origin: ["",
                       "//", "//"]

But I need only test it in my local network (nooteboks are connected via wifi)

In prod.exs file I have url set to:
url: [host: ""],

But what should I do next? How should I run application from third device ? (load should be splited into these 2 notebooks)


1 Like

I belive url: [host: ""], should be set to your local IPs

1 Like

I changes url to:
url: [host: ""],

(it is IP of notebook1)

Then I make release again, start server from notebook1:
~/Documents/re/chatier$ bin/chatier console

Then I copy .tar.gz release to notebook2, run same command and I can see error message:

Protocol 'inet_tcp': the name chatier@ seems to be in use by another Erlang node

but I can acces server from any device in network on url:

1 Like