Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Predict second port #93

Closed
ttufts opened this issue Dec 1, 2015 · 17 comments
Closed

Predict second port #93

ttufts opened this issue Dec 1, 2015 · 17 comments

Comments

@ttufts
Copy link

ttufts commented Dec 1, 2015

I want to run my code on a remote server and be able to SSH and tunnel my ports for connecting to the GUI.

My current problem is that I can't predict what the second port will be. It seems to be randomly selecting a port, but I'm not sure how.

@nzjrs
Copy link
Collaborator

nzjrs commented Dec 1, 2015

What second port?

@ttufts
Copy link
Author

ttufts commented Dec 1, 2015

INFO:remi.server:Started websocket server 127.0.0.1:52652

INFO:remi.server:Started httpserver http://127.0.0.1:8081/

httpserver starts on 8081 every time. websocket server is random.

On Tue, Dec 1, 2015 at 10:59 AM John Stowers notifications@github.com
wrote:

What second port?


Reply to this email directly or view it on GitHub
#93 (comment).

@ttufts
Copy link
Author

ttufts commented Dec 1, 2015

Callbacks don't seem to work without forwarding that port. None of my
buttons work.

On Tue, Dec 1, 2015 at 11:01 AM Thomas Tufts thomas.j.tufts@gmail.com
wrote:

INFO:remi.server:Started websocket server 127.0.0.1:52652

INFO:remi.server:Started httpserver http://127.0.0.1:8081/

httpserver starts on 8081 every time. websocket server is random.

On Tue, Dec 1, 2015 at 10:59 AM John Stowers notifications@github.com
wrote:

What second port?


Reply to this email directly or view it on GitHub
#93 (comment).

@nzjrs
Copy link
Collaborator

nzjrs commented Dec 1, 2015

The websocket port is a private implementation detail. Explain again why
you need to know it?
On 1/12/2015 5:01 PM, "ttufts" notifications@github.com wrote:

INFO:remi.server:Started websocket server 127.0.0.1:52652

INFO:remi.server:Started httpserver http://127.0.0.1:8081/

httpserver starts on 8081 every time. websocket server is random.

On Tue, Dec 1, 2015 at 10:59 AM John Stowers notifications@github.com
wrote:

What second port?


Reply to this email directly or view it on GitHub
<#93 (comment)
.


Reply to this email directly or view it on GitHub
#93 (comment).

@ttufts
Copy link
Author

ttufts commented Dec 1, 2015

My firewall blocks all ports.

I tunnel via SSH and forward ports 8081 and XXX so that I can connect with
a local browser to the REMI server running on the remote box.

On Tue, Dec 1, 2015 at 11:23 AM John Stowers notifications@github.com
wrote:

The websocket port is a private implementation detail. Explain again why
you need to know it?
On 1/12/2015 5:01 PM, "ttufts" notifications@github.com wrote:

INFO:remi.server:Started websocket server 127.0.0.1:52652

INFO:remi.server:Started httpserver http://127.0.0.1:8081/

httpserver starts on 8081 every time. websocket server is random.

On Tue, Dec 1, 2015 at 10:59 AM John Stowers notifications@github.com
wrote:

What second port?


Reply to this email directly or view it on GitHub
<
#93 (comment)
.


Reply to this email directly or view it on GitHub
<#93 (comment)
.


Reply to this email directly or view it on GitHub
#93 (comment).

@nzjrs
Copy link
Collaborator

nzjrs commented Dec 1, 2015

Supporting this use-case seems out of scope for REMI

@ttufts
Copy link
Author

ttufts commented Dec 1, 2015

I understand that supporting it or modifying REMI to support it might be
out of scope. Can you tell me in the code where it is choosing the port? I
am willing to make a local modification to the code to specify a constant
port for websocket, if that's what needs to happen.

It seems simple enough to offer an optional constant port.

-Tom

On Tue, Dec 1, 2015 at 11:27 AM John Stowers notifications@github.com
wrote:

Supporting this use-case seems out of scope for REMI


Reply to this email directly or view it on GitHub
#93 (comment).

@nzjrs
Copy link
Collaborator

nzjrs commented Dec 1, 2015

We had an optional constant port previously but that breaks the
single/multiple instance use-cases.

On 1 December 2015 at 17:30, ttufts notifications@github.com wrote:

