wu1786
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:
[{kernel,
[
{sync_nodes_optional, ['n1@127.0.0.1', 'n2@127.0.0.1']},
{sync_nodes_timeout, 10000}
]}
].
Then I made release:
http://www.phoenixframework.org/docs/advanced-deployment
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
"127.0.0.1". 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: ["https://example.com",
"//another.com:888", "//other.com"]
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: "example.com"],
But what should I do next? How should I run application from third device ? (load should be splited into these 2 notebooks)
Thanks
Most Liked
cpgo
I belive url: [host: "example.com"], should be set to your local IPs
wu1786
I changes url to:
url: [host: "192.168.43.236"],
(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@127.0.0.1 seems to be in use by another Erlang node
but I can acces server from any device in network on url:
192.168.43.236:8888
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









