GithubHelp home page GithubHelp logo

jupyterhub / jupyterhub-deploy-docker Goto Github PK

View Code? Open in Web Editor NEW
679.0 38.0 358.0 411 KB

Reference deployment of JupyterHub with docker

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%
docker-container jupyterhub jupyter-notebook docker-volumes jupyter docker-deployment

jupyterhub-deploy-docker's Introduction

Technical Overview | Installation | Configuration | Docker | Contributing | License | Help and Resources


Latest PyPI version Latest conda-forge version Documentation build status GitHub Workflow Status - Test Test coverage of code GitHub Discourse Gitter

With JupyterHub you can create a multi-user Hub that spawns, manages, and proxies multiple instances of the single-user Jupyter notebook server.

Project Jupyter created JupyterHub to support many users. The Hub can offer notebook servers to a class of students, a corporate data science workgroup, a scientific research project, or a high-performance computing group.

Technical overview

Three main actors make up JupyterHub:

  • multi-user Hub (tornado process)
  • configurable http proxy (node-http-proxy)
  • multiple single-user Jupyter notebook servers (Python/Jupyter/tornado)

Basic principles for operation are:

  • Hub launches a proxy.
  • The Proxy forwards all requests to Hub by default.
  • Hub handles login and spawns single-user servers on demand.
  • Hub configures proxy to forward URL prefixes to the single-user notebook servers.

JupyterHub also provides a REST API for administration of the Hub and its users.

Installation

Check prerequisites

  • A Linux/Unix based system

  • Python 3.8 or greater

  • nodejs/npm

    • If you are using conda, the nodejs and npm dependencies will be installed for you by conda.

    • If you are using pip, install a recent version (at least 12.0) of nodejs/npm.

  • If using the default PAM Authenticator, a pluggable authentication module (PAM).

  • TLS certificate and key for HTTPS communication

  • Domain name

Install packages

Using conda

To install JupyterHub along with its dependencies including nodejs/npm:

conda install -c conda-forge jupyterhub

If you plan to run notebook servers locally, install JupyterLab or Jupyter notebook:

conda install jupyterlab
conda install notebook

Using pip

JupyterHub can be installed with pip, and the proxy with npm:

npm install -g configurable-http-proxy
python3 -m pip install jupyterhub

If you plan to run notebook servers locally, you will need to install JupyterLab or Jupyter notebook:

python3 -m pip install --upgrade jupyterlab
python3 -m pip install --upgrade notebook

Run the Hub server

To start the Hub server, run the command:

jupyterhub

Visit http://localhost:8000 in your browser, and sign in with your system username and password.

Note: To allow multiple users to sign in to the server, you will need to run the jupyterhub command as a privileged user, such as root. The wiki describes how to run the server as a less privileged user, which requires more configuration of the system.

Configuration

The Getting Started section of the documentation explains the common steps in setting up JupyterHub.

The JupyterHub tutorial provides an in-depth video and sample configurations of JupyterHub.

Create a configuration file

To generate a default config file with settings and descriptions:

jupyterhub --generate-config

Start the Hub

To start the Hub on a specific url and port 10.0.1.2:443 with https:

jupyterhub --ip 10.0.1.2 --port 443 --ssl-key my_ssl.key --ssl-cert my_ssl.cert

Authenticators

Authenticator Description
PAMAuthenticator Default, built-in authenticator
OAuthenticator OAuth + JupyterHub Authenticator = OAuthenticator
ldapauthenticator Simple LDAP Authenticator Plugin for JupyterHub
kerberosauthenticator Kerberos Authenticator Plugin for JupyterHub

Spawners

Spawner Description
LocalProcessSpawner Default, built-in spawner starts single-user servers as local processes
dockerspawner Spawn single-user servers in Docker containers
kubespawner Kubernetes spawner for JupyterHub
sudospawner Spawn single-user servers without being root
systemdspawner Spawn single-user notebook servers using systemd
batchspawner Designed for clusters using batch scheduling software
yarnspawner Spawn single-user notebook servers distributed on a Hadoop cluster
wrapspawner WrapSpawner and ProfilesSpawner enabling runtime configuration of spawners

Docker

A starter docker image for JupyterHub gives a baseline deployment of JupyterHub using Docker.

Important: This quay.io/jupyterhub/jupyterhub image contains only the Hub itself, with no configuration. In general, one needs to make a derivative image, with at least a jupyterhub_config.py setting up an Authenticator and/or a Spawner. To run the single-user servers, which may be on the same system as the Hub or not, Jupyter Notebook version 4 or greater must be installed.

The JupyterHub docker image can be started with the following command:

docker run -p 8000:8000 -d --name jupyterhub quay.io/jupyterhub/jupyterhub jupyterhub

This command will create a container named jupyterhub that you can stop and resume with docker stop/start.

The Hub service will be listening on all interfaces at port 8000, which makes this a good choice for testing JupyterHub on your desktop or laptop.

If you want to run docker on a computer that has a public IP then you should (as in MUST) secure it with ssl by adding ssl options to your docker configuration or by using an ssl enabled proxy.

Mounting volumes will allow you to store data outside the docker image (host system) so it will be persistent, even when you start a new image.

The command docker exec -it jupyterhub bash will spawn a root shell in your docker container. You can use the root shell to create system users in the container. These accounts will be used for authentication in JupyterHub's default configuration.

Contributing

If you would like to contribute to the project, please read our contributor documentation and the CONTRIBUTING.md. The CONTRIBUTING.md file explains how to set up a development installation, how to run the test suite, and how to contribute to documentation.

For a high-level view of the vision and next directions of the project, see the JupyterHub community roadmap.

A note about platform support

JupyterHub is supported on Linux/Unix based systems.

JupyterHub officially does not support Windows. You may be able to use JupyterHub on Windows if you use a Spawner and Authenticator that work on Windows, but the JupyterHub defaults will not. Bugs reported on Windows will not be accepted, and the test suite will not run on Windows. Small patches that fix minor Windows compatibility issues (such as basic installation) may be accepted, however. For Windows-based systems, we would recommend running JupyterHub in a docker container or Linux VM.

Additional Reference: Tornado's documentation on Windows platform support

License

We use a shared copyright model that enables all contributors to maintain the copyright on their contributions.

All code is licensed under the terms of the revised BSD license.

Help and resources

We encourage you to ask questions and share ideas on the Jupyter community forum. You can also talk with us on our JupyterHub Gitter channel.

JupyterHub follows the Jupyter Community Guides.


Technical Overview | Installation | Configuration | Docker | Contributing | License | Help and Resources

jupyterhub-deploy-docker's People

Contributors

aothms avatar bluecocoa avatar bryanwweber avatar consideratio avatar dalg24 avatar dependabot[bot] avatar fm75 avatar jtyberg avatar manics avatar mathbunnyru avatar minrk avatar moisei avatar parente avatar pre-commit-ci[bot] avatar willingc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jupyterhub-deploy-docker's Issues

`Permission denied` when saving notebooks after volumes transferred to new machine

I've been using this implementation on an AWS EC2 instance and everything works fine. However, we just had to move our services to a different AWS region and I had to transfer jupyterhub to a new instance. I followed the same steps as when I first installed it as per the instructions, yet in order to retain the users's files I copied the docker volumes from /var/lib/docker/volumes to the new machine and I made sure that the file permissions are the same as in the source instance.

Everything seems to be fine. I have access to all the notebooks in the volumes and I can run them without problems. But any time I try to save the work (or start a new notebook), I get a Permission denied error message. Since the permissions in the volumes have not changed, I'm at a loss about what the problem is and how I can fix it. Any help you can provide would be most appreciated.

Nvidia-docker-compose

Hello,

we want to use this deployment with a couple of powerful GPU. As far as I understand, using docker-compose will not make full use of our GPUs. To use nvidia-docker-compose, is it enough to just use the new command or do we have to make additional changes in the config file?
Furthermore, is there a way to limit the amount of GPU used by each single user notebook?

Best!

500 Error when starting Notebook

I have followed the instructions to get setup with JupyterHub and the GitHub Authenticator. However, I am using my own Docker image, built from jupyter/base-notebook. Once I log in and authenticate, I get the following message:

500 : Internal Server Error
Redirect loop detected. Notebook has jupyterhub version unknown (likely < 0.8), but the Hub expects 0.8.0. Try installing jupyterhub==0.8.0 in the user environment if you continue to have problems.
You can try restarting your server from the home page.

What does this mean exactly? Is this error coming from my individual notebook server?

Problem with running/authenticating on an EC2 (AWS) machine and checking right cert/key files used

@jtyberg
Thanks for dockerizing this. I followed your detailed README.
The only part that wasn't clear was what to use for jupyterhub.cer / jupyterhub.key files in the secret folder. I assumed from looking at the compose file here that I should be using the server.pem and server-key.pem files from the /.docker/machine/machines/jupyterhub/ folder (as per below). Is that the case? And should I copy these over to the a secrets folder in this repo as jupyterhub.cer and jupyterhub.key respectively?

-rw-------  1 me staff   381  4 May 15:35 id_rsa.pub
-rw-------  1 me staff  1679  4 May 15:35 id_rsa
-rw-r--r--  1 me staff  1127  4 May 15:39 server.pem
-rw-------  1 me staff  1679  4 May 15:39 server-key.pem
-rw-------  1 me staff  1675  4 May 15:39 key.pem
-rw-r--r--  1 me staff  1078  4 May 15:39 cert.pem
-rw-r--r--  1 me staff  1038  4 May 15:39 ca.pem
-rw-------  1 me staff  3407  4 May 15:39 config.json

On running up the jupyterhub container, I get this in the logs, which looks OK, I think.

jupyterhub | [I 2016-05-04 16:04:01.700 JupyterHub app:595] Loading cookie_secret from /data/jupyterhub_cookie_secret
jupyterhub | [W 2016-05-04 16:04:01.734 JupyterHub app:300]
jupyterhub |     Generating CONFIGPROXY_AUTH_TOKEN. Restarting the Hub will require restarting the proxy.
jupyterhub |     Set CONFIGPROXY_AUTH_TOKEN env or JupyterHub.proxy_auth_token config to avoid this message.
jupyterhub |
jupyterhub | [I 2016-05-04 16:04:01.764 JupyterHub app:1155] Hub API listening on http://jupyterhub:8080/hub/
jupyterhub | [I 2016-05-04 16:04:01.767 JupyterHub app:902] Starting proxy @ http://*:443/
jupyterhub | 16:04:01.865 - info: [ConfigProxy] Proxying https://*:443 to http://jupyterhub:8080
jupyterhub | 16:04:01.867 - info: [ConfigProxy] Proxy API at http://127.0.0.1:444/api/routes
jupyterhub | [I 2016-05-04 16:04:01.872 JupyterHub app:1178] JupyterHub is now running at http://127.0.0.1:443/

Navigating to the host in the browser, I'm presented with the Github login button, and this initially appears to work (seeking me to authenticate in Github against the application I had created). But it somehow doesn't complete that handshake .. and ends up giving me a 403 and then a 500 server error (as per the screenshots below).

image

Here are the logs from the jupyterhub container, which are probably more helpful in terms of figuring out what might be going wrong: https://gist.github.com/Analect/695752f105441d250517cfadcef6cc6a

Just to note that I have ports 8000, 2376 444 and 443 open on the EC2 instance, so it shouldn't really be a security blocking problem.

Would you have any pointers for me as to what might be going wrong here? Thanks.

Wired Redirect Loop

