LoginSignup
0
0

Azure App Service で JupyterLab をユーザーごとに用意してみた

Last updated at Posted at 2024-04-05

例えば、新入社員研修などで JupyterLab を用意したいとします。Azure App Service プランの B1 は 8 アプリをのせる事ができます。アプリごとに利用者を割り当てるという使い方を想定して、JupyterLab を動かす検証をしてみました。

App Service プランの B1 を作成

bash
prefix=mnrlab
region=japaneast

az group create \
  --name ${prefix}-rg \
  --location $region

az appservice plan create \
  --name ${prefix}-asp \
  --resource-group ${prefix}-rg \
  --sku B1 \
  --is-linux

user01 用の JupyterLab を作成

bash
username=user01

az webapp create \
  --name ${prefix}-$username \
  --resource-group ${prefix}-rg \
  --plan ${prefix}-asp \
  --deployment-container-image-name quay.io/jupyter/scipy-notebook:2024-03-14 \
  --https-only

az webapp config access-restriction add \
  --name ${prefix}-$username \
  --resource-group ${prefix}-rg \
  --priority 100 \
  --rule-name MyIP \
  --action Allow \
  --ip-address $(curl -s inet-ip.info)

az webapp config appsettings set \
  --name ${prefix}-$username \
  --resource-group ${prefix}-rg \
  --settings WEBSITES_PORT=8888

az webapp log config \
  --name ${prefix}-$username \
  --resource-group ${prefix}-rg \
  --web-server-logging filesystem

user01 用の JupyterLab にアクセス

appservice-jupyterlab-01.png

ログストリームから token を探す

appservice-jupyterlab-02.png

user01 用の JupyterLab ログイン後画面

appservice-jupyterlab-03.png

簡単な動作確認

appservice-jupyterlab-04.png

user02 用の JupyterLab を作成

bash
username=user02

az webapp create \
  --name ${prefix}-$username \
  --resource-group ${prefix}-rg \
  --plan ${prefix}-asp \
  --deployment-container-image-name quay.io/jupyter/scipy-notebook:2024-03-14 \
  --https-only

az webapp config access-restriction add \
  --name ${prefix}-$username \
  --resource-group ${prefix}-rg \
  --priority 100 \
  --rule-name MyIP \
  --action Allow \
  --ip-address $(curl -s inet-ip.info)

az webapp config appsettings set \
  --name ${prefix}-$username \
  --resource-group ${prefix}-rg \
  --settings WEBSITES_PORT=8888

az webapp log config \
  --name ${prefix}-$username \
  --resource-group ${prefix}-rg \
  --web-server-logging filesystem

user02 用の JupyterLab にアクセス

appservice-jupyterlab-05.png

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0