Git Product home page Git Product logo

Comments (12)

BrandonEscamilla avatar BrandonEscamilla commented on May 29, 2024 2

The future of Datalayer looks incredibly promising. Although it may not be available just yet, I am looking forward to try these new solutions. Thank you, @echarles, for your time! I will be closely following any updates from your team.

from jupyter-ui.

echarles avatar echarles commented on May 29, 2024

Thx for the kind words @BrandonEscamilla, much appreciated!

I have quickly created https://jupyter-ui.datalayer.tech/docs/deployments/jupyter-server/ that describes the jupyter-server configuration you could use. Looking forward your feedbacks.

from jupyter-ui.

BrandonEscamilla avatar BrandonEscamilla commented on May 29, 2024

Hey @echarles, thank you so much for the fast response! I've been trying with a similar configuration that I took from .devcontainer. Right now, I am encountering an issue where the Next.js example successfully connects and creates the kernel. I can confirm that the kernel is created in the Jupyter Lab UI and in the logs. However, the jupyter cell in Next.js never starts, it's stucked in loading state. I noticed some error logs on the Next.js side, but I'm not sure if they are related. I have attached all the evidence. Thank you in advance!

CleanShot 2023-08-04 at 15 03 43

CleanShot 2023-08-04 at 15 03 04

CleanShot 2023-08-04 at 15 04 16

from jupyter-ui.

echarles avatar echarles commented on May 29, 2024

Does it works well on your en with the Datalayer server (the oss.datalayer.tech)? (just to ensure you have a baseline)

On my laptop, I have changed the context in examples/next-js/src/app/pages.tsx, started in a second terminal a server ./dev/sh/start-jupyter-server.sh, launched in a first terminal yarn jupyter:ui:next-js and it works fine.

      <Jupyter
        jupyterServerHttpUrl="http://localhost:8686/api/jupyter"
        jupyterServerWsUrl="ws://localhost:8686/api/jupyter"
        jupyterToken="60c1661cc408f978c309d04157af55c9588ff9557c9380e4fb50785750703da6"
      >

Can you share you complete jupyter_server_config.py ? (obfuscate any confidential information, if any)

PS : I also have lumino complaining about the navigator is not defined, but it does seem to impact the good working.

from jupyter-ui.

echarles avatar echarles commented on May 29, 2024

PS2: I see you the server log you shared a "Malfromed HTTP ...." - It is shown in green, but this sounds very strange (I have never seen that), It says to me something is wrong at that point. Maybe start the server with --debug flag to see more.

from jupyter-ui.

BrandonEscamilla avatar BrandonEscamilla commented on May 29, 2024