Hello I am using this script trying to set up a jupyterhub in a subfolder (/j/ of a domain and am getting a wired redirect loop.

What i have done:
set up nginx as reverse proxy as described in:
https://jupyterhub.readthedocs.io/en/stable/reference/config-proxy.html
where i just the folder /j/ to forward to jupyterhub (
location ~/j/ { proxy_pass http://mydomain:8000; .... }

Then I set up the base URL in the jupyter config
c.JupyterHub.base_url = u'/j/'

I can log into the system but then i get stuck in a redirect loop.
I also notice that the docker spawner never seem to have picked up the base_url, but not sure on this.
[I 2018-10-30 20:37:35.682 JupyterHub app:1906] JupyterHub is now running at http://:8000/j/ [I 2018-10-30 20:37:39.182 JupyterHub log:158] 302 GET /j/ -> /j/hub (@198.128.193.134) 2.00ms [I 2018-10-30 20:37:39.192 JupyterHub log:158] 302 GET /j/hub -> /j/hub/ (@198.128.193.134) 1.03ms [I 2018-10-30 20:37:39.230 JupyterHub log:158] 302 GET /j/hub/ -> /j/user/rgentz/ ([email protected]) 26.96ms [I 2018-10-30 20:37:39.261 JupyterHub log:158] 302 GET /j/user/rgentz/ -> /j/hub/user/rgentz/ (@198.128.193.134) 1.15ms [W 2018-10-30 20:37:39.295 JupyterHub dockerspawner:125] DockerSpawner.container_image is deprecated in dockerspawner 0.9. Use DockerSpawner.image [I 2018-10-30 20:37:39.344 JupyterHub dockerspawner:452] Container 'jupyter-rgentz' is gone [I 2018-10-30 20:37:39.448 JupyterHub dockerspawner:540] Created container 'jupyter-rgentz' (id: 9e9f5db) from image jupyterhub-user [I 2018-10-30 20:37:39.448 JupyterHub dockerspawner:557] Starting container 'jupyter-rgentz' (id: 9e9f5db) [I 2018-10-30 20:37:41.111 JupyterHub log:158] 200 GET /j/hub/api (@172.18.0.4) 2.23ms [I 2018-10-30 20:37:42.426 JupyterHub base:628] User rgentz took 3.130 seconds to start [I 2018-10-30 20:37:42.427 JupyterHub proxy:242] Adding user rgentz to proxy /j/user/rgentz/ => http://172.18.0.4:8888 20:37:42.429 - info: [ConfigProxy] Adding route /j/user/rgentz -> http://172.18.0.4:8888 20:37:42.430 - info: [ConfigProxy] 201 POST /api/routes/j/user/rgentz [I 2018-10-30 20:37:42.432 JupyterHub log:158] 302 GET /j/hub/user/rgentz/ -> /j/user/rgentz/?redirects=1 ([email protected]) 3149.93ms [I 2018-10-30 20:37:42.459 JupyterHub log:158] 302 GET /j/user/rgentz/?redirects=1 -> /j/hub/user/rgentz/?redirects=1 (@198.128.193.134) 1.16ms [I 2018-10-30 20:37:42.468 JupyterHub log:158] 302 GET /j/user/rgentz/?redirects=1 -> /j/hub/user/rgentz/?redirects=1 (@198.128.193.134) 1.12ms [W 2018-10-30 20:37:42.512 JupyterHub base:1101] Redirect loop detected on /j/hub/user/rgentz/?redirects=1 [I 2018-10-30 20:37:44.515 JupyterHub log:158] 302 GET /j/hub/user/rgentz/?redirects=1 -> /j/user/rgentz/?redirects=2 ([email protected]) 2041.74ms [I 2018-10-30 20:37:44.528 JupyterHub log:158] 302 GET /j/user/rgentz/?redirects=2 -> /j/hub/user/rgentz/?redirects=2 (@198.128.193.134) 1.16ms [W 2018-10-30 20:37:44.597 JupyterHub base:1101] Redirect loop detected on /j/hub/user/rgentz/?redirects=2 [I 2018-10-30 20:37:48.600 JupyterHub log:158] 302 GET /j/hub/user/rgentz/?redirects=2 -> /j/user/rgentz/?redirects=3 ([email protected]) 4037.30ms [I 2018-10-30 20:37:48.622 JupyterHub log:158] 302 GET /j/user/rgentz/?redirects=3 -> /j/hub/user/rgentz/?redirects=3 (@198.128.193.134) 1.13ms [W 2018-10-30 20:37:48.668 JupyterHub base:1101] Redirect loop detected on /j/hub/user/rgentz/?redirects=3 [I 2018-10-30 20:37:56.672 JupyterHub log:158] 302 GET /j/hub/user/rgentz/?redirects=3 -> /j/user/rgentz/?redirects=4 ([email protected]) 8032.12ms [I 2018-10-30 20:37:56.699 JupyterHub log:158] 302 GET /j/user/rgentz/?redirects=4 -> /j/hub/user/rgentz/?redirects=4 (@198.128.193.134) 1.36ms [W 2018-10-30 20:37:56.766 JupyterHub web:1667] 500 GET /j/hub/user/rgentz/?redirects=4 (198.128.193.134): Redirect loop detected. [E 2018-10-30 20:37:56.810 JupyterHub log:150] { "X-Real-Ip": "123.123.123.123", "Host": "mydomain", "X-Forwarded-For": "123.123.123.123", "Connection": "close", "Upgrade-Insecure-Requests": "1", "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36", "Dnt": "1", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", "Accept-Encoding": "gzip, deflate, br", "Accept-Language": "en-US,en;q=0.9", "Cookie": "jupyterhub-hub-login=\"2|1:0|10:1540929280|20:jupyterhub-hub-login|xxxx\"; __cfduid=xxx; grafana_sess=xxx; jupyterhub-session-id=xxx" }

Any scope for allowing users to select/specify an image underpinning their container?

Excuse the length of this, but it didn't make sense to break it up.

It may be out of scope here, but just wanted to ask ... or perhaps get pointed to other implementations. I also posted an issue here against Ryan Lovett's imagespawner repo, having heard him mention it during the jupyterhub-2016-workshop.

My use-case is as follows:

  1. users A and B have a private gitlab instance running, each with a collection of private and shared repos
  2. user A wants to be able to login to a running jupyterhub deployment to interact with one (or maybe more) of his private repos ideally exposing jupyterlab.
  3. the assumption is that the instance running the jupyterhub would already have all the latest images of user A and user B's private repos.
  4. those private repos would include something akin to a Dockerfile or requirements.txt defining the appropriate environment for a notebook to work (correct packages etc..) ... not dissimilar to how binder works.
  5. the repo file-system (as captured in the docker image), would pre-populate a file-explorer widget in the jupyterlab exposed in the container launched for a user based on the files as captured in the repo when the image was generated.
  6. any changes the user makes to the repo from that jupyterlab, is captured in a docker volume (as per this repo's architecture) .. and therefore could theoretically be used to commit changes back to the gitlab instance.
  7. let's say user A wants to work separately but simultaneously on another of his gitlab repos ... is there scope for him to launch more than one containerised environment while logged into jupyterhub as the same user ... but access another container based on a different repo image?

From here, I know different images can be used to underpin a jupyterhub, but changing requires a hub restart and it's not clear to me if it's possible to have different containers spawned from different images running on the same hub?

Would something like the imagespawner, linked to above, facilitate multiple containers based on different images running on the same jupyterhub?

If so, how about the scenario where the same user spins up different containers based on different images?

For step 4 above, is it enough that a private repo contains the singleuser script for it to be compatible with jupyterhub ... or is there something else that qualifies an image for use on jupyterhub, as per the docker-stacks images?

I know that some of this is bordering more on the 'binder' space, and specifically their custom deployments, although that brings with it greater complexities in terms of managing a kubernetes cluster, and I wanted to exhaust the possibilities with just using docker for now and the existing tooling around jupyterhub.

I'm aware there are initiatives afoot elsewhere, such as this one using a dynamic volumes to be associated with spawned user environments in kubernetes, and maybe ultimately the scenario I present above with a user being able to interact with multiple repos in containerised jupyterlab environments requires something like kubernetes for it to be achieved?

Thanks, as ever, to those infinitely better informed about this stuff than I am.

Failed to connect to db

Hi,

I'm trying to setup JupyterHub with docker, I've made the follwing steps:

--> clone jupyterhub-deploy-docker
--> set ENV proxy on Dockerfile.jupyterhub
--> generate my crt and key files with openssl
--> created my userlist
--> make build
--> make notebook_image
--> docker-compose up -d

However my JupyterHub is not starting, from the logs I can see problems connecting to postgres container.

$ docker logs -f jupyterhub

[I 2017-08-28 16:54:52.136 JupyterHub app:724] Loading cookie_secret from /data/jupyterhub_cookie_secret
[E 2017-08-28 16:54:52.172 JupyterHub app:807] Failed to connect to db: postgresql://postgres:7b7d2394041e75f99c6ab588dd8cf08112471a54ee6a9ebf1cd5afae8c7e134b@hub-db/jupyterhub
[C 2017-08-28 16:54:52.172 JupyterHub app:814] If you recently upgraded JupyterHub, try running
jupyterhub upgrade-db
to upgrade your JupyterHub database schema

$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
jupyterhub latest ff5967d3e663 4 minutes ago 703MB
jupyter/scipy-notebook 8f56e3c47fec 639be585e822 12 days ago 3.91GB
postgres 9.5 b3f8362c4bc5 2 weeks ago 265MB
jupyterhub/jupyterhub-onbuild 0.7.2 7070de919dfa 7 months ago 686MB

$ docker container ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e78faa9bbe60 jupyterhub "jupyterhub -f /sr..." 4 minutes ago Restarting (1) 59 seconds ago jupyterhub
cc4d92929ea0 postgres:9.5 "docker-entrypoint..." 4 minutes ago Up 3 minutes 5432/tcp jupyterhub-db

I've also tryed to connect to postgres container and it seams that it's working ok.

$ docker run --rm --user postgres --network jupyterhub-network postgres:9.5 psql -h hub-db -p 5432
Password:
psql: fe_sendauth: no password supplied

Can one give me some pointers on my error?

500 internal server error when doing gitlab-ce authentication(authentication cookies expires before creating)

I am also getting 500 Internal server error when autheticating with GITLAB-CE seems like authentication-state cookies expiration issue

cleared browser cookies and cache and any saved data and in New Tab opened https://localhost
security warning came like site is not safe I clicked on proceed safely
In chrome ctrl+shift+C>> application >> cookies I can see following entries
Sign in with gitlab page

Name:- xsrf
Value:- 2|d6b491b6|bf36d80df77faf9466583355e204eb77|1550066103
Expires:- 2020-03-15T13:55:03.000Z

Name:- username-localhost-8888
Value:-"2|1:0|10:1551431956|23:username-localhost-8888|44:MmU4ZDlmY2JkMzRkNDNjNWJhOTJiNmQ4NzNmYjA4NDA=|d5174b5df574432e334f4733f11943c12caf3cf3e05c4b47c7c962937c2a8960"
Expires:- 2020-03-31T09:19:16.000Z
-------------------------------- Once Clicked on Sign in with gitlab button ----------------------------

additional one entry came and disappered in less than half second and I landed to GitLab-CE login page but I screen recorded it to see the disappred entry

The one which disappeared was

Name :- oauthenticator-state
Value:- "2|1:0|10:1552127982|20:oauthenticator-state|120:Z... was not able to see comple value as it was partialy visiable in recording
expires :- 2019-03-10T1 ...

-------------------Once landed on gitlab-CE login-----------------------------------

Name:- _gitlab_session
Value:- ba46390addc98a11c22e4cd4dd064fdb
Expires:- 2019-03-09T12:39:42.873Z

---------------------loged in to gitlab with username-----------------------------
_gitlab_session
6dc3812c2eb2a0593ed8cb6c4f4f12b6
1969-12-31T23:59:59.000Z

--------------------Once Clicked on authosise in gitlab------------
Name:- _xsrf
Value :- 2|d6b491b6|bf36d80df77faf9466583355e204eb77|1550066103
Expireds:- 2020-03-15T13:55:03.000Z

Name:- username-localhost-8888
Value:- "2|1:0|10:1551431956|23:username-localhost-8888|44:MmU4ZDlmY2JkMzRkNDNjNWJhOTJiNmQ4NzNmYjA4NDA=|d5174b5df574432e334f4733f11943c12caf3cf3e05c4b47c7c962937c2a8960"
Expires:- 2020-03-31T09:19:16.000Z

GOT 500 INTERNAL SERVER ERROR

If issue is due authentication state cookies expiring before creating then how to solve it

DOCKER_NOTEBOOK_IMAGE vs. LOCAL_NOTEBOOK_IMAGE

Hi there!

I can't figure out a difference between DOCKER_NOTEBOOK_IMAGE and LOCAL_NOTEBOOK_IMAGE. Which one should I change to specify user's Notebook server image? I was sure that DOCKER_NOTEBOOK_IMAGE is used to achieve this. But at the end, only after I changed LOCAL_NOTEBOOK_IMAGE all began to work.

What is meant in the README by "not for production use"?

In the README, there is a disclaimer that one should not use this repo to deploy for a production environment:

Disclaimer: This deployment is NOT intended for a production environment.

What is meant by this warning? What could go wrong in a production environment? What are the possible holes here that warrant the disclaimer?

Thanks!

Use GoogleOAuthenticator

I would like to use Google instead of GitHub for authentication.

Therefore, I changed the jupyterhub_config.py as follows:

# Authenticate users with Google OAuth
c.JupyterHub.authenticator_class = 'oauthenticator.GoogleOAuthenticator'
c.GoogleOAuthenticator.oauth_callback_url = os.environ['OAUTH_CALLBACK_URL']
c.GoogleOAuthenticator.client_id = os.environ['GOOGLE_CLIENT_ID']
c.GoogleOAuthenticator.client_secret = os.environ['GOOGLE_CLIENT_SECRET']
c.GoogleOAuthenticator.hosted_domain = "my.domain"
c.GoogleOAuthenticator.login_service = "My Domain"

The secrets/oauth.env contains the respective environment variables.

When I fire up the service, it still wants to send me to GitHub. Where can I tell it to use Google instead?

Thank you!
Philip

Persisting container changes

Jupyter Notebook has the option of starting and running a terminal. This is useful to install packages using pip or download large files via wget/curl. However, while data seems to be persisted, installed packages vanish after restarting a user-container. Can we fix this?
I think we need to commit the changes, after shutdown. Is there by any chance an option to run stuff after a single notebook (in this case user-container) was shut down?

Network and config issues when starting jupyterhub

I have a working jupyterhub installation (based mostly on Andrea Zonca's instructions [https://zonca.github.io/2016/04/jupyterhub-sdsc-cloud.html] and it worked flawlessly for a machine-learning workshop. However, I now want to upgrade to using jupyterlab with my hub, and unfortunately experienced much the same problems as #26. I could access jupyterlab from the hub by manually changing the url once I had logged in, but was unable to have it as the default url. Hence I'm trying your docker deployment of the hub :)

My first issue arises with nginx on the host. If I have the service running and I start the hub I get the following error:

ERROR: for jupyterhub  Cannot start service hub: driver failed programming external connectivity on endpoint jupyterhub (dd0d984e99ddb8ce10900a489c82f96d42ab9f84e9b4977d874c85f0e0374096): Error starting userland proxy: listen tcp 0.0.0.0:443: bind: address already in use

ERROR: for hub  Cannot start service hub: driver failed programming external connectivity on endpoint jupyterhub (dd0d984e99ddb8ce10900a489c82f96d42ab9f84e9b4977d874c85f0e0374096): Error starting userland proxy: listen tcp 0.0.0.0:443: bind: address already in use
ERROR: Encountered errors while bringing up the project.

If I stop nginx, the hub starts with no errors, but the site won't load. The logs do however show an error with the config:

docker logs jupyterhub
[E 2017-09-11 02:17:41.976 JupyterHub application:569] Exception while loading config file /srv/jupyterhub/jupyterhub_config.py
    Traceback (most recent call last):
      File "/opt/conda/lib/python3.5/site-packages/traitlets/config/application.py", line 557, in _load_config_files
        config = loader.load_config()
      File "/opt/conda/lib/python3.5/site-packages/traitlets/config/loader.py", line 457, in load_config
        self._read_file_as_dict()
      File "/opt/conda/lib/python3.5/site-packages/traitlets/config/loader.py", line 489, in _read_file_as_dict
        py3compat.execfile(conf_filename, namespace)
      File "/opt/conda/lib/python3.5/site-packages/ipython_genutils/py3compat.py", line 185, in execfile
        exec(compiler(f.read(), fname, 'exec'), glob, loc)
      File "/srv/jupyterhub/jupyterhub_config.py", line 80, in <module>
        name = parts[0]
    IndexError: list index out of range

[I 2017-09-11 02:17:41.980 JupyterHub app:745] Writing cookie_secret to /srv/jupyterhub/jupyterhub_cookie_secret
[W 2017-09-11 02:17:42.302 JupyterHub app:365]
    Generating CONFIGPROXY_AUTH_TOKEN. Restarting the Hub will require restarting the proxy.
    Set CONFIGPROXY_AUTH_TOKEN env or JupyterHub.proxy_auth_token config to avoid this message.

[W 2017-09-11 02:17:42.336 JupyterHub app:864] No admin users, admin interface will be unavailable.
[W 2017-09-11 02:17:42.337 JupyterHub app:865] Add any administrative users to `c.Authenticator.admin_users` in config.
[I 2017-09-11 02:17:42.337 JupyterHub app:892] Not using whitelist. Any authenticated user will be allowed.
[I 2017-09-11 02:17:42.360 JupyterHub app:1453] Hub API listening on http://127.0.0.1:8081/hub/
[W 2017-09-11 02:17:42.364 JupyterHub app:1174] Running JupyterHub without SSL.  I hope there is SSL termination happening somewhere else...
[I 2017-09-11 02:17:42.364 JupyterHub app:1176] Starting proxy @ http://*:8000/
02:17:42.628 - info: [ConfigProxy] Proxying http://*:8000 to http://127.0.0.1:8081
02:17:42.633 - info: [ConfigProxy] Proxy API at http://127.0.0.1:8001/api/routes
[I 2017-09-11 02:17:42.675 JupyterHub app:1485] JupyterHub is now running at http://127.0.0.1:8000/

So, to me it looks as though the userlist isn't there? When I build the image it says it's copying it, so not sure whats happening.

I'm doing all this on a VM running on Openstack with Ubuntu 16.04, and I'm using Docker version 17.06.1-ce, build 874a737, docker-compose version 1.16.1, build 6d1ac21. I want to use PAM and local user accounts so I commented out references to oauth in the Dockerfile and Makefile (previously I was using the systemuser rather than the singleuser, is this another potential source of problems?).

I plan on trying kubernetes and helm in the future, but having never used either, this seemed like the easiest and quickest way to get what I want. Any advice on how to proceed greatly appreciated.

Userlist must be known a priori

When using the deployment for a workshop, tutorial, etc, the userlist is not necessarily known beforehand. It is preferred to not require a whitelist of users.

In the past, I also tried tmpnb. The problem that occurs in this case is that users will go to the site many times, hit refresh repeatedly, try to reconnect after loosing their connection on poor or Wifi or coming back from a break, etc. Since their session is not re-used, a new container is launched each time, which quickly consumes compute resources.

CC: @willingc @minrk

Trying to get this working to for deploying JupyterLab and using latest 0.7b1 of JupyterHub

Perhaps this should be added as an issue on the JupyterHub repo .. but it also feels appropriate to post here, given that this deployment is intended to be a best-practice approach to combining various repos .. like JupyterHub, JupyterLab and dockerspawner.

With the initial release by @minrk of the latest version of Jupyterhub, I'm trying to leverage this deployment to see how JupyterLab might work against this preliminary release.

It seems that JupyterLab should work out of the box by extending one of the docker-stack images, as per below, but I'm struggling a bit to get things working ... and would appreciate being pointed in the right direction to help resolve.

# replace with your desired base stack
FROM jupyter/scipy-notebook
RUN conda install jupyterlab
CMD ["start.sh", "jupyter", "lab"]

My use-case is seeking to extend the datascience-notebook, such that I can get it working in conjunction with JupyterLab. My image to get deployed on JupyterHub looks like this .. I'm not sure those additional parameters in CMD are really necessary, but through trial and error ... they got me closer to a working solution ... and were based on some of the related issues I saw in the dockerspawner repo here and here.

FROM jupyter/datascience-notebook
RUN conda config --add channels conda-forge
RUN conda install -c conda-forge jupyterlab --yes
RUN jupyter serverextension enable --py --sys-prefix jupyterlab
CMD ["start.sh", "jupyter", "lab", "--SingleUserNotebookApp.default_url=/lab", "--SingleUserNotebookApp.disable_user_config=True"]

My Dockerhub dockerfile looks like this ... and it based on the on that one @parente had ready to roll here on the 0.7 release ... but I don't know whether it's missing something to make it work with the 0.7.0b1 image generated and on docker registry?

FROM jupyterhub/jupyterhub-onbuild:0.7.0b1

# Install dockerspawner and its dependencies
RUN /opt/conda/bin/pip install \
    oauthenticator==0.5.* \
    dockerspawner==0.5.*

# install docker on the jupyterhub container
RUN wget https://get.docker.com -q -O /tmp/getdocker && \
    chmod +x /tmp/getdocker && \
    sh /tmp/getdocker

# Copy TLS certificate and key
ENV SSL_CERT /srv/jupyterhub/secrets/jupyterhub.crt
ENV SSL_KEY /srv/jupyterhub/secrets/jupyterhub.key
COPY ./secrets/*.crt $SSL_CERT
COPY ./secrets/*.key $SSL_KEY
RUN chmod 700 /srv/jupyterhub/secrets && \
    chmod 600 /srv/jupyterhub/secrets/*

COPY ./userlist /srv/jupyterhub/userlist

My .env and jupyterhub_config.py files are pretty much the same as already in this repo, but I was playing around with the following additional lines ... commenting/uncommenting to try to get things to work. Given that my image above ends in CMD ["start.sh", "jupyter", "lab"] ... I wasn't sure if that was enough ... or if I needed another explicit DOCKER_SPAWN_CMD in the '.env' file.. it seemed it didn't like anytime I tried to use the extra_create_kwargs variant, especially if there are spaces in the command.

#spawn_cmd = os.environ.get('DOCKER_SPAWN_CMD', "start-singleuser.sh")
#c.DockerSpawner.extra_create_kwargs.update({ 'command': spawn_cmd })
#c.DockerSpawner.extra_create_kwargs.update({'command': 'start.sh jupyter lab'})

It also wasn't clear to be which variant of adding '/lab' to default to JupyterLab was going to work ... since I this issue seems to suggest that Dockerspawner doesn't have the ability to set a default_url ... which is why I was playing around with mixing in plain Spawner and SingleUserNotebookApp variants ... but it's not clear to me whether you can mix/match these.

#c.Spawner.default_url='/user/%U/lab'
c.Spawner.default_url = '/lab'
#c.SingleUserNotebookApp.default_url= '/user/%U/lab'
#c.SingleUserNotebookApp.disable_user_config = True

The only other variant is that I'm using a GitLabAuthenticatior (versus Github in here)... but that all seems to work OK.

When I run up the hub and start my server ... I end up with this ... at the endpoint of https://myserver/user/testuser. In the docker-compose file, I had added ports "80:8080" ... just so I didn't need to add a port to the 'myserver' above ... but don't think that should be the source of the problem.

image

I can see that a new container was spawned OK ... and I know that running up the image I build ... exposing port 8888 and navigating to that in a browser works ... but somehow adding it into the jupyterhub mix ... something is failing.

CONTAINER ID        IMAGE                                                         COMMAND                  CREATED             STATUS              PORTS                                                  NAMES
dbafa6cc1c6e        jupyter/datascience-notebook:jlab0.1   "tini -- start.sh jup"   33 seconds ago      Up 33 seconds       8888/tcp                                               jupyter-testuser
2c44acdb448d        jupyterhub                                                    "jupyterhub -f /srv/j"   2 minutes ago       Up About a minute   0.0.0.0:443->443/tcp, 8000/tcp, 0.0.0.0:80->8080/tcp   jupyterhub

I don't know enough about the use of a proxy here ... and whether that is the failing part. Here are the logs. Is there anything glaring error in there that looks obvious? Should I have done something more to 'install' Jupyterlab on the image ... or was that conda command enough? How should I be setting up the default_url to take me to a working 'lab' session?

jupyterhub-deploy-docker$ docker-compose up
Starting jupyterhub
Attaching to jupyterhub
jupyterhub | [I 2016-11-15 13:55:26.486 JupyterHub app:724] Loading cookie_secret from /data/jupyterhub_cookie_secret
jupyterhub | [W 2016-11-15 13:55:26.527 JupyterHub app:365] 
jupyterhub |     Generating CONFIGPROXY_AUTH_TOKEN. Restarting the Hub will require restarting the proxy.
jupyterhub |     Set CONFIGPROXY_AUTH_TOKEN env or JupyterHub.proxy_auth_token config to avoid this message.
jupyterhub |     
jupyterhub | [I 2016-11-15 13:55:26.564 JupyterHub dockerspawner:332] Container 'jupyter-testuser' is gone
jupyterhub | [W 2016-11-15 13:55:26.565 JupyterHub dockerspawner:303] container not found
jupyterhub | [I 2016-11-15 13:55:26.589 JupyterHub app:1450] Hub API listening on http://jupyterhub:8080/hub/
jupyterhub | [I 2016-11-15 13:55:26.592 JupyterHub app:1173] Starting proxy @ http://*:443/
jupyterhub | 13:55:26.788 - info: [ConfigProxy] Proxying https://*:443 to http://jupyterhub:8080
jupyterhub | 13:55:26.791 - info: [ConfigProxy] Proxy API at http://127.0.0.1:444/api/routes
jupyterhub | [I 2016-11-15 13:55:26.799 JupyterHub app:1482] JupyterHub is now running at http://127.0.0.1:443/
^[[1;7Cjupyterhub | [I 2016-11-15 13:55:47.987 JupyterHub log:100] 302 GET / (@172.18.0.2) 1.47ms
jupyterhub | [I 2016-11-15 13:55:48.008 JupyterHub log:100] 302 GET /hub (@172.18.0.2) 1.77ms
jupyterhub | [W 2016-11-15 13:55:48.025 JupyterHub pages:32] Disallowing redirect outside JupyterHub: ''
jupyterhub | [I 2016-11-15 13:55:48.029 JupyterHub log:100] 302 GET /hub/ (@172.18.0.2) 1.27ms
jupyterhub | [I 2016-11-15 13:55:48.046 JupyterHub log:100] 302 GET /oauth_login (@172.18.0.2) 0.79ms
jupyterhub | [I 2016-11-15 13:55:48.061 JupyterHub oauth2:37] oauth redirect: 'https://myserver.com/hub/oauth_callback'
jupyterhub | [I 2016-11-15 13:55:48.064 JupyterHub log:100] 302 GET /hub/oauth_login (@172.18.0.2) 1.34ms
jupyterhub | http://myserver.com:10080//oauth/token?grant_type=authorization_code&code=f96f907debf86af5e78682dbe0ba4d608dddf7f1c7a3cb4c635e9ba329a47111&redirect_uri=https%3A%2F%2Fmyserver.com%2Fhub%2Foauth_callback&client_id=75c36207f96584c67123ea203118fe353b2be4dc783b6da2d012e1f4acf84457&client_secret=d215282cb8163d5a313493ae953e771ee2cb482e3e833e6752c566d3dc5eddf3
jupyterhub | [I 2016-11-15 13:55:55.715 JupyterHub log:100] 302 GET /hub/oauth_callback?code=f96f907debf86af5e78682dbe0ba4d608dddf7f1c7a3cb4c635e9ba329a47111 (@172.18.0.2) 233.60ms
jupyterhub | [I 2016-11-15 13:55:55.770 JupyterHub log:100] 200 GET /hub/home ([email protected]) 32.03ms
jupyterhub | [I 2016-11-15 13:55:58.033 JupyterHub log:100] 302 GET /hub/spawn ([email protected]) 3.79ms
jupyterhub | [I 2016-11-15 13:55:58.048 JupyterHub log:100] 302 GET /user/testuser (@172.18.0.2) 0.84ms
jupyterhub | [I 2016-11-15 13:55:58.068 JupyterHub dockerspawner:332] Container 'jupyter-testuser' is gone
jupyterhub | [W 2016-11-15 13:55:58.068 JupyterHub dockerspawner:303] container not found
jupyterhub | [I 2016-11-15 13:55:58.092 JupyterHub dockerspawner:332] Container 'jupyter-testuser' is gone
jupyterhub | [I 2016-11-15 13:55:58.142 JupyterHub dockerspawner:394] Created container 'jupyter-test-user' (id: dbafa6c) from image jupyter/datascience-notebook:jlab0.1
jupyterhub | [I 2016-11-15 13:55:58.142 JupyterHub dockerspawner:404] Starting container 'jupyter-testuser' (id: dbafa6c)
jupyterhub | [I 2016-11-15 13:55:59.688 JupyterHub base:322] User testuser server took 1.619 seconds to start
jupyterhub | [I 2016-11-15 13:55:59.688 JupyterHub orm:188] Adding user testuser to proxy /user/testuser => http://172.18.0.3:8888
jupyterhub | [I 2016-11-15 13:55:59.704 JupyterHub log:100] 302 GET /hub/user/testuser ([email protected]) 1638.97ms
jupyterhub | [I 2016-11-15 13:55:59.850 JupyterHub log:100] 302 GET /static/components/jquery-ui/themes/smoothness/jquery-ui.min.css?v=9b2c8d3489227115310662a343fce11c (@172.18.0.2) 0.95ms
jupyterhub | [I 2016-11-15 13:55:59.855 JupyterHub log:100] 302 GET /static/components/jquery-typeahead/dist/jquery.typeahead.min.css?v=7afb461de36accb1aa133a1710f5bc56 (@172.18.0.2) 0.78ms
jupyterhub | [I 2016-11-15 13:55:59.871 JupyterHub log:100] 302 GET /static/style/style.min.css?v=f6c09475baf6beabd41f8fe518601204 (@172.18.0.2) 1.36ms
jupyterhub | [I 2016-11-15 13:55:59.875 JupyterHub log:100] 302 GET /custom/custom.css (@172.18.0.2) 0.77ms
jupyterhub | [W 2016-11-15 13:55:59.886 JupyterHub log:100] 404 GET /hub/static/components/jquery-typeahead/dist/jquery.typeahead.min.css?v=7afb461de36accb1aa133a1710f5bc56 (@172.18.0.2) 1.05ms
jupyterhub | [W 2016-11-15 13:55:59.892 JupyterHub log:100] 404 GET /hub/static/components/jquery-ui/themes/smoothness/jquery-ui.min.css?v=9b2c8d3489227115310662a343fce11c (@172.18.0.2) 0.68ms
jupyterhub | [I 2016-11-15 13:55:59.901 JupyterHub log:100] 302 GET /static/components/es6-promise/promise.min.js?v=f004a16cb856e0ff11781d01ec5ca8fe (@172.18.0.2) 1.02ms
jupyterhub | [I 2016-11-15 13:55:59.906 JupyterHub log:100] 302 GET /static/components/requirejs/require.js?v=6da8be361b9ee26c5e721e76c6d4afce (@172.18.0.2) 0.78ms
jupyterhub | [W 2016-11-15 13:55:59.926 JupyterHub log:100] 404 GET /hub/custom/custom.css ([email protected]) 13.59ms
jupyterhub | [W 2016-11-15 13:55:59.928 JupyterHub log:100] 404 GET /hub/static/components/es6-promise/promise.min.js?v=f004a16cb856e0ff11781d01ec5ca8fe (@172.18.0.2) 0.74ms
jupyterhub | [W 2016-11-15 13:55:59.932 JupyterHub log:100] 404 GET /hub/static/style/style.min.css?v=f6c09475baf6beabd41f8fe518601204 (@172.18.0.2) 0.67ms
jupyterhub | [I 2016-11-15 13:55:59.991 JupyterHub log:100] 302 GET /static/base/images/logo.png?v=7c4597ba713d804995e8f8dad448a397 (@172.18.0.2) 0.96ms
jupyterhub | [W 2016-11-15 13:56:00.008 JupyterHub log:100] 404 GET /hub/static/base/images/logo.png?v=7c4597ba713d804995e8f8dad448a397 (@172.18.0.2) 0.82ms
^[[1;7C^[[1;7C

Thanks alot.
Colum

Docker volumes permission denied

We are facing some problems with file system permissions on the docker host node. We want to mount our docker host user home directories to our Jupyter containers using Docker Volumes. However we get some permission denied exceptions if we want to create/delete files/folders from the jupyter web app or container terminal. any idea how to best manage this?

container user id:

jovyan@0dd0bffd1a99:~$ id
uid=1000(jovyan) gid=100(users) groups=100(users)

host user id:
sssd user information

current jupyterhub setup:

  • Single azure virtual machine (Data Science Centos Image)
  • dockerspawner = 0.11.1
  • jupyterhub-ldap-authenticator = 0.3.2
  • free-ipa setup (jupyterhub node is a client) -> enabled home directories through sssd

Here is our current jupyterhub_config.py config:

# freeipa example
c.JupyterHub.authenticator_class = 'ldapauthenticator.LDAPAuthenticator'
c.LDAPAuthenticator.server_hosts = [****]
c.LDAPAuthenticator.bind_user_dn = '****'
c.LDAPAuthenticator.bind_user_password = '****'
c.LDAPAuthenticator.user_search_base = '****'
c.LDAPAuthenticator.user_search_filter = '****'
c.LDAPAuthenticator.user_membership_attribute = '****'
c.LDAPAuthenticator.group_search_base = '****'
c.LDAPAuthenticator.group_search_filter = '****'
c.LDAPAuthenticator.allowed_groups = ['*****']
c.LDAPAuthenticator.allow_nested_groups = True
c.LDAPAuthenticator.username_pattern = '[a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,252}[a-zA-Z0-9_.$-]?'
c.LDAPAuthenticator.create_user_home_dir = True
c.LDAPAuthenticator.create_user_home_dir_cmd = ['mkhomedir_helper']

## Admin Settings
c.Authenticator.admin_users = {'***', '***'}

## Docker Spawner settings
import dockerspawner

# Spawn single-user servers as Docker containers
c.JupyterHub.spawner_class = 'dockerspawner.DockerSpawner'

# Connect containers to this Docker network
c.DockerSpawner.use_internal_ip = True

# Remove containers once they are stopped
c.DockerSpawner.remove_containers = True

# For debugging arguments passed to spawned containers
c.DockerSpawner.debug = True

# List of available docker images
c.DockerSpawner.image_whitelist = {
    'Jupyter: Tensorflow': 'jupyter/tensorflow-notebook',
    'Jupyter: Data Science': 'jupyter/datascience-notebook',
    'Jupyter: Local Spark': 'jupyter/all-spark-notebook',
    'Jupyter: Scipy': 'jupyter/scipy-notebook',
    'Jupyter: R': 'jupyter/r-notebook'
}

# Explicitly set notebook directory because we'll be mounting a host volume to
# it.  Most jupyter/docker-stacks *-notebook images run the Notebook server as
# user `jovyan`, and set the notebook directory to `/home/jovyan/work`.
# We follow the same convention.
notebook_dir = '/home/{username}/notebooks'
c.DockerSpawner.notebook_dir = notebook_dir

# Mount the real user's Docker volume on the host to the notebook user's
# notebook directory in the container
c.DockerSpawner.volumes = {
        '/home/{username}/' : '/home/{username}/'
}

# Listen on all interfaces
#c.JupyterHub.hub_ip = '0.0.0.0'
from jupyter_client.localinterfaces import public_ips
ip = public_ips()[0]
c.JupyterHub.hub_ip = ip

c.DockerSpawner.notebook_dir not working with JupyterHub 0.8

Hi,

I am following this repo to setup my JupyterHub instance on a single server.

Recently, the repo was upgraded to JupyterHub 0.8 and I followed the changes. However, since the upgrade, the parameter c.DockerSpawner.notebook_dir doesn't seem to have an effect and the single user servers are always started at /home/jovyan instead of /home/jovyan/work

I tried giving different values to the configuration param but it always starts at home directory.

I rollbacked my system to old code before the changes made in last few days and it worked again.

Any help is appreciated.

Thanks,
Bhopesh

User jovyan with nbgrader 0.5 and JupyterHub 0.8

Apologies for the not so clear title.

I am using this repo's setup to have each user's notebook run inside a separate docker container. Unix username inside docker container is jovyan for all the users. This is okay because each of them have separate docker volumes.

Now the problem arises when I also try to use nbgrader in this setup. nbgrader uses unix username as student id instead of hub userid. This is causing one student's submission to override other's. Essentially there is just one student, jovyan, in the system.

Instead of having each student's unix name be jovyan, I can create new users from github id on the fly and then everything will work fine but I am wondering if there is a better way.

Is there a simpler way to tell nbgrader to use the id used by hub to authenticate user instead of unix username? In nbgrader 0.4, there seems to be something called HubAuth but that is gone is nbgrader 0.5

If yes, a followup question is can nbgrader see whether user is hub admin or not and enable/disable Formgrade extension accordingly?

I tried to look through existing issues and also did some web seach to see if there is something already answering my questions but didn't find any. If I have overlooked it, please share the links

no such image: jupyterhub-user

In .env file, variable LOCAL_NOTEBOOK_IMAGE is set to jupyterhub-user. And this is used in docker-compose.yml

DOCKER_NOTEBOOK_IMAGE: ${LOCAL_NOTEBOOK_IMAGE}

So, If I'm right, we need to set the jupyter-notebook/jupyter-lab image to this variable instead of DOCKER_NOTEBOOK_IMAGE as mentioned in documenation.

upgrade to 1.0

are there any plans to migrate defaults to jupyterhub 1.0?

Set different partition for volumes

Hi,
the main partition on my system is quite small but I do have a separate, larger, partition where I would like to save persistent data. What's the easiest way to set a different partition to save to volume to?
thanks!

TimeourError after spawning container

This issue might be related to #55

Hello everybody,

I basically followed your instructions, but made a few adjustments. The issue is that the notebook container doesn't respond.

jhub      | [I 2018-01-04 14:00:46.393 JupyterHub dockerspawner:452] Container 'jupyter-leckofunny' is gone
jhub      | [I 2018-01-04 14:00:46.520 JupyterHub dockerspawner:540] Created container 'jupyter-leckofunny' (id: c0ee899) from image jupyter/tensorflow-notebook:2c80cf3537ca
jhub      | [I 2018-01-04 14:00:46.521 JupyterHub dockerspawner:557] Starting container 'jupyter-leckofunny' (id: c0ee899)
jhub      | [W 2018-01-04 14:00:56.389 JupyterHub base:499] User leckofunny is slow to become responsive (timeout=10)
jhub      | [I 2018-01-04 14:00:56.395 JupyterHub base:748] leckofunny is pending spawn
jhub      | [I 2018-01-04 14:00:56.403 JupyterHub log:122] 200 GET /hub/user/leckofunny/ (leckofunny@::ffff:172.17.1.1) 10110.44ms
jhub      | [W 2018-01-04 14:00:56.422 JupyterHub log:122] 404 GET /hub/logo (@::ffff:172.17.1.1) 1.08ms
jhub      | [I 2018-01-04 14:01:11.638 JupyterHub base:719] Pending spawn for leckofunny didn't finish in 10.0 seconds
jhub      | [I 2018-01-04 14:01:11.638 JupyterHub base:724] leckofunny is pending spawn
jhub      | [W 2018-01-04 14:01:11.658 JupyterHub log:122] 404 GET /hub/logo (@::ffff:172.17.1.1) 1.00ms
jhub      | [W 2018-01-04 14:01:14.223 JupyterHub user:458] leckofunny's server never showed up at http://127.0.0.1:32771/user/leckofunny/ after 30 seconds. Giving up
jhub      | [I 2018-01-04 14:01:14.230 JupyterHub dockerspawner:628] Stopping container jupyter-leckofunny (id: c0ee899)
jhub      | [E 2018-01-04 14:01:14.767 JupyterHub gen:914] Exception in Future <tornado.concurrent.Future object at 0x7f3e5058c908> after timeout
jhub      |     Traceback (most recent call last):
jhub      |       File "/opt/conda/lib/python3.5/site-packages/tornado/gen.py", line 910, in error_callback
jhub      |         future.result()
jhub      |       File "/opt/conda/lib/python3.5/site-packages/jupyterhub/handlers/base.py", line 444, in finish_user_spawn
jhub      |         yield spawn_future
jhub      |       File "/opt/conda/lib/python3.5/site-packages/jupyterhub/user.py", line 476, in spawn
jhub      |         raise e
jhub      |       File "/opt/conda/lib/python3.5/site-packages/jupyterhub/user.py", line 450, in spawn
jhub      |         resp = yield server.wait_up(http=True, timeout=spawner.http_timeout)
jhub      |       File "/opt/conda/lib/python3.5/site-packages/jupyterhub/utils.py", line 180, in wait_for_http_server
jhub      |         timeout=timeout
jhub      |       File "/opt/conda/lib/python3.5/site-packages/jupyterhub/utils.py", line 135, in exponential_backoff
jhub      |         raise TimeoutError(fail_message)
jhub      |     TimeoutError: Server at http://127.0.0.1:32771/user/leckofunny/ didn't respond in 30 seconds
jhub      |
jhub      | [E 2018-01-04 14:01:14.771 JupyterHub gen:914] Exception in Future <tornado.concurrent.Future object at 0x7f3e5058c908> after timeout
jhub      |     Traceback (most recent call last):
jhub      |       File "/opt/conda/lib/python3.5/site-packages/tornado/gen.py", line 910, in error_callback
jhub      |         future.result()
jhub      |       File "/opt/conda/lib/python3.5/site-packages/jupyterhub/handlers/base.py", line 444, in finish_user_spawn
jhub      |         yield spawn_future
jhub      |       File "/opt/conda/lib/python3.5/site-packages/jupyterhub/user.py", line 476, in spawn
jhub      |         raise e
jhub      |       File "/opt/conda/lib/python3.5/site-packages/jupyterhub/user.py", line 450, in spawn
jhub      |         resp = yield server.wait_up(http=True, timeout=spawner.http_timeout)
jhub      |       File "/opt/conda/lib/python3.5/site-packages/jupyterhub/utils.py", line 180, in wait_for_http_server
jhub      |         timeout=timeout
jhub      |       File "/opt/conda/lib/python3.5/site-packages/jupyterhub/utils.py", line 135, in exponential_backoff
jhub      |         raise TimeoutError(fail_message)
jhub      |     TimeoutError: Server at http://127.0.0.1:32771/user/leckofunny/ didn't respond in 30 seconds

I tried these notebook images and called make nobteook_image:
jupyter/minimal-notebook:e1677043235c and jupyter/tensorflow-notebook:2c80cf3537ca (which is currently latest)

Maybe its due to some of my modifications:

  • removed https stuff
  • set port to 8080 (port 8000 is already in use by my gitlab server which is on the same host)
  • set hub_port to 8081
  • oauth via custom gitlab (works)
  • assigned a subnet to the docker network docker network create --subnet=10.180.112.1/24 $(DOCKER_NETWORK_NAME) (otherwise it causes a conflict within my university's network)

I'm wondering if the issue is caused by the network setup.
jupyterhub-deploy-docker.zip

Failed to connect to db: postgresql

I noticed that the jupyterhub container initially has problems connecting to the database.
I made the following changes to docker-compose.yml to solve the problem:

  • Update to version 2.1
  • Add healthcheck to hub-db service
  • Add healthcheck as condition to hub service "depends_on"
hub-db:
   ....
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 30s
      timeout: 30s
      retries: 3
  hub:
    depends_on:
      hub-db:
        condition: service_healthy

Use Lab as default route

I would like to use jupyterlab as the default application. Although, it is properly installed and reachable (by manually navigating to the /lab endpoint), /tree (jupyterhub) is still the default route. I found some old posts (e.g., #26 ) and there is even an example config, but it seems to be outdated.

How could one set the default route to jupyter lab?

Fails if behind proxy

This currently doesn't work if you're on a proxied network.
I've made some changes that have fixed most of it, but I haven't completely gotten it working yet.

This is from the make notebook_image command.

e1677043235c: Pulling from jupyter/minimal-notebook
Status: Image is up to date for jupyter/minimal-notebook:e1677043235c
docker build -t jupyterhub-user \
	--build-arg JUPYTERHUB_VERSION=0.8.0 \
	--build-arg DOCKER_NOTEBOOK_IMAGE=jupyter/minimal-notebook:e1677043235c \
	singleuser
Sending build context to Docker daemon  2.048kB
Step 1/4 : ARG DOCKER_NOTEBOOK_IMAGE
Step 2/4 : FROM $DOCKER_NOTEBOOK_IMAGE
 ---> c86d7e5f432a
Step 3/4 : ARG JUPYTERHUB_VERSION
 ---> Using cache
 ---> be71e0724cd5
Step 4/4 : RUN python3 -m pip install --no-cache jupyterhub==$JUPYTERHUB_VERSION
 ---> Running in 02c9c26fcc9b
Collecting jupyterhub==0.8.0
  Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f2f0f764710>, 'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/jupyterhub/

Connection

Hello,

I run jupyterhub and everything seems to be fine. This is the log:

Creating jupyterhub-db
Creating jupyterhub
Attaching to jupyterhub-db, jupyterhub
jupyterhub-db | LOG: database system was shut down at 2018-04-09 09:02:08 UTC
jupyterhub-db | LOG: MultiXact member wraparound protections are now enabled
jupyterhub-db | LOG: autovacuum launcher started
jupyterhub-db | LOG: database system is ready to accept connections
jupyterhub | [I 2018-04-09 09:02:14.749 JupyterHub app:849] Loading cookie_secret from /data/jupyterhub_cookie_secret
jupyterhub | [I 2018-04-09 09:02:14.825 JupyterHub app:1539] Hub API listening on http://jupyterhub:8080/hub/
jupyterhub | [W 2018-04-09 09:02:14.826 JupyterHub proxy:415]
jupyterhub | Generating CONFIGPROXY_AUTH_TOKEN. Restarting the Hub will require restarting the proxy.
jupyterhub | Set CONFIGPROXY_AUTH_TOKEN env or JupyterHub.proxy_auth_token config to avoid this message.
jupyterhub |
jupyterhub | [I 2018-04-09 09:02:14.827 JupyterHub proxy:458] Starting proxy @ https://:443/
jupyterhub | 09:02:15.060 - info: [ConfigProxy] Proxying https://
:443 to (no default)
jupyterhub | 09:02:15.063 - info: [ConfigProxy] Proxy API at http://127.0.0.1:8001/api/routes
jupyterhub | [W 2018-04-09 09:02:15.156 JupyterHub proxy:304] Adding missing default route
jupyterhub | [I 2018-04-09 09:02:15.156 JupyterHub proxy:370] Adding default route for Hub: / => http://jupyterhub:8080
jupyterhub | 09:02:15.157 - info: [ConfigProxy] 200 GET /api/routes
jupyterhub | 09:02:15.165 - info: [ConfigProxy] Adding route / -> http://jupyterhub:8080
jupyterhub | 09:02:15.166 - info: [ConfigProxy] 201 POST /api/routes/
jupyterhub | [I 2018-04-09 09:02:15.166 JupyterHub app:1592] JupyterHub is now running at https://:443/

However, if I want to open the website, my browser is unable to connect to the website. I have a valid crt and key and the oauth is double-checked. Does anyone see the problem?

OAuth 404 error

I get an 404 when clicking on login
jupyterhub/oauthenticator#141

Following along with https://github.com/jupyterhub/jupyterhub-deploy-docker I created https://github.com/viennadatasciencegroup/jupyterhub which hosts a Jupiter hub at https://hub.vdsg.at/hub/login

However, when clicking on the login button

[I 2017-10-24 05:26:19.722 JupyterHub oauth2:82] OAuth redirect: 'https://hub.vdsg.at/hub/oauth_callback'
jupyterhub | [I 2017-10-24 05:26:19.724 JupyterHub log:122] 302 GET /hub/oauth_login?next= → https://github.com/login/oauth/authorize?state=eyJzdGF0ZV9pZCI6ICJjNDgzZjZlMjk3MDE0NTRhYjE4ZjgyY2MxMjMxZTY0MiIsICJuZXh0X3VybCI6ICIifQ==&response_type=code&client_id=&redirect_uri=https://hub.vdsg.at/hub/oauth_callback (@::ffff:78.46.228.137) 3.06ms

the logs only show an redirect and GitHub itself returns an 404

The IP of the spawner is already set via docker-DNS

To me the redirect URL with spaces and empty client_id parameter as well as binary (@::ffff:78.46.228.137) looks a bit weird.

docker: host does not create user container (invalid reference format)

From @inkrement on January 24, 2018 7:43

I basically, tried to run the Jupyterhub/docker-demo, but upgraded to the newest docker-versions.

The server itself and Github-OAuth work fine, but when I get redirected from Github (right after authentication) I get the following error (and an uncaught exception):

jupyterhub | [I 2018-01-24 07:20:32.789 JupyterHub log:124] 302 GET /user/inkrement/ -> /hub/user/inkrement/ (@::ffff:137.208.40.78) 1.14ms
jupyterhub | [I 2018-01-24 07:20:32.888 JupyterHub dockerspawner:373] Container 'jupyter-inkrement' is gone
jupyterhub | [E 2018-01-24 07:20:32.911 JupyterHub user:427] Unhandled error starting inkrement's server: 500 Server Error: Internal Server Error ("invalid reference format")
jupyterhub | [I 2018-01-24 07:20:32.918 JupyterHub dockerspawner:373] Container 'jupyter-inkrement' is gone
jupyterhub | [W 2018-01-24 07:20:32.918 JupyterHub dockerspawner:344] container not found

I checked all running and stoped docker containers, but there is no container named "jupyter-inkrement". It seems like it was not able to spawn the docker container, but I do not know what to do. Any suggestions?

The container-docker is linked to the host-docker via volume as in the demo and I am using a quite new docker version: 17.05.0-ce, build 89658be

Copied from original issue: jupyterhub/jupyterhub#1630

500 : Internal Server Error --help

Edited

maybe some problems on the proxy: the “PORTS ” of the user‘s containmer is “8888/tcp ”?

1

the logs of jupyterhub‘s container as follows:

[E 2018-01-12 21:46:49.248 JupyterHub log:124] 500 GET /hub/user/jane/ (jane@::ffff:159.226.12.83) 4444.00ms

2

the useer's container is:

CONTAINER ID        IMAGE                                 COMMAND                  CREATED             STATUS              PORTS                    NAMES
d8d4514fb49d        jupyter/scipy-notebook:8f56e3c47fec   "tini -- start-not..."   12 hours ago        Up 3 seconds        8888/tcp                 jupyter-jane

3

the logs of user's container as follows:

[I 09:14:04.433 NotebookApp] Running the core application with no additional extensions or settings
[I 09:14:04.436 NotebookApp] Serving notebooks from local directory: /home/jovyan
[I 09:14:04.436 NotebookApp] 0 active kernels 
[I 09:14:04.436 NotebookApp] The Jupyter Notebook is running at: http://0.0.0.0:8888/?token=91a9eb2ddaef73e1164c08bcb7bc8fcbce749b70a1ffbd5d
[I 09:14:04.436 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 09:14:04.437 NotebookApp] 
    
    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://0.0.0.0:8888/?token=91a9eb2ddaef73e1164c08bcb7bc8fcbce749b70a1ffbd5d
[C 09:19:55.084 NotebookApp] received signal 15, stopping
[I 09:19:55.087 NotebookApp] Shutting down kernel

adding another route to the spawned user container

For my use case, I need to install and launch a tomcat server inside the notebook container. This server will interact with the notebook server via a notebook widget. I need to install this tomcat server inside the container to access the user's workdir data. The connection process from a notebook to the tomcat server (via a widget) adds and execute a javascript on the client side, so that the url given starts from the client (not from the notebook server). So I need to access the current user container to initialize my tomcat application.
So here is my question:
I would like to know if there is a way to add a route at user container spawning time, in the same time jupyterhub creates the https://myserver/user/username route to the user notebook ?
for example:
https://myserver/user/username goes through 443--jupyterhub--8888--user-container:notebookserver
and in the same time
https://myserver/user/username/tomcatserver through 443--jupyterhub--8443--user-container:tomcatserver

docker_architecture

Redirecting HTTP to HTTPS

I'm using jupyterhub 1.0 docker image. When changing configs to use SSL, https://mydomain.com is accessible, however, http://mydomain.com is not. I have seen that the problem can be addressed by setting up a reverse proxy (Nginx or something) to sit between Jupyterhub and browsers for redirecting requests to port 80 to 443 of Jupyterhub. Just wanted to know if the same result can be achieved without the reverse proxy.
My question is similar to this.

Best strategy for sharing notebook data between users

I have setup a single host instance of jupyterhub for a specific group need. We would like to have a common view between all of the data directories for the users instead of having a separate data directory for each user. It is not immediately obvious to me which would be the best route to take to enable this when working with the user volumes and mapping a particular host directory to all of the individual jupyter docker instances.

TypeError: 'LazyConfigValue' object is not iterable

I tried to run jupyterHub with docker. Eveything was working fine ( jupyterHub + authentication) until I tried to set up the spawning process :

[E 2018-03-01 09:42:00.213 JupyterHub app:1710] Traceback (most recent call last): File "/opt/conda/lib/python3.5/site-packages/jupyterhub/app.py", line 1707, in launch_instance_async yield self.initialize(argv) File "/opt/conda/lib/python3.5/types.py", line 199, in __next__ return next(self.__wrapped) File "/opt/conda/lib/python3.5/site-packages/jupyterhub/app.py", line 1447, in initialize self.load_config_file(self.config_file) File "<decorator-gen-5>", line 2, in load_config_file File "/opt/conda/lib/python3.5/site-packages/traitlets/config/application.py", line 87, in catch_config_error return method(app, *args, **kwargs) File "/opt/conda/lib/python3.5/site-packages/traitlets/config/application.py", line 598, in load_config_file raise_config_file_errors=self.raise_config_file_errors, File "/opt/conda/lib/python3.5/site-packages/traitlets/config/application.py", line 580, in _load_config_files collisions = earlier_config.collisions(config) File "/opt/conda/lib/python3.5/site-packages/traitlets/config/loader.py", line 212, in collisions for key in mine: TypeError: 'LazyConfigValue' object is not iterable

Here is my jupyterhub_config.py :

#import dummyauthenticator
#from jupyterhub.auth import Authenticator
#from jupyter_client.localinterfaces import public_ips
from dockerspawner import DockerSpawner
import os
#import netifaces
c = get_config()

# setting the image used to spawn notebooks
#c.DockerSpawner.container_image = 'jupyter/minimal-notebook'
c.DockerSpawner.container_image = os.environ['DOCKER_NOTEBOOK_IMAGE']

# setting jupyterhub options : port , ip
c.JupyterHub.hub_ip = '0.0.0.0'
#c.JupyterHub.hub_port = 8080
#c.JupyterHub.port = 8000

# managing the authentication
c.JupyterHub.authenticator_class = 'dummyauthenticator.DummyAuthenticator'
c.dummyauthenticator.password = 'toto'

# managing the spawning of notebooks
c.JupyterHub.spawner_class = DockerSpawner
c.DockerSpawner.container_image = os.environ['DOCKER_NOTEBOOK_IMAGE']

c.DockerSpawner.host_ip = '10.0.2.15'
#c.DockerSpawner.use_internal_ip = True
c.DockerSpawner.remove_containers = True

and the docker-compose.yml :





version: "2"
services:
  hub:
    restart: always
    image: naama:latest
    container_name: jupyterhub
    ports:
       - "8000:8000"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:rw"
    environment:
      DOCKER_NOTEBOOK_DIR: "C:/docker4wl/docker4wl-workspace/notebook"
      DOCKER_NOTEBOOK_IMAGE: 'jupyter/minimal-notebook:latest'

Here is also a link to someone who had to deal with a similar error : issue
note : I followed @minrk tutorial on youtube :)

Docker in docker container design question

Still relatively new to Docker, and it's moving so fast it's a little hard to find up to date information on best practices / how something like running Docker inside a Docker container would be optimized by the containerization layer.

It seems like it's probably low overhead, but I can't find anything that explicitly says "this is a good design pattern and should be used when inter-container coordination is too difficult.

Curious what the pros and cons are to a setup like this: https://github.com/jupyterhub/oauthenticator/tree/master/example

Which after tweaking some old configuration, was able to get up and running with persistence on a volume like this -v hubdata:/home.

Need to do some more testing to see how well the isolation is handled, and implications of shared users. But, for running a hub server for a small team of devs, avoiding docker-ception seems to be sufficient and less complex - barring some performance considerations that I am missing.

Penny for your thoughts on the pros and cons of single docker container vs multiple docker containers?

Edit: Revisited the diagram, and it looks like the spawned containers are sitting at the same level as the hub itself. Trying to trace the need for:

# install docker on the jupyterhub container
RUN wget https://get.docker.com -q -O /tmp/getdocker && \
    chmod +x /tmp/getdocker && \
    sh /tmp/getdocker

How to redirect HTTP requests to HTTPS

I have set up an instance of JupyterHub with this repo as the reference. However, requests from the client browser to http://mysite.mydomain result in ERR_ADDRESS_UNREACHABLE in Chrome, whereas requests to https://mysite.mydomain are successful and everything seems to work. Do I have a configuration problem in, e.g., my firewall, or is the proxy not redirecting requests properly? Or something else?

Thanks!

Starting container with HostConfig removed in Docker 1.12 - extra_start_kwargs fails

When an authenticated user starts a server, I see this exception:

docker.errors.APIError: 400 Client Error: Bad Request ("b'{"message":"starting container with HostConfig was deprecated since v1.10 and removed in v1.12"}'")

Not sure if this is the right diagnosis, but it seems like the extra_start_kwargs get passed to the docker-py client here in dockerspawner, and then gets packaged into HostConfig in docker-py. And in Docker 1.12 this is disallowed. Maybe this is really a bug in dockerspawner? Or - best case scenario - I'm just configuring something wrong.

Hiccups aside, this reference deployment is really helpful. Thanks!

A full stack trace for reference:

[E 2016-07-31 01:09:45.313 JupyterHub web:1524] Uncaught exception GET /hub/user/willengler (172.18.0.1)
     HTTPServerRequest(protocol='http', host='localhost:8000', method='GET', uri='/hub/user/willengler', version='HTTP/1.1', remote_ip='172.18.0.1', headers={'Accept-Language': 'en-US,en;q=0.8', 'Host': 'localhost:8000', 'Upgrade-Insecure-Requests': '1', 'Referer': 'http://localhost:8000/hub/home', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36', 'Connection': 'keep-alive', 'Dnt': '1', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Cookie': 'jupyter-hub-token="2|1:0|10:1469923076|17:jupyter-hub-token|44:OTAxYjcyNjUwYTkxNGVlYjhkZGI2M2IyNmE0NDIxMTc=|6e8cf80adff7387db0538fe75140850b7d4ba39a01acb4f6bb31c0d6385d171f"; csrftoken=MS6Px1V3vBda1ETy6pL7oO8plbJI5AZZ', 'Accept-Encoding': 'gzip, deflate, sdch'})
     Traceback (most recent call last):
       File "/opt/conda/lib/python3.5/site-packages/tornado/web.py", line 1445, in _execute
         result = yield result
       File "/opt/conda/lib/python3.5/site-packages/jupyterhub/handlers/base.py", line 494, in get
         yield self.spawn_single_user(current_user)
       File "/opt/conda/lib/python3.5/site-packages/jupyterhub/handlers/base.py", line 312, in spawn_single_user
         yield gen.with_timeout(timedelta(seconds=self.slow_spawn_timeout), f)
       File "/opt/conda/lib/python3.5/site-packages/jupyterhub/user.py", line 247, in spawn
         raise e
       File "/opt/conda/lib/python3.5/site-packages/jupyterhub/user.py", line 228, in spawn
         yield gen.with_timeout(timedelta(seconds=spawner.start_timeout), f)
       File "/opt/conda/lib/python3.5/site-packages/dockerspawner/dockerspawner.py", line 416, in start
         yield self.docker('start', self.container_id, **start_kwargs)
       File "/opt/conda/lib/python3.5/concurrent/futures/_base.py", line 398, in result
         return self.__get_result()
       File "/opt/conda/lib/python3.5/concurrent/futures/_base.py", line 357, in __get_result
         raise self._exception
       File "/opt/conda/lib/python3.5/concurrent/futures/thread.py", line 55, in run
         result = self.fn(*self.args, **self.kwargs)
       File "/opt/conda/lib/python3.5/site-packages/dockerspawner/dockerspawner.py", line 292, in _docker
         return m(*args, **kwargs)
       File "/opt/conda/lib/python3.5/site-packages/docker/utils/decorators.py", line 21, in wrapped
         return f(self, resource_id, *args, **kwargs)
       File "/opt/conda/lib/python3.5/site-packages/docker/api/container.py", line 368, in start
         self._raise_for_status(res)
       File "/opt/conda/lib/python3.5/site-packages/docker/client.py", line 174, in _raise_for_status
         raise errors.APIError(e, response, explanation=explanation)
     docker.errors.APIError: 400 Client Error: Bad Request ("b'{"message":"starting container with HostConfig was deprecated since v1.10 and removed in v1.12"}'")

R Kernel

Hi, would you be so kind and add some documentation how to add/enable R kernels for all users? I tried to adopt https://github.com/jupyter/docker-stacks/blob/master/r-notebook/Dockerfile without success. To do so, I copied the fixed-permissions and the R pre-requisites & R packages except USER $NB_USER. Fixed-permissions did not work because of missing permissions and it does not work without it.

EDIT:
Or would it be possible to activate the conda-interface somehow? Even as admin I am not able to see it on a fresh setup.

Update for production or deprecate this repo

This repo was created to provide a reference (not production) deployment when using JupyterHub with Docker. We've made significant improvements in deploying JupyterHub on Kubernetes reference Zero To JupyterHub.

Question: what should be the future of this repo?

If keeping around as a reference deployment:

  • Update this reference deployment to JupyterHub 0.8.1
  • Create a more prominent disclaimer/warning/intended usage message in README.

Otherwise:

  • Archive the repo

cc/ @minrk

user-container can't be started due to the bug in the jupyterhub code

Trying to start a notebook for a user leads to the following log:

[I 2019-03-15 15:18:27.936 JupyterHub app:1673] Using Authenticator: dummyauthenticator.dummyauthenticator.DummyAuthenticator
[I 2019-03-15 15:18:27.936 JupyterHub app:1673] Using Spawner: dockerspawner.dockerspawner.DockerSpawner-0.11.0
[I 2019-03-15 15:18:27.943 JupyterHub app:1016] Loading cookie_secret from /data/jupyterhub_cookie_secret
[I 2019-03-15 15:18:28.051 JupyterHub proxy:431] Generating new CONFIGPROXY_AUTH_TOKEN
[I 2019-03-15 15:18:28.141 JupyterHub app:1855] Hub API listening on http://jupyterhub:8080/hub/
[W 2019-03-15 15:18:28.149 JupyterHub proxy:565] Running JupyterHub without SSL.  I hope there is SSL termination happening somewhere else...
[I 2019-03-15 15:18:28.149 JupyterHub proxy:567] Starting proxy @ http://:8000
15:18:28.793 - info: [ConfigProxy] Proxying http://*:8000 to (no default)
15:18:28.795 - info: [ConfigProxy] Proxy API at http://127.0.0.1:8001/api/routes
15:18:29.109 - info: [ConfigProxy] 200 GET /api/routes 
[I 2019-03-15 15:18:29.112 JupyterHub proxy:301] Checking routes
[I 2019-03-15 15:18:29.113 JupyterHub proxy:370] Adding default route for Hub: / => http://jupyterhub:8080
15:18:29.117 - info: [ConfigProxy] Adding route / -> http://jupyterhub:8080
15:18:29.118 - info: [ConfigProxy] 201 POST /api/routes/ 
[I 2019-03-15 15:18:29.120 JupyterHub app:1912] JupyterHub is now running at http://:8000
[I 2019-03-15 15:18:29.995 JupyterHub log:158] 302 GET / -> /hub (@::ffff:172.19.0.1) 3.71ms
[I 2019-03-15 15:18:30.010 JupyterHub log:158] 302 GET /hub -> /hub/ (@::ffff:172.19.0.1) 2.44ms
[I 2019-03-15 15:18:30.033 JupyterHub log:158] 302 GET /hub/ -> /user/max/ (max@::ffff:172.19.0.1) 15.87ms
[I 2019-03-15 15:18:30.048 JupyterHub log:158] 302 GET /user/max/ -> /hub/user/max/ (@::ffff:172.19.0.1) 1.14ms
[W 2019-03-15 15:18:30.072 JupyterHub dockerspawner:173] DockerSpawner.container_image is deprecated in dockerspawner 0.9.  Use DockerSpawner.image
[I 2019-03-15 15:18:30.183 JupyterHub dockerspawner:785] Container 'jupyter-max' is gone
[E 2019-03-15 15:18:30.195 JupyterHub user:477] Unhandled error starting max's server: 'dict' object is not callable
[I 2019-03-15 15:18:30.204 JupyterHub dockerspawner:785] Container 'jupyter-max' is gone
[W 2019-03-15 15:18:30.205 JupyterHub dockerspawner:758] Container not found: jupyter-max
[E 2019-03-15 15:18:30.244 JupyterHub web:1670] Uncaught exception GET /hub/user/max/ (::ffff:172.19.0.1)
    HTTPServerRequest(protocol='http', host='10.20.63.207:8000', method='GET', uri='/hub/user/max/', version='HTTP/1.1', remote_ip='::ffff:172.19.0.1')
    Traceback (most recent call last):
      File "/opt/conda/lib/python3.6/site-packages/tornado/web.py", line 1592, in _execute
        result = yield result
      File "/opt/conda/lib/python3.6/site-packages/jupyterhub/handlers/base.py", line 1052, in get
        await self.spawn_single_user(user)
      File "/opt/conda/lib/python3.6/site-packages/jupyterhub/handlers/base.py", line 705, in spawn_single_user
        timedelta(seconds=self.slow_spawn_timeout), finish_spawn_future
      File "/opt/conda/lib/python3.6/site-packages/jupyterhub/handlers/base.py", line 626, in finish_user_spawn
        await spawn_future
      File "/opt/conda/lib/python3.6/site-packages/jupyterhub/user.py", line 489, in spawn
        raise e
      File "/opt/conda/lib/python3.6/site-packages/jupyterhub/user.py", line 409, in spawn
        url = await gen.with_timeout(timedelta(seconds=spawner.start_timeout), f)
      File "/opt/conda/lib/python3.6/site-packages/dockerspawner/dockerspawner.py", line 984, in start
        obj = yield self.create_object()
      File "/opt/conda/lib/python3.6/site-packages/dockerspawner/dockerspawner.py", line 852, in create_object
        command=(yield self.get_command()),
      File "/opt/conda/lib/python3.6/site-packages/dockerspawner/dockerspawner.py", line 812, in get_command
        return cmd + self.get_args()
      File "/opt/conda/lib/python3.6/site-packages/dockerspawner/dockerspawner.py", line 726, in get_args
        args = super().get_args()
      File "/opt/conda/lib/python3.6/site-packages/jupyterhub/spawner.py", line 700, in get_args
        notebook_dir = self.format_string(self.notebook_dir)
      File "/opt/conda/lib/python3.6/site-packages/jupyterhub/spawner.py", line 681, in format_string
        return s.format(**self.template_namespace())
    TypeError: 'dict' object is not callable
    
[E 2019-03-15 15:18:30.298 JupyterHub log:150] {
      "X-Forwarded-Host": "10.20.63.207:8000",
      "X-Forwarded-Proto": "http",
      "X-Forwarded-Port": "8000",
      "X-Forwarded-For": "::ffff:172.19.0.1",
      "Cookie": "jupyterhub-hub-login=\"2|1:0|10:1552593619|20:jupyterhub-hub-login|44:Y2ZhNTZmY2RmY2M1NGM5ZDg4ZWViMmVhYjlhODEwZGY=|d0b1f117d749dd1d8ae27fa14b57fb52a75daaf191cf88e761618c9a73b706ba\"; adminer_sid=6444b3f27dbebe956cc88cad2f1032b6; adminer_key=386596ed3d1aa77644d0f1249837a1d8; sharelatex.sid=s%3AVkC_J4hT-8Z1jJXo1YkDWubyH9fFuN40.0RY%2BGpn4IDRzh7FdyaRalijU%2Br6ww%2FlBMA5lFRhHYj8; _xsrf=2|1f6e3ce9|88260ca22fb0bee1d70ba087de2e8f88|1552412343; jupyterhub-session-id=f7ca925e62004847b856f4079eb20eed",
      "Accept-Language": "en-US,en;q=0.9,de;q=0.8,ru;q=0.7,fr;q=0.6,uk;q=0.5",
      "Accept-Encoding": "gzip, deflate",
      "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
      "Dnt": "1",
      "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
      "Upgrade-Insecure-Requests": "1",
      "Cache-Control": "max-age=0",
      "Connection": "close",
      "Host": "10.20.63.207:8000"
    }
[E 2019-03-15 15:18:30.298 JupyterHub log:158] 500 GET /hub/user/max/ (max@::ffff:172.19.0.1) 240.88ms

The log already points to the bug and if I substitute the function call with return s.format(**self.template_namespace) everything works fine. However, the function def template_namespace(self) is indeed a function and not a property, so I'm a bit confused. Am I the only person, which has this issue? Please find attached the files, which I've changed, If You would like to reproduce the situtation.
files.zip

`make build` fails when using Let's Encrypt

The make build target depends on check-files, which looks for the SSL certificate and key. However, when using Let's Encrypt (examples/letsencrypt/), the SSL certificate and key are not stored in the same location because they are brought in via a Docker data volume.

Perhaps check-files should first check for the data volume?

getdocker ca-certificates configuration fail inside main docker

Running make build to build the container for the hub fails during the installation of Docker via the script from https://get.docker.com.

It seems apt-get install -y -q apt-transport-https ca-certificates tries to upgrade and reconfigure the ca-certificates package (I'm not sure why if apt-get update && apt-get upgrade already ran in jupyterhub/jupyterhub . . .). But the dpkg ... --configure ... part can't find the certificates it expects under ./mozilla/

Any help appreciated!

Reading package lists...
+ sh -c sleep 3; apt-get install -y -q apt-transport-https ca-certificates
Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
  apt-transport-https
The following packages will be upgraded:
  ca-certificates
1 upgraded, 1 newly installed, 0 to remove and 28 not upgraded.
Need to get 344 kB of archives.
After this operation, 281 kB of additional disk space will be used.
Get:1 http://cdn-fastly.deb.debian.org/debian/ jessie/main apt-transport-https amd64 1.0.9.8.4 [138 kB]
Get:2 http://cdn-fastly.deb.debian.org/debian/ jessie/main ca-certificates all 20141019+deb8u2 [207 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 344 kB in 0s (7254 kB/s)
Selecting previously unselected package apt-transport-https.
(Reading database ... 11146 files and directories currently installed.)
Preparing to unpack .../apt-transport-https_1.0.9.8.4_amd64.deb ...
Unpacking apt-transport-https (1.0.9.8.4) ...
Preparing to unpack .../ca-certificates_20141019+deb8u2_all.deb ...
Unpacking ca-certificates (20141019+deb8u2) over (20141019+deb8u1) ...
Setting up apt-transport-https (1.0.9.8.4) ...
Setting up ca-certificates (20141019+deb8u2) ...
find: `./mozilla/NetLock_Notary_=Class_A=_Root.crt': No such file or directory
find: `./mozilla/Verisign_Class_1_Public_Primary_Certification_Authority_-_G2.crt': No such file or directory
find: `./mozilla/NetLock_Express_=Class_C=_Root.crt': No such file or directory
find: `./mozilla/CA_Disig.crt': No such file or directory
find: `./mozilla/Verisign_Class_3_Public_Primary_Certification_Authority_2.crt': No such file or directory
find: `./mozilla/Staat_der_Nederlanden_Root_CA.crt': No such file or directory
find: `./mozilla/Verisign_Class_3_Public_Primary_Certification_Authority_-_G2.crt': No such file or directory
find: `./mozilla/NetLock_Qualified_=Class_QA=_Root.crt': No such file or directory
find: `./mozilla/Sonera_Class_1_Root_CA.crt': No such file or directory
find: `./mozilla/NetLock_Business_=Class_B=_Root.crt': No such file or directory
mv: cannot move ‘/etc/ca-certificates.conf’ to a subdirectory of itself, ‘/etc/ca-certificates.conf.dpkg-old’
dpkg: error processing package ca-certificates (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 ca-certificates
E: Sub-process /usr/bin/dpkg returned an error code (1)
ERROR: Service 'hub' failed to build: The command '/bin/sh -c wget https://get.docker.com -q -O /tmp/getdocker &&     chmod +x /tmp/getdocker &&     sh /tmp/getdocker' returned a non-zero code: 100
make: *** [Makefile:47: build] Error 1 

Login succeed then redirect, redirect, redirect... Finally page isn't redirecting properly.

Hello,
As I'am trying to install jupyterhub using docker on the same host I've started from your configuration and just modified the authenticator to be LDAPAuthenticator.
After login, I get the 'Start Server' page but after clicking on the start button firefox displays 'the page isn't redirecting properly'.

Here the logs of the jupyterhub:

Starting jupyterhub ...
Starting jupyterhub ... done
Attaching to jupyterhub
jupyterhub | [I 2017-05-16 08:08:17.071 JupyterHub app:750] Loading cookie_secret from /data/jupyterhub_cookie_secret
jupyterhub | [W 2017-05-16 08:08:17.144 JupyterHub app:376]
jupyterhub |     Generating CONFIGPROXY_AUTH_TOKEN. Restarting the Hub will require restarting the proxy.
jupyterhub |     Set CONFIGPROXY_AUTH_TOKEN env or JupyterHub.proxy_auth_token config to avoid this message.
jupyterhub |
jupyterhub | [W 2017-05-16 08:08:17.156 JupyterHub app:908] No admin users, admin interface will be unavailable.
jupyterhub | [W 2017-05-16 08:08:17.156 JupyterHub app:909] Add any administrative users to `c.Authenticator.admin_users` in config.
jupyterhub | [I 2017-05-16 08:08:17.156 JupyterHub app:936] Not using whitelist. Any authenticated user will be allowed.
jupyterhub | [I 2017-05-16 08:08:17.190 JupyterHub dockerspawner:360] Container 'jupyter-rlafage' is gone
jupyterhub | [W 2017-05-16 08:08:17.191 JupyterHub dockerspawner:331] container not found
jupyterhub | [I 2017-05-16 08:08:17.212 JupyterHub app:1536] Hub API listening on http://jupyterhub:8080/hub/
jupyterhub | [I 2017-05-16 08:08:17.219 JupyterHub app:1255] Starting proxy @ http://*:443/
jupyterhub | 08:08:17.556 - info: [ConfigProxy] Proxying https://*:443 to http://jupyterhub:8080
jupyterhub | 08:08:17.561 - info: [ConfigProxy] Proxy API at http://127.0.0.1:444/api/routes
jupyterhub | [I 2017-05-16 08:08:17.631 JupyterHub app:1592] JupyterHub is now running at http://127.0.0.1:443/
jupyterhub | [I 2017-05-16 08:08:25.977 JupyterHub log:100] 302 GET / (@::ffff:134.212.26.254) 2.09ms
jupyterhub | [I 2017-05-16 08:08:26.160 JupyterHub log:100] 302 GET /hub (@::ffff:134.212.26.254) 0.76ms
jupyterhub | [I 2017-05-16 08:08:26.190 JupyterHub log:100] 302 GET /hub/ (rlafage@::ffff:134.212.26.254) 5.60ms
jupyterhub | [I 2017-05-16 08:08:26.251 JupyterHub log:100] 200 GET /hub/home (rlafage@::ffff:134.212.26.254) 52.45ms
jupyterhub | [I 2017-05-16 08:08:31.128 JupyterHub log:100] 302 GET /spawn?next=%2Fhub%2Fhome (@::ffff:134.212.26.254) 2.98ms
jupyterhub | [I 2017-05-16 08:08:31.148 JupyterHub log:100] 302 GET /hub/spawn?next=%2Fhub%2Fhome (rlafage@::ffff:134.212.26.254) 6.86ms
jupyterhub | [I 2017-05-16 08:08:31.155 JupyterHub log:100] 302 GET /user/rlafage (@::ffff:134.212.26.254) 1.32ms
jupyterhub | [I 2017-05-16 08:08:31.173 JupyterHub dockerspawner:360] Container 'jupyter-rlafage' is gone
jupyterhub | [W 2017-05-16 08:08:31.173 JupyterHub dockerspawner:331] container not found
jupyterhub | [I 2017-05-16 08:08:31.584 JupyterHub dockerspawner:360] Container 'jupyter-rlafage' is gone
jupyterhub | [I 2017-05-16 08:08:31.819 JupyterHub dockerspawner:433] Created container 'jupyter-rlafage' (id: 4d09164) from image jupyterhub/singleuser:latest
jupyterhub | [I 2017-05-16 08:08:31.819 JupyterHub dockerspawner:450] Starting container 'jupyter-rlafage' (id: 4d09164)
jupyterhub | [I 2017-05-16 08:08:34.590 JupyterHub base:341] User rlafage server took 3.417 seconds to start
jupyterhub | [I 2017-05-16 08:08:34.590 JupyterHub orm:198] Adding user rlafage to proxy /user/rlafage => http://172.18.0.3:8888
jupyterhub | [I 2017-05-16 08:08:34.617 JupyterHub log:100] 302 GET /hub/user/rlafage (rlafage@::ffff:134.212.26.254) 3448.68ms
jupyterhub | [W 2017-05-16 08:08:34.649 JupyterHub pages:42] Redirecting /hub/?next=%2Fuser%2Frlafage%2Ftree%3F to /hub/user/rlafage/tree?. For sharing public links, use /user-redirect/
jupyterhub | [I 2017-05-16 08:08:34.657 JupyterHub log:100] 302 GET /hub/?next=%2Fuser%2Frlafage%2Ftree%3F (rlafage@::ffff:134.212.26.254) 2.14ms
jupyterhub | [I 2017-05-16 08:08:34.684 JupyterHub log:100] 302 GET /hub/user/rlafage/tree? (rlafage@::ffff:134.212.26.254) 15.89ms
jupyterhub | [W 2017-05-16 08:08:34.692 JupyterHub pages:42] Redirecting /hub/?next=%2Fuser%2Frlafage%2Ftree%3F to /hub/user/rlafage/tree?. For sharing public links, use /user-redirect/
jupyterhub | [I 2017-05-16 08:08:34.701 JupyterHub log:100] 302 GET /hub/?next=%2Fuser%2Frlafage%2Ftree%3F (rlafage@::ffff:134.212.26.254) 2.05ms
jupyterhub | [I 2017-05-16 08:08:34.730 JupyterHub log:100] 302 GET /hub/user/rlafage/tree? (rlafage@::ffff:134.212.26.254) 15.56ms
jupyterhub | [W 2017-05-16 08:08:34.735 JupyterHub pages:42] Redirecting /hub/?next=%2Fuser%2Frlafage%2Ftree%3F to /hub/user/rlafage/tree?. For sharing public links, use /user-redirect/
jupyterhub | [I 2017-05-16 08:08:34.743 JupyterHub log:100] 302 GET /hub/?next=%2Fuser%2Frlafage%2Ftree%3F (rlafage@::ffff:134.212.26.254) 1.74ms
jupyterhub | [I 2017-05-16 08:08:34.772 JupyterHub log:100] 302 GET /hub/user/rlafage/tree? (rlafage@::ffff:134.212.26.254) 15.15ms
jupyterhub | [W 2017-05-16 08:08:34.793 JupyterHub pages:42] Redirecting /hub/?next=%2Fuser%2Frlafage%2Ftree%3F to /hub/user/rlafage/tree?. For sharing public links, use /user-redirect/
jupyterhub | [I 2017-05-16 08:08:34.802 JupyterHub log:100] 302 GET /hub/?next=%2Fuser%2Frlafage%2Ftree%3F (rlafage@::ffff:134.212.26.254) 1.90ms
jupyterhub | [I 2017-05-16 08:08:34.828 JupyterHub log:100] 302 GET /hub/user/rlafage/tree? (rlafage@::ffff:134.212.26.254) 15.32ms
jupyterhub | [W 2017-05-16 08:08:34.838 JupyterHub pages:42] Redirecting /hub/?next=%2Fuser%2Frlafage%2Ftree%3F to /hub/user/rlafage/tree?. For sharing public links, use /user-redirect/
jupyterhub | [I 2017-05-16 08:08:34.847 JupyterHub log:100] 302 GET /hub/?next=%2Fuser%2Frlafage%2Ftree%3F (rlafage@::ffff:134.212.26.254) 2.04ms
jupyterhub | [I 2017-05-16 08:08:34.874 JupyterHub log:100] 302 GET /hub/user/rlafage/tree? (rlafage@::ffff:134.212.26.254) 16.10ms

and here the logs of the jupyter/singleuser:

[rlafage@rdri206h jupyterhub-deploy-docker] docker logs jupyter-rlafage
[W 2017-05-16 08:08:34.398 rlafage configurable:168] Config option `open_browser` not recognized by `SingleUserNotebookApp`.  Did you mean `browser`?
[I 2017-05-16 08:08:34.411 rlafage notebookapp:592] Writing notebook server cookie secret to /home/jovyan/.local/share/jupyter/runtime/notebook_cookie_secret
[W 2017-05-16 08:08:34.500 rlafage login:225] All authentication is disabled.  Anyone who can connect to this server will be able to run code.
[I 2017-05-16 08:08:34.522 rlafage extension:193] JupyterLab alpha preview extension loaded from /opt/conda/lib/python3.5/site-packages/jupyterlab
[I 2017-05-16 08:08:34.533 rlafage notebookapp:1366] Serving notebooks from local directory: /home/jovyan/work
[I 2017-05-16 08:08:34.534 rlafage notebookapp:1366] 0 active kernels
[I 2017-05-16 08:08:34.534 rlafage notebookapp:1366] The Jupyter Notebook is running at: http://0.0.0.0:8888/user/rlafage/
[I 2017-05-16 08:08:34.534 rlafage notebookapp:1367] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[I 2017-05-16 08:08:34.588 rlafage log:47] 302 GET /user/rlafage (172.18.0.2) 1.22ms
[I 2017-05-16 08:08:34.622 rlafage log:47] 302 GET /user/rlafage (::ffff:134.212.26.254) 0.71ms
[I 2017-05-16 08:08:34.639 rlafage log:47] 302 GET /user/rlafage/tree? (::ffff:134.212.26.254) 1.08ms
[I 2017-05-16 08:08:34.685 rlafage log:47] 302 GET /user/rlafage/tree? (::ffff:134.212.26.254) 1.11ms
[I 2017-05-16 08:08:34.725 rlafage log:47] 302 GET /user/rlafage/tree? (::ffff:134.212.26.254) 1.11ms
[I 2017-05-16 08:08:34.769 rlafage log:47] 302 GET /user/rlafage/tree? (::ffff:134.212.26.254) 1.14ms
[I 2017-05-16 08:08:34.829 rlafage log:47] 302 GET /user/rlafage/tree? (::ffff:134.212.26.254) 1.35ms
[I 2017-05-16 08:08:34.870 rlafage log:47] 302 GET /user/rlafage/tree? (::ffff:134.212.26.254) 1.19ms

I found that related issue jupyterhub #742 and tried various configuration changes without success.

Please, could you give me a hint? What could I check to make it through this?
Thanks in advance.

Files and more

Hello
I have setup jupyter-deploy-docker and it works so far.
Now I want to work with data-sets. Every user who has access to the notebook should also be able to read the data. Since the data can have a size of 5-100 GB, I dont want to copy the data in the container. Files with exercises for that data should be copied an be readable and writeable in the container for the users.
Is there a build in solution for that using a docker deployment?

Some help ref which token to pass for accessing Notebook API running inside JuptyerHub/JupyterLab

I'm running v 5.0.0-dev of the notebook with v 0.9.1 of JupyterLab, which is running with v. 0.7b1 of JupyterHub and deployed using this jupyterhub-deploy-docker approach.

I can access / interact with the JupyterHub API fine using the token I set in jupyterhub_config.py

image

# Tokens for API
c.JupyterHub.api_tokens = {
    'testuser-token': 'testuser'
}

However, it's not clear to me if I should then be changing to use an alternative token to interact with the Notebook API, as suggested here.

This is from the logs of a new user server for 'testuser':

[W 2016-11-30 10:21:12.685 testuser configurable:168] Config option `open_browser` not recognized by `SingleUserNotebookApp`.  Did you mean `browser`?
[I 2016-11-30 10:21:12.694 testuser notebookapp:157] It looks like you're running the notebook from source.
    If you're working on the Javascript of the notebook, try running
    
        npm run build:watch
    
    in another terminal window to have the system incrementally
    watch and build the notebook's JavaScript for you, as you make changes.
    
[I 2016-11-30 10:21:12.703 testuser notebookapp:568] Writing notebook server cookie secret to /home/jovyan/.local/share/jupyter/runtime/notebook_cookie_secret
[I 2016-11-30 10:21:13.429 testuser __init__:153] JupyterLab alpha preview extension loaded from /opt/conda/lib/python3.5/site-packages/jupyterlab
[I 2016-11-30 10:21:13.436 testuser notebookapp:1295] Serving notebooks from local directory: /home/jovyan/work
[I 2016-11-30 10:21:13.436 testuser notebookapp:1295] 0 active kernels 
[I 2016-11-30 10:21:13.437 testuser notebookapp:1295] The Jupyter Notebook is running at: http://0.0.0.0:8888/user/testuser/?token=e6a13fb0b342a6d376eee15fa7cbca402527029a092dac7c
[I 2016-11-30 10:21:13.437 testuser notebookapp:1296] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

Should I be using this 'long' token for interactions with the Notebook API?
like Authoritization: token e6a13fb0b342a6d376eee15fa7cbca402527029a092dac7c

I haven't been able to get that to work.
I was using a gitlabAuthenticator without problems, but it seems this is presenting itself in the returned body of the API call ...

image

I notice in the logs of the spawned server this:

[W 2016-11-30 12:21:26.879 testuser handlers:299] Blocking Cross Origin API request.  Origin: chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop, Host: jupyterhub.xxxxxx.com

should I be including some c.NotebookApp.allow_origin = '*' setting in the jupyterhub_config.py file?

And finally, in the Notebook API contents endpoint, do I need to explicitly enter the '{path}' as user/jovyan/work ... or is only required for files/folders from that base address ...

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.