jupyter/dashboards_server

deploy dashboard from jupyterhub

bowenli37 opened this issue · 4 comments

I am trying to configure jupyterhub to spawn notebook container (image: datascience-notebook) in a docker setup as in jupyterhub/jupyterhub-deploy-docker, which can deploy dashboards to a dashboards server. The following statement is added to jupyterhub_config.py:

c.DockerSpawner.env.update(
     {'DASHBOARD_SERVER_AUTH_TOKEN': 'notebook_to_dashboard_secret',
     'DASHBOARD_SERVER_URL': 'http://jupyter_dashboards:3000/'})

It was verified that this two environment variables are present in the docker container.

It will show "500 Internal Server Error. No dashboard server configured."
jupyterhub lauch notebook via start-singleuser.sh, rather than start-notebook.sh. But I was not sure what is needed exactly for a notebook to work with dashboards other than the two environment variables. Does anyone have a working configuration? Thanks.

The url you have is dashboard_server. Do you have that container linked to your notebook server containers so that docker dns can resolve the name?

/cc @jtyberg

@parente asked the same question I would have. The jupyterhub/jupyterhub-deploy-docker reference implementation uses a Docker network to ensure all containers can talk to one another by container name. Docker handles the DNS lookup. In your configuration, a container named jupyter_dashboards must exist on the same network as your notebook container.

Thanks for the quick reponse. I learned that the environment variables are all we need, whatever start command is used for jupyter notebook.

It is my bad. I didn't read the default jupyterhub_config.py carefully, which can be generated by jupyterhub-generate-config.

The following works (jupyterhub_config.py):

c.Spawner.environment = {
  'DASHBOARD_SERVER_AUTH_TOKEN': 'notebook_to_dashboard_secret',
  'DASHBOARD_SERVER_URL': 'http://jupyter_dashboards:3000' }

In the end I used this configuration together with my docker-compose environement variables:

c.Spawner.env_keep = ['PATH', 'PYTHONPATH', 'CONDA_ROOT', 'CONDA_DEFAULT_ENV',
                  'VIRTUAL_ENV', 'LANG', 'LC_ALL',
                  'DASHBOARD_SERVER_AUTH_TOKEN',
                  'DASHBOARD_SERVER_URL']

Thanks for posting your solution!