The Littlest JupyterHubのインストール

はじめに

JupyterHubは複数のユーザにJupyterを提供するために最適な環境です。
(要件によってはColaboratoryCloud AI Notebooksが良いと思います)

JupyterHubには二つのディストリビューションがあり、自前で構築する前にこれらを検討するべきです。
https://jupyterhub.readthedocs.io/en/stable/

ユーザが100人以下の場合、The Littlest JupyterHubが推奨されます。これは単一のマシンに構築することを想定しています。

https://tljh.jupyter.org/en/latest/

GCPにインストールする場合

基本的にはこちらのマニュアルに従えば問題ありません。
https://tljh.jupyter.org/en/latest/install/google.html

ただし、記載のものではスタートアップスクリプトが動作せず、下記のように書き換えが必要でした。

1
2
3
4
#!/bin/bash
curl https://raw.githubusercontent.com/jupyterhub/the-littlest-jupyterhub/master/bootstrap/bootstrap.py \
| sudo python3 - \
--admin <admin-user-name>

設定

設定はtljh-configコマンドを通じて行います。例えばパスワード認証に一定回数失敗した場合のアカウントロックを設定しましょう。

1
2
3
4
sudo tljh-config set auth.type nativeauthenticator.NativeAuthenticator
sudo tljh-config set auth.NativeAuthenticator.allowed_failed_logins 3
sudo tljh-config set auth.NativeAuthenticator.seconds_before_next_try 120
sudo tljh-config reload

最後にreloadすることで設定が反映されますが、接続中のユーザに影響はありません。

HTTPS化

こちらにLet's Encryptを用いた設定方法が記載されています。
https://tljh.jupyter.org/en/latest/howto/admin/https.html

記事情報

  • 投稿日:2020年7月3日
  • 最終更新日:2020年7月3日