Comments (10)
Hi there! Where exactly are you running the jhsingle_native_proxy command? If it is within a JupyterLab server session then that won't help. It needs to be run by JupyterHub instead of a JupyterLab server. To do that you would need to change the c.Spawner.cmd
configuration from jupyterhub-singleuser
(which is essentially jupyterlab) to jhsingle-native-proxy
or similar. And you would also need to set c.Spawner.args
appropriately.
However, unless there is a way to change this dynamically, you will be replacing jupyterlab with the single WebApp.py in place of everyone's JupyterLab session, so JupyterLab would never be available any more. That's what cdsdashboards is designed to do - give a UI and controls so some servers are jupyterlab and others are specific webapps (dashboards) as defined within JupyterHub by users.
I hope this explains it all a bit more. Maybe more config and explaining where you are running things might help me understand if/where you're getting confused.
from jhsingle-native-proxy.
@danlester Thanks so much for the overview. Our TLJH is running in a Docker container right now, and we've attempted to edit the startup behavior by including a /opt/tljh/config/jupyterhub_config.d/spawner.py
script. This is where we can't seem to get the expected behavior. Inside, we've tried variations of:
c.Spawner.cmd = 'jhsingle-native-proxy'
c.Spawner.args = ['--destport 12000 voila ./WebApp.ipynb {--}port={port} {--}no-browser {--}Voila.server_url=/ {--}Voila.base_url={base_url}/ {--}debug']
But get 404's or 500's in response. Any advice would be appreciated!
from jhsingle-native-proxy.
Maybe this isn't representative of everything you've tried anyway, but where did you get port 12000 from? It would make sense to leave jhsingle-native-proxy to choose this internal port for itself to avoid clashes (--destport 0
).
I'm not 100% sure but I think you need to pass an array of strings to args
. From cdsdashboards which implements a spawner for Voila, these are the arguments I use there:
'args': ['--destport=0', 'python3', '{-}m','voila', '{presentation_path}',
'{--}port={port}',
'{--}no-browser',
'{--}Voila.base_url={base_url}/',
'{--}Voila.server_url=/',
'{--}Voila.ip=0.0.0.0',
'{--}Voila.tornado_settings', 'allow_origin={origin_host}',
'--progressive',
'--ready-check-path=/voila/static/'
]
You might also add the debug arg to jhsingle-native-proxy itself:
c.Spawner.cmd = ['jhsingle-native-proxy', '--debug']
but that's not very helpful if you can't see the logs anywhere anyway!
If this doesn't help, I think finding a way to get logs is the next step.
from jhsingle-native-proxy.
When we run the above (or something) similar, the jupyter hub is unable to spawn a server:
The Docker TLJH sets up the Juptyer hub to be accessed at localhost:12000
, so we were trying to force the endpoint to be consistent, given that the address shown in the screenshot is wrong.
Also, the python script containing the spawner args did not like the {--}
syntax, so we instead went with a bash script containing
python3 -m jhsingle_native_proxy.main --destport 0 voila $presentation_path {--}port={port} {--}no-browser {--}Voila.server_url=/ {--}Voila.base_url={base_url}/ {--}debug {--}Voila.ip=0.0.0.0 {--}Voila.tornado_settings allow_origin={origin_host} --progressive --ready-check-path=/voila/static/
with c.Spawner.cmd = '/usr/local/bin/voila-wrapper'
.
Unfortunately, it results in the screenshot above.
from jhsingle-native-proxy.
In the example in your screenshot, you can see that JupyterHub has allocated the port 36059 for this particular server. It will generate one for each JupyterLab server that is started. There has to be a way for that to be passed into your script so that jhsingle-native-proxy can be serving on that port and then JupyterHub will be able to reach it.
So in that example, you need to end up with jhsingle-native-proxy --port 36059 ...
somehow. Further to that, jhsingle-native-proxy itself will run your voila process on yet another (different) port, but that doesn't matter as long as you don't attempt to conflict with an already-used port (such as 1200 which is almost certainly already in use by JupyterHub). So the default of --destport 0
is fine (pick a random unused port) - as long as jhsingle-native-proxy can pass on {port}
to voila in the command-line when it starts Voila.
Your voila-wrapper script must find a way to interpret the --port
parameter that JupyterHub will pass to it, and probably just pass it on to jhsingle-native-proxy. As it stands, your wrapper script does not pass any --port
to jhsingle-native-proxy. It only passes voila $presentation_path {--}port={port}
which is another layer down - i.e. jhsingle-native-proxy's destport
is passed to voila - that bit's all fine.
from jhsingle-native-proxy.
Okay, thanks for the insight. I've successfully been able to pass down the jupyter server port to --port
, however, now the hub hangs at "Server ready at /user/admin":
This is using jhsingle-native-proxy --destport 0 --port $port voila /home/jupyter-admin/Presentation.ipynb {--}port={port} {--}no-browser {--}Voila.base_url={base_url}/ {--}debug {--}Voila.server_url=/
If I include {--}Voila.tornado_settings allow_origin={original_host}
, I get a 500 response.
from jhsingle-native-proxy.
Getting the 500 response is actually pretty good progress! It probably means something is going wrong within the Voila app, e.g. it can't import a Python module. Maybe find a way to take a look at logs there.
from jhsingle-native-proxy.
Hmm, unfortunately it doesn't seem to be an issue with the installed packages. I can run the notebook fine by itself, and can create a voila render if I click the "Voila" button on the notebook page.
But no matter what, I can't seem to get it to work with the jusingle-native-proxy. I had done a fresh re-install of TLJH, and even with {--}Voila.tornado_settings allow_origin={original_host}
, the hub just hangs after starting the server (see previous screenshot).
I can, however, get the voila app to render just calling voila directly in the c.Spawner.cmd
, but as I understand, this method still requires the use of Jupyter notebook, and can't interface with the authentication.
from jhsingle-native-proxy.
I seem to have solved the issue. It wasn't until I added {--}VoilaConfiguration.http_keep_alive_timeout=30 {--}VoilaExecutor.iopub_timeout=100
that the webapp finally loaded.
Thanks for all your help.
from jhsingle-native-proxy.
Great to hear you made progress - thanks for letting us know the details.
from jhsingle-native-proxy.
Related Issues (18)
- Depending on jupyter-server-proxy HOT 4
- Is --template is supported? HOT 7
- Integrating JupyterHub with Voila's progressive rendering HOT 8
- Make readiness timeout configurable HOT 9
- Websocket max_message_size is too low HOT 5
- Error: No such option: --SingleUserNotebookApp.default_url HOT 5
- jhsingle-native-proxy not showing running notebook while using voila until notebook finish its execution HOT 3
- [Feature Request] Binder Button HOT 2
- Getting 404 error while launching Streamlit dashboard HOT 3
- simpervisor update breaks jhsingle-native-proxy HOT 1
- idea : support for UNIX sockets HOT 1
- Jhsingle-native-proxy 0.8.1 logger not outputting log messages to the console HOT 1
- Intermittent 500 Internal Server Error due to Premature Child Process Termination in `ensure_process`
- timeouts HOT 2
- await None HOT 3
- Exposing some logs from the process being proxied HOT 2
- py39 compat HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jhsingle-native-proxy.