I understand that supporting it or modifying REMI to support it might be
out of scope. Can you tell me in the code where it is choosing the port? I
am willing to make a local modification to the code to specify a constant
port for websocket, if that's what needs to happen.

It seems simple enough to offer an optional constant port.

-Tom

On Tue, Dec 1, 2015 at 11:27 AM John Stowers notifications@github.com
wrote:

Supporting this use-case seems out of scope for REMI


Reply to this email directly or view it on GitHub
<#93 (comment)
.


Reply to this email directly or view it on GitHub
#93 (comment).

@nzjrs
Copy link
Collaborator

nzjrs commented Dec 1, 2015

https://github.com/dddomodossola/remi/blob/master/remi/server.py#L729

On 1 December 2015 at 17:30, ttufts notifications@github.com wrote:

I understand that supporting it or modifying REMI to support it might be
out of scope. Can you tell me in the code where it is choosing the port? I
am willing to make a local modification to the code to specify a constant
port for websocket, if that's what needs to happen.

It seems simple enough to offer an optional constant port.

-Tom

On Tue, Dec 1, 2015 at 11:27 AM John Stowers notifications@github.com
wrote:

Supporting this use-case seems out of scope for REMI


Reply to this email directly or view it on GitHub
<#93 (comment)
.


Reply to this email directly or view it on GitHub
#93 (comment).

@rseward
Copy link

rseward commented Apr 7, 2016

I too have a problem with the random generated ports on AWS. My REMI App Server has a private IP address behind AWS security rules. When I connect to my REMI App Server using its host name and public IP (again NATted to its private IP address), I am able to see the UI however the UI is unresponsive and does not update. When I inspect the network activity I see that the AWS instances private IP address is sent to the REMI client (running in the browser) with a random web socket port.

Thinking that a SSH tunnel would resolve the issue, I created one for 8081. However as "ttufts" observes a random websocket port is also created and used to support the UI. If I start a browser session and then observe the browser activity, e.g. spy on the app and find the websocket port. I can open that second port up in my SSH tunnel and the UI works great over the Internet.

I see two problems here.

  1. REMI should allow a host name to be supplied to reach the server over the Internet. REM in remi stands for Remote does it not? Currently REMI automatically selects what it thinks is the public IP of the server. This does NOT work from an AWS Instance on a private network.
  2. REMI should allow the web socket ports to be specified in a given range of ports. E.g 57000-58000. This would allow firewall rules and/or SSH tunnel port forwarding rules to be written in a consistent manner to use the app.

Minor details to make REMI more deployable in a greater number of use cases. Great work so far on the project!

@dddomodossola
Copy link
Collaborator

Hello @rseward. This Issue should be already fixed but I forgot to update it. Here is already the possibility to specify the websocket port, and this will solve your problem.
You can specify the parameter websocket_port in the start call.

start(websocket_port=57000)

@nzjrs
Copy link
Collaborator

nzjrs commented Apr 9, 2016

You can also bind to the specific public ip by passing that to start()

@nzjrs
Copy link
Collaborator

nzjrs commented Apr 9, 2016

I'll close this now, but please copy your comment and reopen a new issue with a clearer description if the issue persists.

@nzjrs nzjrs closed this as completed Apr 9, 2016
@dddomodossola
Copy link
Collaborator

@rseward now you can specify also the host name in the start call, for example:

start(address='0.0.0.0', port=8081, websocket_port=57000, host_name='myhostname.net')

@nzjrs
Copy link
Collaborator

nzjrs commented Apr 12, 2016

IMO having both address and host_name doesn't make sense. The constructor
should accept one or the other, no?

On 12 April 2016 at 12:15, Davide notifications@github.com wrote:

@rseward https://github.com/rseward now you can specify also the host
name in the start call, for example:

start(address='0.0.0.0', port=8081, websocket_port=57000, host_name='myhostname.net')


You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub
#93 (comment)

@dddomodossola
Copy link
Collaborator

It is the case where a machine is behind a router. The address have to be the local network address. Instead the host_name have to be for example a dns name or a remote ip. You can't specify a the public remote ip as address.

@rseward
Copy link

rseward commented Apr 12, 2016

Yes. The host_name and websocket_port options work great for me.

E.g.

server.Server(MyApp, start=True, address='0.0.0.0', host_name='public.noplace.com', websocket_port=57000, port=8081, start_browser=False, update_interval=0.1, multiple_instance=True)

works exactly as I need it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants