# aihub dag 平台启停 jupyterlab

## 生产项目脚手架

```sh
goctl api go -api jupyter.api --dir dag-jupyter
```

## api

```sh
# 创建
curl --location --request POST 'http://192.168.199.109:18080/helm/ops/start' \
--header 'Content-Type: application/json' \
--data-raw '{
    "password": "argon2:$argon2id$v=19$m=10240,t=10,p=8$vSn0+TR0clV8kla6yqcZqQ$XgjDauBkBL5aY8C8668HKJjoTX7BUT/WccJ+BeANHq4",
    "namespace": "airflow",
    "workspace": "hello1",
    "base_url": "/nbss",
    "image": "SXKJ:32775/jupyterlab",
    "tag": "sxkj",
    "path": "/nbss",
    "host": "jupyterlab.sxkj.com",
    "release_name": "aihub-dag-jpt",
    "chart": "aihub-dag-jupyter.tgz",
    "path_type": "ImplementationSpecific"
}'

# 停止
curl --location --request POST 'http://192.168.199.109:18080/helm/ops/stop' \
--header 'Content-Type: application/json' \
--data-raw '{
    "namespace": "airflow",
    "release_name": "aihub-dag-jpt"
}'

# 更新
curl --location --request POST 'http://192.168.199.109:18080/helm/ops/upgrade' \
--header 'Content-Type: application/json' \
--data-raw '{
    "password": "argon2:$argon2id$v=19$m=10240,t=10,p=8$7XUU6rFtMFQl08bhGEry7g$tGEDIonDG93ZSXmOHYKnppoZJaBnT/x+ptB1SRPDIMI",
    "namespace": "airflow",
    "workspace": "hello1",
    "base_url": "/nbss",
    "image": "SXKJ:32775/jupyterlab",
    "tag": "sxkj",
    "path": "/nbss",
    "host": "jupyterlab.sxkj.com",
    "release_name": "aihub-dag-jpt",
    "chart": "aihub-dag-jupyter.tgz",
    "path_type": "ImplementationSpecific"
}'

# 获取password
curl --location --request GET 'http://192.168.199.109:18080/helm/password' \
--header 'Content-Type: application/json' \
--data-raw '{"password": "123456"}'
```

## helm 启动命令

```sh
helm upgrade --install aihub-dag-jpt-1  ./chart -f chart/values.yaml -n airflow \
--set "ingress.jupyterlab.hosts[0].host=jupyterlab.sxkj.com,ingress.jupyterlab.hosts[0].paths[0].path=/nbsss" \
--set jupyterlab.image.repository=SXKJ:32775/jupyterlab \
--set jupyterlab.image.tag=dev --set jupyterlab.config.password="\"argon2:\$argon2id\$v=19\$m=10240\,t=10\,p=8\$vSn0+TR0clV8kla6yqcZqQ\$XgjDauBkBL5aY8C8668HKJjoTX7BUT/WccJ+BeANHq4\"" \
--set jupyterlab.config.baseUrl="/nbsss" \
--set jupyterlab.config.workspace="hello2" \
--kubeconfig=`pwd`/config-sxkj.yaml

```

## helm wrapper

```sh
/app/helmwrapper --config /app/config-example.yaml --kubeconfig config.yaml --port 8081
```
