Skip to content

Commit fa619bd

Browse files
authored
Merge pull request #121 from mathbunnyru/asalikhov/more_cleanup
Cleanup some code and improve REAMDE
2 parents 10dfa8d + cdd845a commit fa619bd

File tree

6 files changed

+30
-32
lines changed

6 files changed

+30
-32
lines changed

.github/workflows/test.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This is a GitHub workflow defining a set of jobs with a set of steps.
2-
# ref: https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions
2+
# ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
33
#
44
name: Tests
55

@@ -15,14 +15,15 @@ jobs:
1515
# https://github.com/pre-commit/action
1616
pre-commit:
1717
name: Lint
18-
runs-on: ubuntu-latest
18+
runs-on: ubuntu-22.04
1919
steps:
2020
- uses: actions/checkout@v3
2121
- uses: actions/setup-python@v4
2222
- uses: pre-commit/action@v3.0.0
2323

2424
# Run tests
2525
test:
26+
name: Test
2627
runs-on: ubuntu-22.04
2728
timeout-minutes: 10
2829
strategy:
@@ -47,11 +48,9 @@ jobs:
4748
run: cat ci/config_token.py >> ${{ matrix.example }}/jupyterhub_config.py
4849

4950
- name: Run JupyterHub
50-
run: |
51-
cd ${{ matrix.example }}
52-
docker-compose up -d
51+
working-directory: ${{ matrix.example }}
52+
run: docker-compose up --detach
5353

5454
- name: Test
55-
run: |
56-
cd ${{ matrix.example }}
57-
pytest -vs
55+
working-directory: ${{ matrix.example }}
56+
run: pytest --verbose --capture=no

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# jupyterhub-deploy-docker
22

