JupyterServer URL suffix when tunnelling into KernelGateway app
airlangga-gunawan-faculty opened this issue · 2 comments
Hi, I am using sagemaker-ssh-helper to create an SSH connection in between the JupyterServer app and the KernelGateway app.
In my example, I am running code-server (https://coder.com/) in the KernelGateway environment as our data scientists want to control the instance size and type of machine it runs on.
Running the coder server
command in the KernelGateway env starts an HTTP listener at 127.0.0.1:3000. I then use the sagemaker-ssh-helper command sm-local-ssh-ide connect
with an additional argument -L localhost:3000:localhost:3000
in order to also forward the connection on port 3000 from the KernelGateway env.
When I navigate to https://domain.studio.eu-west-2.sagemaker.aws/jupyter/default/proxy/3000
, it initially loads the page (I see "Coder" in the browser tab) but then fails to load any UI elements. Looking at the developer console, this is happening because the UI resources are being fetched from https://domain.studio.eu-west-2.sagemaker.aws/some_UI_element.js
instead of https://domain.studio.eu-west-2.sagemaker.aws/jupyter/default/proxy/3000/some_UI_element.js
If I manually navigate to https://domain.studio.eu-west-2.sagemaker.aws/jupyter/default/proxy/3000/some_UI_element.js
, I can confirm that I am able to access the Javascript code.
Is there any configuration that I'm missing when running sm-local-ssh-ide connect
to pass the entire URL to the downstream server, including the URL suffix that is added?
Hi, @airlangga-gunawan-faculty , you've made a very good observation, which is already partially addressed in the README with a small remark about Dask:
note, that Dask web app may not work properly through Jupyter Proxy, so VNC is the recommended alternative
I believe that the cause of this issue is the Code Server web app that that wasn't designed to work through the Jupyter Proxy, same as the Dask web app. Its configuration expect that your webserver is always serving files from the root path /
. Some web apps that I've seen have this path configurable in their settings and it's best to consult developers of each app and ask them to make it configurable, if it's not possible yet.
I've also seen some attempts by @giuseppeporcelli and other colleagues to make it configurable for the code server in https://github.com/aws-samples/amazon-sagemaker-codeserver , but I'm not sure if it's stable enough (it's the code sample, too, that you should test by yourself).
If neither of above recommendations work, I recommend to switch to WebVNC or run a standalone local VS Code application and connect to the kernel gateway through SSH and remote development capability.
Alternatively, you may also want to connect to the KernelGateway app directly from your local machine, bypassing the need in JupyterServer app, this is how the code server will be available from your browser through port forwarding at http://localhost:3000/
Hi Ivan, thanks for the reply.
I've managed to get code-server
to run on the KernelGateway app now - turns out I was trying to get coder
to work and not code-server
.
However, I'm still struggling to get Dagster to run on the KernelGateway environment, but I now believe this to be an issue with Dagster and dagster-webserver more than it is a problem with Sagemaker and the ssh helper.
Thanks!