http://wiki.itbs.selfhost.co/doku.php?id=offen:jhub
offizielle Doku: https://jupyterhub.readthedocs.io/en/4.0.2/
Installations PresentationsPDF + Youtube https://github.com/minrk/jupyterhub-pydata-2016
This launches a Tornado-based Jupyter Server.
jupyter server
jupyter server list
Currently running servers:
http://localhost:8888/ :: /home/intrepid-ibex
http://localhost:8889/ :: /home/intrepid-ibex/bhCode/dockerJupyterServer
https://jupyter-notebook.readthedocs.io/en/latest/migrate_to_notebook7.html
Anleitung mit eigenem Dockerfile https://youtube.com/watch?v=hoz7uhgEHcI&feature=shared
git clone https://github.com/itbsStefan/ibexCode.git gitOnline
docker build .
(base) intrepid-ibex@intrepid-ibex:~/bhCode/dockerJupyterServer$ docker build . [+] Building 1.0s (14/14) FINISHED docker:default => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 1.23kB 0.0s => [internal] load metadata for docker.io/jupyterhub/jupyterhub:latest 0.4s => [1/9] FROM docker.io/jupyterhub/jupyterhub:latest@sha256:f82a4efb57e3549afc2cac46c013e11e2204ea63770d2c0d23dae08eee3a1337 0.0s => [internal] load build context 0.0s => => transferring context: 38.99kB 0.0s => CACHED [2/9] RUN pip install --no-cache oauthenticator dockerspawner jupyterhub-nativeauthenticator 0.0s => CACHED [3/9] WORKDIR /home/jovyan/work 0.0s => CACHED [4/9] COPY README.md ./README.md 0.0s => CACHED [5/9] RUN mkdir -p /home/jovyan/work/readonly 0.0s => CACHED [6/9] RUN mkdir -p /home/jovyan/builfiles/ibexCode 0.0s => CACHED [7/9] RUN cd /home/jovyan/builfiles/ibexCode 0.0s => [8/9] ADD gitOnline . 0.0s => [9/9] RUN cd ~ 0.2s => exporting to image 0.2s => => exporting layers 0.2s => => writing image sha256:c876ec845d0c89c8a95122fcae01e1efd2b30be4947fe5f5b14a5448dc054e57 0.0s
Nun noch folgenden Befehl ausführen um JupyterHub-Server zu starten.
docker compose up -d --build
Öffne `http://localhost:8000` in deinem Browser und melde dich an (oder registriere ein neuen Benutzernamen)
Es gibt verschiedene Methoden um ein JupyterHub Server zum laufen zu bekommen folgend die Notizen des ersten Versuchs.
Auf dem Laptop 💻
Docker version 24.0.7, build afdd53b
https://tljh.jupyter.org/en/latest/contributing/dev-setup.html
hostibex:~/bhCode/the-littlest-jupyterhub$ docker build -t tljh-systemd . -f integration-tests/Dockerfile
(base) intrepid-ibex@intrepid-ibex:~/bhCode/the-littlest-jupyterhub$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE tljh-systemd latest 4fb657f73884 11 seconds ago 275MB
80.147.0.159 alternativ 185.89.38.58
Zur Server Subdomain würde als erstes die IP 80.147.0.159 mit hub.bergemann-hoehne.com gut passen. Falls noch eine zweite Subdomain möglich ist sozusagen als Meisterstückadresse wäre ibex.spielwiese.bergemann-hoehne.com super wobei spielwiese auch durch beliebige Domainnamensyntax variabel sein kann. Diese zweite geht auf die IP 185.89.38.58
https://tljh.jupyter.org/en/latest/howto/auth/github.html
https://github.com/settings/applications/new
https://docs.github.com/de/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps
benötigt:
Client ID 5fd0150ba241c0c8fde1 Client secrets f889d2ef26ca21b758db34ae868ecb9a6ddc9b6c Added Jan 8, 2024 by itbsStefan Never used You cannot delete the only client secret. Generate a new client secret first.
bearbeite die Konfiguration:
sudo tljh-config set auth.GitHubOAuthenticator.client_secret '<my-tljh-client-secret>' sudo tljh-config set auth.GitHubOAuthenticator.oauth_callback_url 'http(s)://<my-tljh-ip-address>/hub/oauth_callback' sudo tljh-config set auth.type oauthenticator.github.GitHubOAuthenticator sudo tljh-config reload
the FirstUseAuthenticator is enabled by default in TLJH.
sudo tljh-config set auth.type firstuseauthenticator.FirstUseAuthenticator sudo tljh-config reload
Users who are currently logged in will continue to be logged in. When they log out and try to log back in, they will be asked to provide a username and password. Users changing their own password
Users can change their password by first logging into their account and then visiting the url <your_server_ip>/hub/auth/change-password.
Allowing anyone to log in to your JupyterHub
By default, you need to manually create user accounts before they will be able to log in to your JupyterHub. If you wish to allow any user to access the JupyterHub, run the following command.
tljh-config set auth.FirstUseAuthenticator.create_users true tljh-config reload
$ docker network create –subnet=255.255.255.0/24 synologynet
intrepid-ibex@intrepid-ibex:~$ cat /etc/issue.net
Ubuntu 22.04.3 LTS
$ git --version
git version 2.34.1
$ python3 --version
Python 3.10.12
$ node --version
v21.1.0
$ npm --version
10.2.0
$ nvm --version
0.39.1
Es wird zur Installation auch Root-Zugriff benötigt. (mit su
) conda in /opt installieren
jupyterhub
$ sudo chown intrepid-ibex:users /srv/ $ ls -la /srv/ insgesamt 8 drwxr-xr-x 2 intrepid-ibex users 4096 Aug 8 00:52 . drwxr-xr-x 20 root root 4096 Okt 26 22:12 ..
$ sudo usermod -aG users intrepid-ibex $ sudo usermod -aG www-data intrepid-ibex $ git clone https://github.com/minrk/jupyterhub-pydata-2016 /srv/jupyterhub
$ cd /srv/jupyterhub srv/jupyterhub$ ls -la insgesamt 156 drwxrwxr-x 5 intrepid-ibex intrepid-ibex 4096 Nov 16 13:20 . drwxr-xr-x 3 intrepid-ibex users 4096 Nov 16 13:20 .. -rw-rw-r-- 1 intrepid-ibex intrepid-ibex 8374 Nov 16 13:20 authenticators.ipynb -rw-rw-r-- 1 intrepid-ibex intrepid-ibex 215 Nov 16 13:20 env -rw-rw-r-- 1 intrepid-ibex intrepid-ibex 215 Nov 16 13:20 environment.yml drwxrwxr-x 8 intrepid-ibex intrepid-ibex 4096 Nov 16 13:20 .git -rw-rw-r-- 1 intrepid-ibex intrepid-ibex 84 Nov 16 13:20 .gitattributes -rw-rw-r-- 1 intrepid-ibex intrepid-ibex 43 Nov 16 13:20 .gitignore drwxrwxr-x 2 intrepid-ibex intrepid-ibex 4096 Nov 16 13:20 img -rw-rw-r-- 1 intrepid-ibex intrepid-ibex 895 Nov 16 13:20 jupyterhub_config.py-docker -rw-rw-r-- 1 intrepid-ibex intrepid-ibex 590 Nov 16 13:20 jupyterhub_config.py-localgithub -rw-rw-r-- 1 intrepid-ibex intrepid-ibex 233 Nov 16 13:20 jupyterhub_config.py-ssl -rw-rw-r-- 1 intrepid-ibex intrepid-ibex 132 Nov 16 13:20 JupyterHub.key -rw-rw-r-- 1 intrepid-ibex intrepid-ibex 131 Nov 16 13:20 JupyterHub.pdf -rw-rw-r-- 1 intrepid-ibex intrepid-ibex 590 Nov 16 13:20 README.md -rw-rw-r-- 1 intrepid-ibex intrepid-ibex 5372 Nov 16 13:20 rest-api.ipynb -rw-rw-r-- 1 intrepid-ibex intrepid-ibex 70164 Nov 16 13:20 spawners.ipynb drwxrwxr-x 2 intrepid-ibex intrepid-ibex 4096 Nov 16 13:20 supervisor -rw-rw-r-- 1 intrepid-ibex intrepid-ibex 2053 Nov 16 13:20 timeline.md
https://learnubuntu.com/install-conda/
https://docs.conda.io/en/latest/miniconda.html?ref=learnubuntu.com#linux-installers
$ chmod -v +x ~/Downloads/Miniconda*.sh $ /Downloads/Miniconda3-py310_23.9.0-0-Linux-x86_64.sh ... installation finished. Do you wish to update your shell profile to automatically initialize conda? This will activate conda on startup and change the command prompt when activated. If you'd prefer that conda's base environment not be activated on startup, run the following command when conda is activated: conda config --set auto_activate_base false You can undo this by running `conda init --reverse $SHELL`? [yes|no] [no] >>> You have chosen to not have conda modify your shell scripts at all. To activate conda's base environment in your current shell session: eval "$(/home/intrepid-ibex/miniconda3/bin/conda shell.YOUR_SHELL_NAME hook)" To install conda's shell functions for easier access, first activate, then: conda init Thank you for installing Miniconda3! intrepid-ibex@intrepid-ibex:~/Downloads$
intrepid-ibex@intrepid-ibex:/srv/jupyterhub$ pip --version
pip 23.2.1 from /home/intrepid-ibex/miniconda3/lib/python3.10/site-packages/pip (python 3.10)
(base) intrepid-ibex@intrepid-ibex:~$ conda --version
conda 23.9.0 (update $ conda update -n base -c defaults conda install conda=23.10.0)
$ conda install -c conda-forge jupyterhub $ conda install notebook
$ cd /srv/jupyterhub/ $ conda env create -f environment.yml
(base) intrepid-ibex@intrepid-ibex:/srv/jupyterhub$ jupyterhub –version 3.1.1
$ openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout ssltest.key -out ssltest.crt
...............................................++++++++++++++ ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [AU]:DE State or Province Name (full name) [Some-State]:Berlin Locality Name (eg, city) []:Berlin Organization Name (eg, company) [Internet Widgits Pty Ltd]:localAkademie Organizational Unit Name (eg, section) []:B&H Common Name (e.g. server FQDN or YOUR name) []:spielwiese.itbs.selfhost.me Email Address []:ibex@quantentunnel.de
trusted ssl certificate ist notwendig 1) Nur mit einer echten Domain kann man Let'sEncryt verwenden.
https://letsencrypt.org/de/getting-started/
(base) intrepid-ibex@intrepid-ibex:~/bhCode/certbotletsencrypt$ ./letsencrypt-auto-source/letsencrypt-auto certonly –standalone -d itbs.selfhost.co Requesting to rerun ./letsencrypt-auto-source/letsencrypt-auto with root privileges… [sudo] Passwort für intrepid-ibex: Skipping bootstrap because certbot-auto is deprecated on this system. Your system is not supported by certbot-auto anymore. Certbot cannot be installed. Please visit https://certbot.eff.org/ to check for other alternatives.
ibex:/srv/jupyterhub$ jupyterhub --generate-config $ nano jupyterhub_config.py
$ sudo apt install certbot $ certbot --version
certbot 1.21.0