A Jupyter Hub for Teaching (1)

๐Ÿ•“ Apr 30, 2020 ยท โ˜•4 min read
๐Ÿท๏ธ
  • #it
  • #teaching
  • A CoVid-19 story about an approach for teaching in quarantaine (1)

    The Base Line

    For this year’s summer teaching term I should conduct 2 different classes to teach basic programming. One in FH JOANNEUM’s engineering department, at my home institute IAP (Institute for Applied Production Sciences) one at IFI HS Bremen (International Womens’ IT Programme, University of Applied Sciences in Bremen/Germany).

    The former would be an introduction into programming using Python as the language of choice, the latter, being a part of the System Software Module, an introduction into the C programming language for students already quite fluent in Java.

    Both courses were planned to be classroom teaching in the respective on-premise IT labs. Until, in late March, it became evident that neiter in Germany nor in Austria classroom teaching would be possible due to quarantaine restrictions after the spread of the SARS-CoV-2 virus.

    Jupyter Hub to the Rescue

    After all, a different solution had to be sought after. Of course, it would have been easily feasible to have the students install the appropriate compiler or interpreter on their personal computers and feed them with programming tasks to be solved. But this approach seemed a little humble to me. Quite some time ago I had got in touch with Jupyter Notebooks, though I never really found a use case to dig any deeper into it. But teaching these courses online seemed like a perfect testbed, if something like a multi user Jupyter environment existed.

    Entry Jupyter Hub, obviously offering exactly what was needed for a centralized, multi user Jupyter Notebook environment for the students. A quick check concerning the programming languages (“Kernels” in Jupyter speak) supported revealed that (besides Python, being Jupyter’s native language) that there were Kernels for a lot of different languages, including C.

    A locally installed Jupyter Notebook was used for some preliminary tests, especially using different Kernels for C, Go and Rust - they all worked flawlessly.

    Installation and Setup

    Next step was to install the Jupyter Hub on a Virtual Private Server (VPS) inside the EU for basic GDPR complience. As I already operated a quite powerful VPS based in a German data center it was obvious to use it for this purpose. The Jupyter Hub should, as all other services, run in an LXC container preferably above a Devuan or Debian OS user space.

    First Approach: The Littlest JupyterHub

    Which Jupyter Hub to install? Given the very limited time for deployment The Littlest JupyterHub seemed to be a good choice, as it would install the whole hub server with little to no prerequisites, besides the OS, needed. Turned out the only OS supported was Ubuntu’s server version 18.04, so a quick lxc-create set up a container of that OS.

    Installation, following the manual (basically running a single installer script) went well and after a while I was able to log into my Jupyter Hub. During install a first (admin) user was created and that one should be able to administer the Hub (user management etc.). Unfortunately most of what I tried ended in error messages stating refused access to certain files and directories, without clear indications which files/directories were affected. Turned out it was the working directory under the user’s home directory. Fixing owner and access rights finally allowed creating and starting a first Jupyter Notebook.

    After that I tried to find a way for deploying additional language Kernels. The only technique officially supported was using Kubernetes, total overkill for my use case. Moreover, adding users via the web interface lead to the same access problems as with the initial user. Time for re-tinking the strategy.

    Second Approach: Manual Install

    After some searching on the Jupyter Hub website I finally found the Installation Manual and following this guide I finally had a working Jupyter Hub. Again due to time constraints I decided for the most simplistic user management, based on system users and PAM. Normally I would probably have rejected such a solution due to security concerns, but it seemed appropriate in that case, as an eventually compromised container could easily be removed and replaced. A small script added the student users and created random passwords.

    Next step was to install the C-Kernel. Again documentation was at best sparse. Lots of discussions in different places, usually ending without stringent solutions. Time started to run out, as the first lessons were due.

    Finally I tried sort of a brute force approach. I installed the C-Kernel into the Jupyter Lab instance on my laptop and copied the local kernel subdirectory ~/.local/share/jupyter/kernels/c/ to /opt/jupyterhub/share/jupyter/kernels/c/ on the server. Worked like a charm!

    First Experience

    At the time of writing all my Austrian students have been using the Hub server sucessfully. The learning curve concerning the Jupyter environment was flat, so they could easily focus on the actual (Python) programming tasks. Until now they really seem to like the environment. Right now I’m looking forward to the upcoming lessons with the German students, programming in C.

    To be continued…


    ใŸ - ta
    WRITTEN BY
    ใŸ - ta
    Audio Addict, Engineer & Hockey Coach