Skip to content

Commit a4f2bd9

Browse files
committed
Update README
1 parent 620d6f7 commit a4f2bd9

File tree

1 file changed

+11
-159
lines changed

1 file changed

+11
-159
lines changed

README.md

Lines changed: 11 additions & 159 deletions
Original file line numberDiff line numberDiff line change
@@ -52,137 +52,42 @@ Key components of this reference deployment are:
5252
* **Persistence of user notebook directories**: Persists user notebook
5353
directories in Docker volumes on the host.
5454

55-
<!-- ![JupyterHub single host Docker deployment](internal/jupyterhub-docker.png) -->
56-
5755

5856
## Prerequisites
5957

6058
### Docker
6159

62-
This deployment uses Docker, via [Docker Compose](https://docs.docker.com/compose/overview/), for all the things.
63-
[Docker Engine](https://docs.docker.com/engine) 1.12.0 or higher is
64-
required.
60+
This deployment uses Docker, via [Docker Compose](https://docs.docker.com/compose/), for all the things.
6561

6662
1. Use [Docker's installation instructions](https://docs.docker.com/engine/installation/)
6763
to set up Docker for your environment.
6864

69-
2. To verify your docker installation, whether running docker as a local
70-
installation or using [docker-machine](./docs/docker-machine.md),
71-
enter these commands:
72-
73-
```bash
74-
docker version
75-
docker ps
76-
```
77-
78-
### HTTPS and SSL/TLS certificate
79-
80-
This deployment configures JupyterHub to use HTTPS. You must provide a
81-
certificate and key file in the JupyterHub configuration. To configure:
82-
83-
1. Obtain the domain name that you wish to use for JupyterHub, for
84-
example, `myfavoritesite.com` or `jupiterplanet.org`.
85-
86-
1. If you do not have an existing certificate and key, you can:
87-
88-
- obtain one from [Let's Encrypt](https://letsencrypt.org) using
89-
the [certbot](https://certbot.eff.org) client,
90-
- use the helper script in this repo's [letsencrypt example](examples/letsencrypt/README.md), or
91-
- [create a self-signed certificate](https://jupyter-notebook.readthedocs.org/en/latest/public_server.html#using-ssl-for-encrypted-communication).
92-
93-
1. Copy the certificate and key files to a
94-
directory named `secrets` in this repository's root directory. These will be
95-
added to the JupyterHub Docker image at build time. For example, create a
96-
`secrets` directory in the root of this repo and copy the certificate and
97-
key files (`jupyterhub.crt` and `jupyterhub.key`) to this directory:
98-
99-
```bash
100-
mkdir -p secrets
101-
cp jupyterhub.crt jupyterhub.key secrets/
102-
```
103-
10465

10566
## Authenticator setup
10667

107-
This deployment uses GitHub OAuth to authenticate users.
108-
109-
It requires that you create and register a [GitHub OAuth application](https://github.com/settings/applications/new)
110-
by filling out a form on the GitHub site:
111-
112-
![GitHub OAuth application form](docs/oauth-form.png)
113-
114-
In this form, you will specify the OAuth application's callback URL in
115-
this format: `https://<myhost.mydomain>/hub/oauth_callback`.
116-
117-
After you submit the GitHub form, GitHub registers your OAuth application and
118-
assigns a unique Client ID and Client Secret. The Client Secret should be
119-
kept private.
120-
121-
At JupyterHub's runtime, you must pass the GitHub OAuth Client ID, Client
122-
Secret and OAuth callback url. You can do this by either:
123-
124-
- setting the `GITHUB_CLIENT_ID`, `GITHUB_CLIENT_SECRET`, and
125-
`OAUTH_CALLBACK_URL` environment variables when you run the
126-
JupyterHub container, or
127-
- add them to an `oauth.env` file in the `secrets` directory of this repository.
128-
You may need to create both the `secrets` directory and the `oauth.env` file.
129-
For example, add the following lines in the `oauth.env` file:
130-
131-
`oauth.env` file
132-
```
133-
GITHUB_CLIENT_ID=<github_client_id>
134-
GITHUB_CLIENT_SECRET=<github_client_secret>
135-
OAUTH_CALLBACK_URL=https://<myhost.mydomain>/hub/oauth_callback
136-
```
137-
138-
**Note:** The `oauth.env` file is a special file that Docker Compose uses
139-
to lookup environment variables. If you choose to place the GitHub
140-
OAuth application settings in this file, you should make sure that the
141-
file remains private (be careful to not commit the `oauth.env` file with
142-
these secrets to source control).
68+
This deployment uses [JupyterHub Native Authenticator](https://native-authenticator.readthedocs.io/en/latest/) to authenticate users.
14369

70+
1. An single `admin` user will be enabled be default.
14471

14572
## Build the JupyterHub Docker image
14673

147-
Finish configuring JupyterHub and then build the hub's Docker image. (We'll
148-
build the Jupyter Notebook image in the next section.)
149-
150-
1. Configure `userlist`: Create a `userlist` file of authorized JupyterHub
151-
users. The list should contain GitHub usernames, and this file should
152-
designate at least one `admin` user. For instance, the example file below
153-
contains three users, `jtyberg`, `jenny`, and `guido`, and one designated
154-
administrator, `jtyberg`:
155-
156-
`userlist` file
157-
```
158-
jtyberg admin
159-
jenny
160-
guido
161-
```
162-
163-
The admin user will have the ability to add more users through JupyterHub's
164-
admin console.
165-
16674
1. Use [docker-compose](https://docs.docker.com/compose/reference/) to build
16775
the JupyterHub Docker image on the active Docker machine host by running
16876
the `make build` command:
16977

17078
```bash
171-
make build
79+
docker-compose build
17280
```
17381

17482

175-
## Spawner: Prepare the Jupyter Notebook Image
83+
## Customisation: Jupyter Notebook Image
17684

17785
You can configure JupyterHub to spawn Notebook servers from any Docker image, as
17886
long as the image's `ENTRYPOINT` and/or `CMD` starts a single-user instance of
17987
Jupyter Notebook server that is compatible with JupyterHub.
18088

18189
To specify which Notebook image to spawn for users, you set the value of the
18290
`DOCKER_NOTEBOOK_IMAGE` environment variable to the desired container image.
183-
You can set this variable in the `.env` file, or alternatively, you can
184-
override the value in this file by setting `DOCKER_NOTEBOOK_IMAGE` in the
185-
environment where you launch JupyterHub.
18691

18792
Whether you build a custom Notebook image or pull an image from a public or
18893
private Docker registry, the image must reside on the host.
@@ -193,20 +98,16 @@ JupyterHub may timeout if the image being pulled is large, so it is better to
19398
pull the image to the host before running JupyterHub.
19499

195100
This deployment defaults to the
196-
[jupyter/scipy-notebook](https://hub.docker.com/r/jupyter/scipy-notebook/)
197-
Notebook image, which is built from the `scipy-notebook`
198-
[Docker stacks](https://github.com/jupyter/docker-stacks). (Note that the Docker
199-
stacks `*-notebook` images tagged `2d878db5cbff` include the
200-
`start-singleuser.sh` script required to start a single-user instance of the
201-
Notebook server that is compatible with JupyterHub).
101+
[jupyter/minimal-notebook](https://hub.docker.com/r/jupyter/minimal-notebook/)
102+
Notebook image, which is built from the `minimal-notebook`
103+
[Docker stacks](https://github.com/jupyter/docker-stacks).
202104

203105
You can pull the image using the following command:
204106

205107
```bash
206-
make notebook_image
108+
docker pull jupyter/minimal-notebook
207109
```
208110

209-
210111
## Run JupyterHub
211112

212113
Run the JupyterHub container on the host.
@@ -219,9 +120,8 @@ docker-compose up -d
219120

220121
Once the container is running, you should be able to access the JupyterHub console at
221122

222-
**file**
223123
```
224-
https://myhost.mydomain
124+
http://localhost:8000
225125
```
226126

227127
To bring down the JupyterHub container:
@@ -232,33 +132,6 @@ docker-compose down
232132

233133
---
234134

235-
## Behind the scenes
236-
237-
`make build` does a few things behind the scenes, to set up the environment for JupyterHub:
238-
239-
### Create a JupyterHub Data Volume
240-
241-
Create a Docker volume to persist JupyterHub data. This volume will reside on the host machine. Using a volume allows user lists, cookies, etc., to persist across JupyterHub container restarts.
242-
243-
```bash
244-
docker volume create --name jupyterhub-data
245-
```
246-
247-
### Create a Docker Network
248-
249-
Create a Docker network for inter-container communication. The benefits of using a Docker network are:
250-
251-
* container isolation - only the containers on the network can access one another
252-
* name resolution - Docker daemon runs an embedded DNS server to provide automatic service discovery for containers connected to user-defined networks. This allows us to access containers on the same network by name.
253-
254-
Here we create a Docker network named `jupyterhub-network`. Later, we will configure the JupyterHub and single-user Jupyter Notebook containers to run attached to this network.
255-
256-
```bash
257-
docker network create jupyterhub-network
258-
```
259-
260-
---
261-
262135
## FAQ
263136

264137
### How can I view the logs for JupyterHub or users' Notebook servers?
@@ -281,28 +154,7 @@ variable:
281154

282155
```python
283156
# DockerSpawner setting in jupyterhub_config.py
284-
c.DockerSpawner.container_image = os.environ['DOCKER_NOTEBOOK_IMAGE']
285-
```
286-
287-
By default, the`DOCKER_NOTEBOOK_IMAGE` environment variable is set in the
288-
`.env` file.
289-
290-
**file**
291-
```
292-
# Setting in the .env file
293-
DOCKER_NOTEBOOK_IMAGE=jupyter/scipy-notebook:2d878db5cbff
294-
```
295-
296-
To use a different notebook server image, you can either change the desired
297-
container image value in the `.env` file, or you can override it
298-
by setting the `DOCKER_NOTEBOOK_IMAGE` variable to a different Notebook
299-
image in the environment where you launch JupyterHub. For example, the
300-
following setting would be used to spawn single-user `pyspark` notebook servers:
301-
302-
```bash
303-
export DOCKER_NOTEBOOK_IMAGE=jupyterhub/pyspark-notebook:2d878db5cbff
304-
305-
docker-compose up -d
157+
c.DockerSpawner.image = os.environ['DOCKER_NOTEBOOK_IMAGE']
306158
```
307159

308160
### If I change the name of the Notebook server image to spawn, do I need to restart JupyterHub?

0 commit comments

Comments
 (0)