Skip to content

Commit dd964ad

Browse files
committed
Edit letsencrypt example README
1 parent ccd512c commit dd964ad

File tree

2 files changed

+94
-71
lines changed

2 files changed

+94
-71
lines changed

README.md

Lines changed: 66 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ deployment of [JupyterHub](https://github.com/jupyter/jupyterhub), a
1414
multi-user [Jupyter Notebook](http://jupyter.org/) environment, on a
1515
**single host** using [Docker](https://docs.docker.com).
1616

17-
Possible **use cases** include, but are not limited to:
17+
Possible **use cases** include:
1818

1919
* Creating a JupyterHub demo environment that you can spin up relatively
2020
quickly.
@@ -31,18 +31,18 @@ Key components of this reference deployment are:
3131

3232
* **Host**: Runs the [JupyterHub components](https://jupyterhub.readthedocs.org/en/latest/getting-started.html#overview)
3333
in a Docker container on the host.
34-
34+
3535
* **Authenticator**: Uses [OAuthenticator](https://github.com/jupyter/oauthenticator)
3636
and [GitHub OAuth](https://developer.github.com/v3/oauth/) to
3737
authenticate users.
38-
39-
* **Spawner**:Uses [DockerSpawner](https://github.com/jupyter/dockerspawner)
38+
39+
* **Spawner**:Uses [DockerSpawner](https://github.com/jupyter/dockerspawner)
4040
to spawn single-user Jupyter Notebook servers in separate Docker
4141
containers on the same host.
42-
42+
4343
* **Persistence of Hub data**: Persists JupyterHub data in a Docker
4444
volume on the host.
45-
45+
4646
* **Persistence of user notebook directories**: Persists user notebook
4747
directories in Docker volumes on the host.
4848

@@ -53,47 +53,47 @@ Key components of this reference deployment are:
5353

5454
### Docker
5555

56-
This deployment uses Docker for all the things, via [Docker Compose](https://docs.docker.com/compose/overview/).
56+
This deployment uses Docker, via [Docker Compose](https://docs.docker.com/compose/overview/), for all the things.
5757
[Docker Engine](https://docs.docker.com/engine) 1.12.0 or higher is
58-
required. Use [Docker's installation instructions](https://docs.docker.com/engine/installation/)
59-
to set up Docker for your environment.
60-
61-
To verify your docker installation, whether running docker as a local installation or using [docker-machine](./docs/docker-machine.md),
62-
enter these commands:
58+
required.
6359

64-
```bash
65-
docker version
66-
docker ps
67-
```
60+
1. Use [Docker's installation instructions](https://docs.docker.com/engine/installation/)
61+
to set up Docker for your environment.
6862

63+
2. To verify your docker installation, whether running docker as a local
64+
installation or using [docker-machine](./docs/docker-machine.md),
65+
enter these commands:
6966

67+
```bash
68+
docker version
69+
docker ps
70+
```
7071

7172
### HTTPS and SSL/TLS certificate
7273

73-
This deployment configures JupyterHub to use HTTPS connections (the
74-
default). You must provide TLS certificate chain and key file in the
75-
JupyterHub configuration.
74+
This deployment configures JupyterHub to use HTTPS. You must provide a
75+
certificate and key file in the JupyterHub configuration. To configure:
7676

7777
1. Obtain the domain name that you wish to use for JupyterHub, for
7878
example, `myfavoritesite.com` or `jupiterplanet.org`.
7979

80-
1. If you do not have an existing certificate chain and key, you can
81-
[create self-signed versions](https://jupyter-notebook.readthedocs.org/en/latest/public_server.html#using-ssl-for-encrypted-communication),
82-
or obtain real ones from [Let's Encrypt](https://letsencrypt.org)
83-
(see the [letsencrypt example](examples/letsencrypt/README.md) for
84-
instructions).
80+
1. If you do not have an existing certificate and key, you can:
8581

86-
1. Copy the certificate chain and key files for the JupyterHub server
87-
to a directory named `secrets` within this repository directory.
88-
These will be added to the JupyterHub Docker image at build time. For
89-
example, create a `secrets` directory in the root of this repo and
90-
copy the certificate and key files (`jupyterhub.crt` and `jupyterhub.key`)
91-
to this directory:
82+
- obtain one from [Let's Encrypt](https://letsencrypt.org) using
83+
the [certbot](https://certbot.eff.org) client,
84+
- use the helper script in this repo's [letsencrypt example](examples/letsencrypt/README.md), or
85+
- [create a self-signed certificate](https://jupyter-notebook.readthedocs.org/en/latest/public_server.html#using-ssl-for-encrypted-communication).
9286

93-
```bash
94-
mkdir -p secrets
95-
cp jupyterhub.crt jupyterhub.key secrets/
96-
```
87+
1. Copy the certificate and key files to a
88+
directory named `secrets` in this repository's root directory. These will be
89+
added to the JupyterHub Docker image at build time. For example, create a
90+
`secrets` directory in the root of this repo and copy the certificate and
91+
key files (`jupyterhub.crt` and `jupyterhub.key`) to this directory:
92+
93+
```bash
94+
mkdir -p secrets
95+
cp jupyterhub.crt jupyterhub.key secrets/
96+
```
9797

9898

9999
## Authenticator setup
@@ -106,30 +106,28 @@ by filling out a form on the GitHub site:
106106
![GitHub OAuth application form](docs/oauth-form.png)
107107

108108
In this form, you will specify the OAuth application's callback URL in
109-
this format:
109+
this format: `https://<myhost.mydomain>/hub/oauth_callback`.
110110

111-
```
112-
https://<myhost.mydomain>/hub/oauth_callback
113-
```
114-
115-
After submitting the GitHub form, your registered GitHub OAuth
116-
application is assigned a unique Client ID and Client Secret. The
117-
Client Secret should be kept private.
111+
After submitting the GitHub form, your registered GitHub OAuth application is
112+
assigned a unique Client ID and Client Secret. The Client Secret should be
113+
kept private.
118114

119-
You must pass the GitHub OAuth Client ID, Client Secret and OAuth
120-
callback url to JupyterHub at runtime. You can do this by either:
115+
You must pass the GitHub OAuth Client ID, Client Secret and OAuth callback url
116+
to JupyterHub at runtime. You can do this by either:
121117

122118
- setting the `GITHUB_CLIENT_ID`, `GITHUB_CLIENT_SECRET`, and
123-
`OAUTH_CALLBACK_URL` environment variables when you run the
119+
`OAUTH_CALLBACK_URL` environment variables when you run the
124120
JupyterHub container, or
125-
- add them to the `.env` file in the root directory of this repository.
121+
- add them to the `.env` file in the root directory of this repository.
126122
For example, update the following lines in the `.env` file:
127123

128-
**.env**
124+
`.env` file
129125
```
130-
GITHUB_CLIENT_ID=<github_client_id>
131-
GITHUB_CLIENT_SECRET=<github_client_secret>
132-
OAUTH_CALLBACK_URL=https://<myhost.mydomain>/hub/oauth_callback
126+
...
127+
GITHUB_CLIENT_ID=<github_client_id>
128+
GITHUB_CLIENT_SECRET=<github_client_secret>
129+
OAUTH_CALLBACK_URL=https://<myhost.mydomain>/hub/oauth_callback
130+
...
133131
```
134132

135133
**Note:** The `.env` file is a special file that Docker Compose uses
@@ -141,25 +139,30 @@ callback url to JupyterHub at runtime. You can do this by either:
141139

142140
## Build the JupyterHub Docker image
143141

144-
Configure JupyterHub
142+
Configure JupyterHub and build it into a Docker image.
145143

146-
and build it into a Docker image.
144+
1. Create a `userlist` file with a list of authorized users. The list should
145+
contain GitHub usernames, and this file should designate at least one
146+
`admin` user. For instance, this example file contains three users,
147+
`jtyberg`, `jenny`, and `guido`, and one designated administrator,
148+
`jtyberg`:
147149

148-
1. Create a `userlist` file with a list of authorized users. At a minimum, this file should contain a single admin user. The username should be a GitHub username. For example:
149-
150-
**file**
151-
```
150+
`userlist` file
151+
```
152152
jtyberg admin
153-
```
153+
jenny
154+
guido
155+
```
154156

155-
The admin user will have the ability to add more users in the JupyterHub admin console.
157+
The admin user will have the ability to add more users through JupyterHub's
158+
admin console.
156159

157-
1. Use [docker-compose](https://docs.docker.com/compose/reference/) to build the
158-
JupyterHub Docker image on the active Docker machine host:
160+
1. Use [docker-compose](https://docs.docker.com/compose/reference/) to build
161+
the JupyterHub Docker image on the active Docker machine host:
159162

160-
```bash
161-
make build
162-
```
163+
```bash
164+
make build
165+
```
163166

164167

165168
## Spawner: Prepare the Jupyter Notebook Image

examples/letsencrypt/README.md

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
# Let's Encrypt
22

3-
This example includes a Docker Compose configuration file that you can use to deploy [JupyterHub](https://github.com/jupyter/jupyterhub) with TLS certificate and key files generated by [Let's Encrypt](https://letsencrypt.org).
3+
This example includes a Docker Compose configuration file that you can
4+
use to deploy [JupyterHub](https://github.com/jupyter/jupyterhub) with
5+
TLS certificate and key files generated by [Let's Encrypt](https://letsencrypt.org).
46

5-
The `docker-compose.yml` configuration file in this example extends the JupyterHub service defined in the `docker-compose.yml` file in the root directory of this repository.
7+
The `docker-compose.yml` configuration file in this example extends the
8+
JupyterHub service defined in the `docker-compose.yml` file in the root
9+
directory of this repository.
610

7-
When you run the JupyterHub Docker container using the configuration file in this directory, Docker mounts an additional volume containing the Let's Encrypt TLS certificate and key files, and overrides the `SSL_CERT` and `SSL_KEY` environment variables to point to these files.
11+
When you run the JupyterHub Docker container using the configuration
12+
file in this directory, Docker mounts an additional volume containing
13+
the Let's Encrypt TLS certificate and key files, and overrides the
14+
`SSL_CERT` and `SSL_KEY` environment variables to point to these files.
815

916
## Create a secrets volume
1017

11-
This example stores the Let's Encrypt TLS certificate and key files in a Docker volume, and mounts the volume to the JupyterHub container at runtime.
18+
This example stores the Let's Encrypt TLS certificate and key files in
19+
a Docker volume, and mounts the volume to the JupyterHub container at
20+
runtime.
1221

1322
Create a volume to store the certificate and key files.
1423

@@ -21,11 +30,18 @@ docker volume create --name jupyterhub-secrets
2130

2231
## Generate Let's Encrypt certificate and key
2332

24-
Run the `letsencrypt.sh` script to create a TLS full-chain certificate and key.
33+
Run the `letsencrypt.sh` script to create a TLS full-chain certificate
34+
and key.
2535

26-
The script downloads and runs the `letsencrypt` Docker image to create a full-chain certificate and private key, and stores the files in a Docker volume. You must provide a valid, routable, fully-qualified domain name (you must own it), and you must activate the Docker machine host that the domain points to before you run this script. You must also provide a valid email address and the name of the volume you created above.
36+
The script downloads and runs the `letsencrypt` Docker image to create a
37+
full-chain certificate and private key, and stores the files in a Docker
38+
volume. You must provide a valid, routable, fully-qualified domain name (you
39+
must own it), and you must activate the Docker machine host that the domain
40+
points to before you run this script. You must also provide a valid email
41+
address and the name of the volume you created above.
2742

28-
_Notes:_ The script hard codes several `letsencrypt` options, one of which automatically agrees to the Let's Encrypt Terms of Service.
43+
_Notes:_ The script hard codes several `letsencrypt` options, one of which
44+
automatically agrees to the Let's Encrypt Terms of Service.
2945

3046
```
3147
# Activate Docker machine where JupyterHub will run
@@ -39,7 +55,11 @@ eval "$(docker-machine env jupyterhub)"
3955

4056
## Run JupyterHub container
4157

42-
To run the JupyterHub container using the Let's Encrypt certificate and key, set the `SECRETS_VOLUME` environment variable to the name of the Docker volume containing the certificate and key files, and run `docker-compose` **from the root directory** of this repository while specifying the `docker-compose.yml` configuration in this directory:
58+
To run the JupyterHub container using the Let's Encrypt certificate and key,
59+
set the `SECRETS_VOLUME` environment variable to the name of the Docker volume
60+
containing the certificate and key files, and run `docker-compose` **from the
61+
root directory** of this repository while specifying the `docker-compose.yml`
62+
configuration in this directory:
4363

4464
```
4565
export SECRETS_VOLUME=jupyterhub-secrets

0 commit comments

Comments
 (0)