33
**jupyterhub-deploy-docker** provides a reference
4-
deployment of [JupyterHub](https://github.com/jupyter/jupyterhub), a
5-
multi-user [Jupyter Notebook](http://jupyter.org/) environment, on a
4+
deployment of [JupyterHub](https://github.com/jupyterhub/jupyterhub), a
5+
multi-user [Jupyter Notebook](https://jupyter.org) environment, on a
66
**single host** using [Docker](https://docs.docker.com).
77

88
Possible **use cases** include:
99

1010
- Creating a JupyterHub demo environment that you can spin up relatively
1111
quickly.
1212
- Providing a multi-user Jupyter Notebook environment for small classes,
13-
teams, or departments.
13+
teams or departments.
1414

1515
## Disclaimer
1616

@@ -27,13 +27,13 @@ project.
2727

2828
Key components of this reference deployment are:
2929

30-
- **Host**: Runs the [JupyterHub components](https://jupyterhub.readthedocs.org/en/latest/getting-started.html#overview)
30+
- **Host**: Runs the [JupyterHub components](https://jupyterhub.readthedocs.io/en/stable/reference/technical-overview.html)
3131
in a Docker container on the host.
3232

3333
- **Authenticator**: Uses [Native Authenticator](https://github.com/jupyterhub/nativeauthenticator) to authenticate users.
34-
Any user will be allowed to sign-up
34+
Any user will be allowed to sign up.
3535

36-
- **Spawner**:Uses [DockerSpawner](https://github.com/jupyter/dockerspawner)
36+
- **Spawner**:Uses [DockerSpawner](https://github.com/jupyterhub/dockerspawner)
3737
to spawn single-user Jupyter Notebook servers in separate Docker
3838
containers on the same host.
3939

@@ -49,14 +49,14 @@ Key components of this reference deployment are:
4949

5050
This deployment uses Docker, via [Docker Compose](https://docs.docker.com/compose/), for all the things.
5151

52-
1. Use [Docker's installation instructions](https://docs.docker.com/engine/installation/)
52+
1. Use [Docker's installation instructions](https://docs.docker.com/engine/install/)
5353
to set up Docker for your environment.
5454

5555
## Authenticator setup
5656

5757
This deployment uses [JupyterHub Native Authenticator](https://native-authenticator.readthedocs.io/en/latest/) to authenticate users.
5858

59-
1. An single `admin` user will be enabled be default. Any user will be allowed to signup.
59+
1. An single `admin` user will be enabled by default. Any user will be allowed to sign up.
6060

6161
## Build the JupyterHub Docker image
6262

@@ -79,20 +79,20 @@ To specify which Notebook image to spawn for users, you set the value of the
7979
Whether you build a custom Notebook image or pull an image from a public or
8080
private Docker registry, the image must reside on the host.
8181

82-
If the Notebook image does not exist on host, Docker will attempt to pull the
82+
If the Notebook image does not exist on the host, Docker will attempt to pull the
8383
image the first time a user attempts to start his or her server. In such cases,
8484
JupyterHub may timeout if the image being pulled is large, so it is better to
8585
pull the image to the host before running JupyterHub.
8686

8787
This deployment defaults to the
88-
[jupyter/minimal-notebook](https://hub.docker.com/r/jupyter/minimal-notebook/)
89-
Notebook image, which is built from the `minimal-notebook`
88+
[jupyter/base-notebook](https://hub.docker.com/r/jupyter/base-notebook/)
89+
Notebook image, which is built from the `base-notebook`
9090
[Docker stacks](https://github.com/jupyter/docker-stacks).
9191

9292
You can pull the image using the following command:
9393

9494
```bash
95-
docker pull jupyter/minimal-notebook:latest
95+
docker pull jupyter/base-notebook:latest
9696
```
9797

9898
## Run JupyterHub
@@ -142,7 +142,7 @@ c.DockerSpawner.image = os.environ['DOCKER_NOTEBOOK_IMAGE']
142142

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

145-
Yes. JupyterHub reads its configuration which includes the container image
145+
Yes. JupyterHub reads its configuration, which includes the container image
146146
name for DockerSpawner. JupyterHub uses this configuration to determine the
147147
Notebook server image to spawn during startup.
148148

@@ -156,9 +156,9 @@ again to their individual notebook servers. However, users may need to
156156
refresh their browser to re-establish connections to the running Notebook
157157
kernels.
158158

159-
### How can I backup a user's notebook directory?
159+
### How can I back up a user's notebook directory?
160160

161-
There are multiple ways to [backup and restore](https://docs.docker.com/engine/userguide/containers/dockervolumes/#backup-restore-or-migrate-data-volumes) data in Docker containers.
161+
There are multiple ways to [Back up and restore data](https://docs.docker.com/desktop/backup-and-restore/) in Docker containers.
162162

163163
Suppose you have the following running containers:
164164

@@ -178,7 +178,7 @@ In this deployment, the user's notebook directories (`/home/jovyan/work`) are ba
178178
[{jtyberg /var/lib/docker/volumes/jtyberg/_data /home/jovyan/work local rw true rprivate}]
179179
```
180180

181-
We can backup the user's notebook directory by running a separate container that mounts the user's volume and creates a tarball of the directory.
181+
We can back up the user's notebook directory by running a separate container that mounts the user's volume and creates a tarball of the directory.
182182

183183
```bash
184184
docker run --rm \

basic-example/Dockerfile.jupyterhub

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ ARG JUPYTERHUB_VERSION
44
FROM jupyterhub/jupyterhub:$JUPYTERHUB_VERSION
55

66
# Install dockerspawner, nativeauthenticator
7+
# hadolint ignore=DL3013
78
RUN python3 -m pip install --no-cache-dir \
8-
dockerspawner==12.* \
9-
jupyterhub-nativeauthenticator==1.*
9+
dockerspawner \
10+
jupyterhub-nativeauthenticator
1011

11-
COPY ./jupyterhub_config.py /srv/jupyterhub/jupyterhub_config.py
1212
CMD ["jupyterhub", "-f", "/srv/jupyterhub/jupyterhub_config.py"]

basic-example/docker-compose.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,11 @@ services:
3232
# All containers will join this network
3333
DOCKER_NETWORK_NAME: jupyterhub-network
3434
# JupyterHub will spawn this Notebook image for users
35-
DOCKER_NOTEBOOK_IMAGE: jupyter/minimal-notebook:latest
35+
DOCKER_NOTEBOOK_IMAGE: jupyter/base-notebook:latest
3636
# Notebook directory inside user image
3737
DOCKER_NOTEBOOK_DIR: /home/jovyan/work
3838
# Using this run command
3939
DOCKER_SPAWN_CMD: start-singleuser.sh
40-
command: >
41-
jupyterhub -f /srv/jupyterhub/jupyterhub_config.py
4240

4341
volumes:
4442
jupyterhub-data:

basic-example/jupyterhub_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030
c.DockerSpawner.network_name = network_name
3131

3232
# Explicitly set notebook directory because we'll be mounting a volume to it.
33-
# Most jupyter/docker-stacks *-notebook images run the Notebook server as
33+
# Most `jupyter/docker-stacks` *-notebook images run the Notebook server as
3434
# user `jovyan`, and set the notebook directory to `/home/jovyan/work`.
3535
# We follow the same convention.
36-
notebook_dir = os.environ.get("DOCKER_NOTEBOOK_DIR") or "/home/jovyan/work"
36+
notebook_dir = os.environ.get("DOCKER_NOTEBOOK_DIR", "/home/jovyan/work")
3737
c.DockerSpawner.notebook_dir = notebook_dir
3838

3939
# Mount the real user's Docker volume on the host to the notebook user's

ci/check_hub.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ while [ $count -lt 60 ]; do
1313
printf .
1414
count=$((count+1))
1515
done
16+
1617
if [ $started -eq 0 ]; then
1718
echo "*****"
1819
echo "JupyterHub did not start"

0 commit comments

Comments
 (0)