ipywidgets_server icon indicating copy to clipboard operation
ipywidgets_server copied to clipboard

Guide to server configuration would be very helpful

Open mwcraig opened this issue 7 years ago • 5 comments

Instructions for configuring a server to use ipywidgets_server would be great. Happy to help by at least trying the instructions out!

mwcraig avatar May 22 '18 21:05 mwcraig

Thanks for raising this.

To clarify, your ultimate goal is to provision a cloud (or on-premise) server such that it serves a dashboard and have people access the dashboard by typing https://some-domain-name.com in their browser?

The simplest would be to:

  1. Install a Python distribution like miniconda.

  2. Create a new Python3 virtual environment and install ipywidgets_server and any other dependencies using pip. You don't need to run the jupyter nbextension enable ... command.

  3. Get the dashboard code you want to run onto the server somehow (either through git clone or by scp-ing it onto the server).

  4. Start ipywigets_server as you would on your laptop by running a shell command in, e.g. a tmux session. For more robustness, we could use a systemd unit or equivalent.

  5. Install nginx and have it proxy port 80 to port 8866.

Other steps that might be useful would be installing SSL certificates using, e.g. let's encrypt.

Obviously, there's scope for other deployment options. I could, for instance, provide a Docker image for ipywidgets_server.

Is this what you're after? If so, I can expand on those steps to give more detail.

pbugnion avatar May 26 '18 06:05 pbugnion

That would get us part of the way there. We are going to have several interactives (roughly 10), that we would ideally serve up from the same virtual machine.

Ideally one would get to them by doing ourdomain.edu/interactive1, ourdomain.edu/interactive2 etc. rather than interactive1.ourdomain.edu, interactive2.ourdomain.edu, etc.

If it is easier we could start with the host-one-interactive case.

I suppose one workaround is to put redirects at the ends points we want to a set of domain names.

mwcraig avatar May 29 '18 15:05 mwcraig

Ah very interesting -- I think it makes sense to concentrate on the single-interactive case for the documentation.

For serving multiple dashboards at different paths, you could have a single nginx proxy that receives all traffic and routes it to different upstreams. This should 'easy' if each upstream corresponds to a different subdomain (ie, if you can tell the proxy to route interactive1.ourdomain.edu to localhost:8866), but might be much harder if you're definitely set on routing based on the initial fragment of the path (ie routing ourdomain.edu/interactive1 to localhost:8866).

pbugnion avatar May 30 '18 06:05 pbugnion

Let's start with the single-interactive case then.

mwcraig avatar May 30 '18 15:05 mwcraig

The steps above are not enough:

[WidgetsServer] WARNING | Blocking request with non-local 'Host' X.X.X.X (X.X.X.X). If the notebook should be accessible at that name, set NotebookApp.allow_remote_access to disable the check.
[WidgetsServer] WARNING | Forbidden

astrojuanlu avatar Nov 22 '18 11:11 astrojuanlu