Can I auto-create users in hub, auto-install a notebook in user dir and auto login using a token?

It’s a long title but I tried to convey the tasks I’ve been asked to accomplish. I’ll try to explain in more detail:

For an online learning platform we need to:

  1. Dynamically create a new docker hub container representing an assignment (a specific notebook file given by an instructor) (currently implemented)
  1. Create the student accounts in the hub using the Hub API (currently implemented)

  2. Install the instructor-provided notebook file into each user directory (assuming can be done through docker mount volumes?)

  3. Request a login token through the hub REST API (currently implemented but I don’t think this approach is correct. The token appears to be an API token, even though the documentation says it’s not)

  4. Create a url (including token) to the assignment for each student and set an iframe src to that url (implemented but not working. https already in place)

Is this doable?

I’m having a really hard time understanding the lab/hub architecture and I’m probably not digging enough but there isn’t a lot of documentation.

Is our approach unrealistic and should we be thinking of tackling this in a different way?

I think it’s doable.

JupyterHub spawns a singleuser server (running e.g. JupyterLab). Once it’s spawned the singleuser server is pretty independent, so anything you want to do inside the server is more or less independent of JupyterHub. For example, if you wanted to download some files you could have a custom startup script, or you could use something like GitHub - jupyterhub/nbgitpuller: Jupyter server extension to sync a git repository one-way to a local path

For the automated login, it depends exactly what you’re trying to achieve. As an example overrides the default JupyterHub authentication and generates temporary tokens and users so a login isn’t required: binderhub/ at f45dc0b42a79fe9ed0470e3b8a3acce85471b510 · jupyterhub/binderhub · GitHub


We were able to build an LTI service that creates and manages a Jupyter Hub for every assignment in a Canvas page. Thanks!

Hopefully we will release the full source for this project. It might be useful to others.