flagflag  
26: 2021-07-25 (Sun) 21:41:24 iseki source Cur: 2023-12-04 (Mon) 11:30:44 iseki source
Line 10: Line 10:
- see also: ''[[Jupyter]]'' - see also: ''[[Jupyter]]''
- see also: [[Docker]], [[Podman]] - see also: [[Docker]], [[Podman]]
-- see also: [[Kubernetes]]+- see also: [[Kubernetes]], [[PodmanSpawner]] 
 +- see also: [[configurable-http-proxy]]
- [[DockerSpawner>./DockerSpawner]] - [[DockerSpawner>./DockerSpawner]]
 +- [[LTIDockerSpawner>./LTIDockerSpawner]]
 +- [[LTIPodmanSpawner>./LTIPodmanSpawner]]
 +
 +- [[Moodle+JupyterHub]]
 +- [[開発>./devel]]
 +- [[API>./API]]
#br #br
** INSTALL [#nfb5f43c] ** INSTALL [#nfb5f43c]
 +*** Rocky Linux 8 [#g6e6c1d1]
 +- [[Detail Log>./RockyLinux8_install]]
 +#br
 +
 +*** pip [#ecfe7cfb]
 +#br
 +*** conda [#n0e2837f]
 +- conda update -c conda-forge jupyterhub -y
 +#br
 +
 +*** for CentOS 8.5 with pip [#l08667b3]
 + # yum install python3
 + # pip3 install --upgrade pip
 + # yum install npm
 + # npm install -g configurable-http-proxy
 + # pip install setuptools_rust
 + # pip install jupyterhub
 + # pip install dockerspawner
 + # pip install --upgrade notebook
 + # pip install --upgrade jupyterlab
 + # jupyterhub --version
 + # jupyter --version
 + # jupyter notebook --version
 + # jupyter lab --version
 +#br
 +
 +*** 2.0.0 with conda [#e269f8c5]
 +
 +**** Change Log [#qacdfa95]
 +- https://jupyterhub.readthedocs.io/en/sta​ble/changelog.html
 +#br
 +**** Install [#j385e508]
 + (base) # conda install -c conda-forge conda==4.11.0 -y
 + (base) # conda activate jupyterhub
 + (jupyterhub) # conda update -c conda-forge jupyterhub -y
 +
 + (jupyterhub) # jupyterhub --upgrade-db
 + (jupyterhub) # jupyterhub -f .....
 +#br
 +
 +**** podmanspawner.PodmanSpawner [#nefeece2]
 +- おおっ class のサンプルに Podman がある!
 +-- と思ったら niklas netter 氏の [[podmanspawner>https://github.com/gaton​iel/podmanspawner]] じゃん
 +#br
 +
 +**** websocket モジュールが無いとのことで起動しなくなった. [#x698e062]
 + ModuleNotFoundError: No module named 'websocket'
 +- conda 環境で websocket をインストール
 +
 + # conda install -c conda-forge websocket-client
 +
 +- pip なら pip install websockets 
 +#br
 +
 +**** データベースのスキーマが合わないとのことで,起動しなくなった. [#o77e88b0]
 +- jupyterhub upgrade-db してもだめなので,/var/lib/jupyterhub 以下を削除
 +#br
 +
 +*** 1.4.2 [#i2818e12]
 +
**** conda を使用 [#z4c989ab] **** conda を使用 [#z4c989ab]
 (base) # conda create -n jupyterhub python=3.8 -y  (base) # conda create -n jupyterhub python=3.8 -y
Line 24: Line 91:
 (jupyterhub) # conda install -c conda-forge voila -y  (jupyterhub) # conda install -c conda-forge voila -y
 (jupyterhub) # conda install jupyter_client -y  (jupyterhub) # conda install jupyter_client -y
 + 
 (jupyterhub) # git clone https://github.com/jupyterhub/nativeauth​enticator.git  (jupyterhub) # git clone https://github.com/jupyterhub/nativeauth​enticator.git
 (jupyterhub) # pip install -e nativeauthenticator  (認証モジュール:オプション)  (jupyterhub) # pip install -e nativeauthenticator  (認証モジュール:オプション)
Line 30: Line 97:
- ディレクトリのパーミッションの設定を忘れずに! - ディレクトリのパーミッションの設定を忘れずに!
 +#br
 +**** pip を使用する. [#d08d0c8f]
 +- nodejs: CentOS7 の場合は nodejs はバージョンが古くて,configurable-http-proxy でエラーが出るので,nodejs をバージョンアップする.
 + curl -sL https://rpm.nodesource.com/setup_14.x | bash -
 + yum remove nodejs npm -y
 + yum install nodejs -y
 + node -v
 +--  nodejs のバージョンがアップしない場合は,/var/tmp/yum-root-* を消す
 +-- https://rpm.nodesource.com/setup_##.x は非推奨となった.(2023/12/4)
 +--- see https://github.com/nodesource/distributi​ons
 +
 + npm install -g configurable-http-proxy
 + python3 -m pip install jupyterhub
 + python3 -m pip install dockerspawner
 + python3 -m pip install --upgrade notebook
 + python3 -m pip install --upgrade jupyterlab
#br #br
Line 43: Line 126:
- (jupyterhub) # jupyterhub --version - (jupyterhub) # jupyterhub --version
#br #br
 +
 +*** [[LTI Authenticator>LTI]] [#g284e3bf]
 +- Moodle と連携する為の 認証モジュール(Moodleの外部サービスを使用)
 +- 先に authlib を入れておく.
 +-- conda install oauthlib  or pip  install oauthlib
 +
 +- v1.2.0 release (2021 9/2)
 +-- https://pypi.org/project/jupyterhub-ltia​uthenticator/1.2.0/
 +-- Moodle に対して Patch 不要
 +
 + (jupyterhub)# pip install --upgrade jupyterhub-ltiauthenticator
** 設定 [#idb49705] ** 設定 [#idb49705]
Line 111: Line 205:
 136  136
-**** LTIモジュール [#m4467ad6] +**** [[LTI]] モジュール [#m4467ad6]
-***** Learning Tools Interoperability [#lde959fa] +
-- https://github.com/jupyterhub/ltiauthent​icator+
-- 既にインストールされている ltiauthenticator だと Moodle にログインできない. 
--- "Moodleと Jupyter Notebookの 連携 によるプログラミング 教育環境 の 構築" 石坂徹,桑田喜隆, et. al., Moodle Moot Japan 2019 Proceedings (2019), pp.32-37 
---- /usr/local/anaconda/envs/jupyterhub/lib/​python3.8/site-packages/ltiauthenticator​/__init__.py 
- 152            # Before we return lti_user_id, check to see if a canvas_custom_user_id was sent. 
- 153            # If so, this indicates two things: 
- 154            # 1. The request was sent from Canvas, not edX 
- 155            # 2. The request was sent from a Canvas course not running in anonymous mode 
- 156            # If this is the case we want to use the canvas ID to allow grade returns through the Canvas API 
- 157            # If Canvas is running in anonymous mode, we\'ll still want the \'user_id\' (which is the `lti_user_id``) 
- 158 
- 159            canvas_id = handler.get_body_argument(\'custom_canva​s_user_id\', default=None) 
- 160 +          product_code = handler.get_body_argument(\'tool_consume​r_info_product_family_code\', default=None) 
- 161 
- 162            if canvas_id is not None: 
- 163                user_id = handler.get_body_argument(\'custom_canva​s_user_id\') 
- 164 +          elif \'moodle\' in product_code: 
- 165 +                user_id = handler.get_body_argument(\'ext_user_use​rname\') 
- 166            else: 
- 167                user_id = handler.get_body_argument(\'user_id\') 
- 168 
- 
-***** jupyterhub_config.py [#c6db4f7a] 
- c.JupyterHub.authenticator_class = 'ltiauthenticator.LTIAuthenticator' 
- c.LTIAuthenticator.consumers = { 
-     os.environ['LTI_CLIENT_KEY']: os.environ['LTI_CLIENT_SECRET'] 
- } 
--- キーは二つとも openssl rand -hex 32 で生成. 
-#br 
-***** Moodle 側 [#sd9e4f7f] 
-- 「サイト管理」=> 「プラグイン」=> 「外部ツール:ツールを管理する」(=>「ツールを手動設定する」) 
-- [[Hack>Moodle/Moodle-LTI]] 
-#br 
- 
-***** error : module 'oauthlib.oauth1.rfc5849.signature' has no attribute 'signature_base_string' [#l6c7a130] 
-- ライブラリが足りない 
-- conda install oauthlib 
-#br 
- 
-***** 欠点:利点? [#w4038708] 
--- %%一度 Moodle 経由でログインすると,ブラウザがアカウントを覚えているらしく,次回からは Moodle 経由で無くともログイン可能.%% ログアウトすればOK 
--- その他の一般ユーザ認証と併用できない. 
#br #br
Line 218: Line 269:
- DockerSpawner を使用すると,作業ディレクトリが /home/jovyan/work 固定なのだが? - DockerSpawner を使用すると,作業ディレクトリが /home/jovyan/work 固定なのだが?
- c.DockerSpawner.notebook_dir 辺りをいじっても変化しない? - c.DockerSpawner.notebook_dir 辺りをいじっても変化しない?
-- 皆考えることは一緒:https://github.com/jupyter/docker-stacks/issu​es/358+- https://github.com/jupyter/docker-stacks/issu​es/358
#br #br
** 実行 [#a826d7f6] ** 実行 [#a826d7f6]
 +**** 前準備 [#xa875240]
 + # cd /etc/pki/tls
 + # openssl req -new -newkey rsa:2048 -days 3650 -nodes -keyout private/key.pem -out server.csr
 + # openssl x509 -in server.csr -days 3650 -req -signkey private/key.pem -out certs/server.pem
 + # vi  /usr/local/etc/jupyterhub/jupyterhub_con​fig.py
 + 
 + # mkdir /var/lib/jupyterhub
 +
 +**** 実行 [#k5a94b0c]
 (base) # conda activate jupyterhub  (base) # conda activate jupyterhub
 (jupyterhub) # jupyterhub -f /usr/local/etc/jupyterhub/jupyterhub_con​fig.py  (jupyterhub) # jupyterhub -f /usr/local/etc/jupyterhub/jupyterhub_con​fig.py
Line 268: Line 328:
- pool_recycle の設定を忘れずに! - pool_recycle の設定を忘れずに!
- charset は urf8mb4 - charset は urf8mb4
 +#br
 +** NVIDIA [#o78e60f8]
 +
 +*** Driver [#n52aa03b]
 +**** nouveau ドライバ(デフォルトのグラフィックドライバ)を止める [#j9e3e782]
 +- lsmod | grep nouveau  でドライバ確認
 +- /etc/default/grab のオプションに rd.driver.blacklist=nouveau を追加
 +- カーネル設定ファイルの作り直し
 +-- grub2-mkconfig -o /boot/grub2/grub.cfg  (RedHat系)
 +-- grub-mkconfig -o /boot/grub/grub.cfg  (Debian系)
 +#br
 +**** Driver [#r1aed2e1]
 +- nvidia-driver, cuda をインストール
 +#br
 +
 +**** Docker [#t87b07eb]
 +- nvidia-container-toolkit が必要
 +-- コンテナ内からホストのGPUを使う
 +-- %%nvidia-smi などのコマンドがインストールされる.%%
 +#br
 +
 +*** Tool Kit [#z51a5c81]
 +- CUDA Toolkit : https://developer.nvidia.com/cuda-toolki​t-archive
 +- Tool Kit をインストールするとドライバもインストールされる? (未確認)
 +#br
 +
 +*** Docker [#xa8f93e3]
 +- docker run --gpus all nvidia/cuda:12.2.0-devel-ubuntu20.04 nvidia-smi
 +-- Failed to initialize NVML: Unknown Error
 +-- ホストの /etc/nvidia-container-runtime/config.tom​l を編集して,no-cgroups = false にする.
#br #br
** Trouble Shooting [#rf83821d] ** Trouble Shooting [#rf83821d]
 +*** ltiauthenticator [#s373921d]
 +- https://pypi.org/project/jupyterhub-ltia​uthenticator/
 +#br
 +**** Jupyterhub 4.0.0 [#b81f6caf]
 +- 403 : Forbidden  '_xsrf' argument missing from POST  のエラー
 +-- JupyterHub で XSRFのチェックを強化したらしい
 +
 +- /usr/local/lib/python3.9/site-packages/j​upyterhub/handlers/base.py
 +-- def check_xsrf_cookie(self)
 +--- super().check_xsrf_cookie() で例外発生
 +--- 親は tornado のRequestHandlerか?
 +- 2023 5/29 時点でこのバグは修正されている.
 +#br
 +
 +*** JupyterLab [#m9f4d2fd]
 +**** JupyterHub をバージョンアップしたら Jupyter Labが起動しなくなった. [#f644f8af]
 +- 起動する JupyterHub(ex. 2.0.1)とイメージ内のJupyterHub(ex. 1.4.1)が違うとデフォルトで Jupyter Labが起動しなくなるようだ.
 +#br
*** 日本語のBUG [#ece06e7b] *** 日本語のBUG [#ece06e7b]
Line 294: Line 402:
*** homeディレクトの名前を変えたら,ログインできなくなった [#yf5e6b43] *** homeディレクトの名前を変えたら,ログインできなくなった [#yf5e6b43]
- ~/.cache, ~/.jupyter, ~/.local ができているので消す. - ~/.cache, ~/.jupyter, ~/.local ができているので消す.
 +#br
 +*** Programing [#uef8ed38]
 +**** docker [#g330446b]
 +- https://docker-py.readthedocs.io/en/stab​le/api.html
 +#br
 +- APIClient 呼び出しメソッド順
 +-- inspect_image
 +-- inspect_container
 +-- inspect_image
 +-- start
 +-- port
 +#br
 +
 +**** podman [#u96870cc]
#br #br


Front page   New List of Pages Search Recent changes   Help   RSS of recent changes (RSS 1.0) RSS of recent changes (RSS 2.0) RSS of recent changes (RSS Atom)

Site Search

Login

Username:

Password:


Lost Password?
Register now!!

Sub Menu

mini Calendar

Last MonthMay 2024Next Month
Su Mo Tu We Th Fr Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Today

Who's Online

31 user(s) are online (4 user(s) are browsing xpwiki)

Members: 0
Guests: 31

more...

Access Counter

Today : 341341341
Yesterday : 5790579057905790
Total : 2365313723653137236531372365313723653137236531372365313723653137
Powered by XOOPS Cube 2.1© 2001-2006 XOOPS Cube Project
Design by XoopsDesign.com