diff --git a/doc/run/k8s/install-sqlflow.yaml b/doc/run/k8s/install-sqlflow.yaml index 642eea390d..bf419e1ec6 100644 --- a/doc/run/k8s/install-sqlflow.yaml +++ b/doc/run/k8s/install-sqlflow.yaml @@ -24,7 +24,7 @@ spec: - containerPort: 8888 name: notebook command: - - bash + - sh - -c - 'export SQLFLOW_DATASOURCE=mysql://root:root@tcp\(${MY_POD_IP}:3306\)/?maxAllowedPacket=0 && jupyter notebook --ip=0.0.0.0 --port=8888 --allow-root --NotebookApp.token=""' env: diff --git a/docker/jupyter/install-jupyter.sh b/docker/jupyter/install-jupyter.sh index f1e69e5fe6..7f9333f468 100755 --- a/docker/jupyter/install-jupyter.sh +++ b/docker/jupyter/install-jupyter.sh @@ -23,8 +23,11 @@ set -e wget -q http://cdn.sqlflow.tech/alpine/py3-pandas-1.0.3-r0.apk wget -q -P /etc/apk/keys/ http://cdn.sqlflow.tech/alpine/sqlflow-5ef80180.rsa.pub apk add py3-pandas-1.0.3-r0.apk && rm py3-pandas-1.0.3-r0.apk +# Dependencies for jupyterhub +apk add py3-cryptography py3-ruamel.yaml.clib py3-requests pip -q install \ + jupyterhub==1.1.0 \ notebook \ sqlflow==0.10.0 @@ -32,7 +35,7 @@ pip -q install \ # automatically. c.f. https://stackoverflow.com/a/32683001. IPYTHON_STARTUP="/root/.ipython/profile_default/startup/" mkdir -p "$IPYTHON_STARTUP" -mkdir -p /workspace +mkdir -p /workspace/jupyter { echo 'get_ipython().magic(u"%reload_ext sqlflow.magic")'; echo 'get_ipython().magic(u"%reload_ext autoreload")'; echo 'get_ipython().magic(u"%autoreload 2")'; } \ diff --git a/docker/jupyterhub/jupyterhub_config.py b/docker/jupyterhub/jupyterhub_config.py index d4a16b5849..8ea04afcf7 100644 --- a/docker/jupyterhub/jupyterhub_config.py +++ b/docker/jupyterhub/jupyterhub_config.py @@ -67,9 +67,9 @@ 'Brings SQL and AI together. https://sqlflow.org' }] c.KubeSpawner.cmd = [ - "bash", "-c", + "sh", "-c", "export SQLFLOW_DATASOURCE=mysql://root:root@tcp\(${MY_POD_IP}:3306\)/?maxAllowedPacket=0 && \ - export SQLFLOW_SERVER=${SQLFLOW_SERVER_SERVICE_HOST}:${SQLFLOW_SERVER_SERVICE_PORT} && start-notebook.sh" + export SQLFLOW_SERVER=${SQLFLOW_SERVER_SERVICE_HOST}:${SQLFLOW_SERVER_SERVICE_PORT} && jupyterhub-singleuser jupyter notebook --ip=0.0.0.0 --port=8888 --allow-root --notebook-dir=/workspace/" ] c.KubeSpawner.extra_containers = [{