I have a Jupyter Lab server (installed using pip from https://jupyterlab.readthedocs.io/en/latest/) running on an AWS EC2 instance (Ubuntu). I'm testing out an example of Next.js from my local PC, it's just a new next.js app with the react component of jupyter-ui, and it is working fine with the datalayer server, but when I try using my own server, it's not working. One issue could be that I haven't set up HTTPS yet, so I'm still using plain HTTP on port 8888 but with a domain already so it's like http://jupyter.mycompany.com:8888/api/jupyter.

By the way, I've included the output of running it with the --debug option and also my current configuration of jupyter_server_config.py.

Let me know if you need more information or have any suggestions. Thanks in advance!

# Configuration file for lab.
import os 
c = get_config()  #noqa

#################
# Authentication
#################

c.ServerApp.token = '60c1661cc408f978c309d04157af55c9588ff9557c9380e4fb50785750703da6'

#################
# Security
#################

c.ServerApp.disable_check_xsrf = False
ORIGIN = 'http://localhost:3000'
c.ServerApp.allow_origin = ORIGIN # Best to restrict the ORIGIN
c.ServerApp.allow_origin_pat = '.*'
c.ServerApp.allow_credentials = True
c.ServerApp.tornado_settings = {
  'headers': {
    'Access-Control-Allow-Origin': ORIGIN,  # Best to restrict the ORIGIN
    'Access-Control-Allow-Methods': '*',
    'Access-Control-Allow-Headers': 'Accept, Accept-Encoding, Accept-Language, Authorization, Cache-Control, Connection, Content-Type, Host, Origin, Pragma, Referer, sec-ch-ua, sec-ch-ua-mobile, sec-ch-ua-platform, Sec-Fetch-Dest, Sec-Fetch-Mode, Sec-Fetch-Site, Upgrade, User-Agent, X-XSRFToken, X-Datalayer, Expires',
    'Access-Control-Allow-Credentials': 'true',
    'Content-Security-Policy': f"frame-ancestors 'self' {ORIGIN} ",
  },
  'cookie_options': {
    'SameSite': 'None',
    'Secure': True
  }
}
c.ServerApp.cookie_options = {
  "SameSite": "None",
  "Secure": True,
}


#################
# Content
#################

# c.FileContentsManager.delete_to_trash = False
content_dir = os.path.dirname(os.path.realpath(__file__)) + '/notebooks'
c.ServerApp.root_dir = content_dir
c.ServerApp.preferred_dir = content_dir

#################
# URLs
#################

c.ServerApp.base_url = '/api/jupyter'
c.ServerApp.default_url = '/api/jupyter/lab'

#################
# Kernel
#################

# See
# https://github.com/jupyterlab/jupyterlab/pull/11841
# https://github.com/jupyter-server/jupyter_server/pull/657
c.ServerApp.kernel_ws_protocol = None # None or ''

#################
# JupyterLab
#################

c.LabApp.collaborative = False

CleanShot 2023-08-04 at 15 40 04

from jupyter-ui.

echarles avatar echarles commented on May 29, 2024

Is you EC2 instance behind a load balancer? If yes, this maybe the cause where WebSocket connections with CORS are not going through.

Before digging on that, could you try to launch the local separated juptyer-sever on your machine (you need to pip install jupyterlab) and connect your Next.js app to that local server? (with the config and commands I shared in my previous comment).

Also, can you go to your devtools and paste any error you see when you connect to the EC2 instance?

from jupyter-ui.

BrandonEscamilla avatar BrandonEscamilla commented on May 29, 2024

No, the EC2 instance is not behind a load balancer. I installed JupyterLab locally using pip install jupyterlab and launched the server using the command jupyter server --ip=0.0.0.0 --no-browser --debug. However, it's still not working. When I checked the browser console, I noticed the issue shown in the image below. I followed the configuration instructions provided in the Jupyter-UI documentation, but I also uncomment the origin line and include the following urls:

ORIGIN = 'http://localhost:3000'
c.ServerApp.base_url = '/api/jupyter'
c.ServerApp.default_url = '/api/jupyter/lab'

CleanShot 2023-08-04 at 17 33 36

from jupyter-ui.

echarles avatar echarles commented on May 29, 2024

Is your localhost server running in SSL? I see wss://...- If no SSL, it should be ws://...(no double s)

from jupyter-ui.

BrandonEscamilla avatar BrandonEscamilla commented on May 29, 2024

Hey @echarles , I found the issue, my bad. I realized that I had mistakenly used "wss" instead of "ws" in the websocket url. Since I'm not using secure websockets, using "ws" instead solved the problem. It's finally working, thank you for the help!

By the way, I have a couple of questions. If you have time to answer, I would really appreciate it. Can JupyterLab be used to support multiple users simultaneously? In JupyterLab, does each user have a separate kernel? Do I need to use JupyterHub to support multiple users at the same time? And if so, is the setup process the same? Thanks!

from jupyter-ui.

echarles avatar echarles commented on May 29, 2024

It's finally working, thank you for the help!

Great!

Can JupyterLab be used to support multiple users simultaneously?

You typically use JupyterHub for that.

In JupyterLab, does each user have a separate kernel?

The short answer is yes if you use JupyterHub.

Do I need to use JupyterHub to support multiple users at the same time? And if so, is the setup process the same? Thanks!

The default community answer to that is yes, but we are willing to change that. We are working on a bunch of repos in private to make jupyter and all the kernel experience, including RTC, more cloud-native...

https://datalayer.tech/docs/datalayer/services/jupyter-kernels/
https://datalayer.tech/docs/datalayer/operations/jupyter-operator/

and more manageable

https://github.com/datalayer/jupyter-manager

from jupyter-ui.

echarles avatar echarles commented on May 29, 2024

Closing as resolved. Please open a new issue for anything.

from jupyter-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.