Giter Site home page Giter Site logo

zcesur / embeddable-jhub-sample Goto Github PK

View Code? Open in Web Editor NEW
8.0 3.0 2.0 2 KB

Sample configuration for embedding JupyterHub in your website and serving ephemeral single-user notebooks on Kubernetes

HTML 15.32% JavaScript 19.44% Shell 39.88% Python 18.14% CSS 7.23%
kubernetes jupyterhub jupyterlab jupyter-notebook kubernetes-deployment iframe iframe-embeds

embeddable-jhub-sample's Introduction

Embeddable JupyterHub on Kubernetes

The default setup of both Jupyter Hub and single-user Jupyter Notebook/Lab server is configured to prohibit outside domains from embedding the page. As a workaround, we can include our domain(s), say http://localhost:8080, in the frame-ancestors directive:

# config.yaml

hub:
  extraConfig: |
    c.JupyterHub.tornado_settings = {'headers': {'Content-Security-Policy': "frame-ancestors 'self' http://localhost:8080"}}

Nevertheless, this much configuration is not sufficient as our visitors would still encounter the "Blocked by Content Security Policy" error after they are redirected to a notebook/lab page even though they can now use the hub homepage. Although this may not be the best solution, the workaround that I came up with was to re-build the Dockerfile of the single-user Jupyter notebook server with the same settings as above, and then use this image in the Helm configuration:

# singleuser/jupyter_notebook_config.py

c.NotebookApp.tornado_settings = {
    'headers': {
        'Content-Security-Policy':
        "frame-ancestors 'self' http://localhost:8080"
    }
}
# config.yaml

hub:
  extraConfig: |
    c.JupyterHub.spawner_class = 'kubespawner.KubeSpawner'
    c.KubeSpawner.singleuser_image_spec = 'zcesur/jupyter-singleuser'

References

embeddable-jhub-sample's People

Contributors

zcesur avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

embeddable-jhub-sample's Issues

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.