Skip to content

Commit bfe5f20

Browse files
authored
Use correct ServerApp options in examples and tests (#1947)
1 parent 75ca54d commit bfe5f20

File tree

10 files changed

+28
-31
lines changed

10 files changed

+28
-31
lines changed

docs/using/common.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ This page describes the options supported by the startup script and how to bypas
1111
You can pass [Jupyter server options](https://jupyter-server.readthedocs.io/en/latest/operators/public-server.html) to the `start-notebook.sh` script when launching the container.
1212

1313
1. For example, to secure the Notebook server with a [custom password](https://jupyter-server.readthedocs.io/en/latest/operators/public-server.html#preparing-a-hashed-password)
14-
hashed using `jupyter_server.auth.security.passwd()` instead of the default token,
14+
hashed using `jupyter_server.auth.passwd()` instead of the default token,
1515
you can run the following (this hash was generated for the `my-password` password):
1616

1717
```bash
1818
docker run -it --rm -p 8888:8888 jupyter/base-notebook \
19-
start-notebook.sh --NotebookApp.password='argon2:$argon2id$v=19$m=10240,t=10,p=8$JdAN3fe9J45NvK/EPuGCvA$O/tbxglbwRpOFuBNTYrymAEH6370Q2z+eS1eF4GM6Do'
19+
start-notebook.sh --PasswordIdentityProvider.hashed_password='argon2:$argon2id$v=19$m=10240,t=10,p=8$JdAN3fe9J45NvK/EPuGCvA$O/tbxglbwRpOFuBNTYrymAEH6370Q2z+eS1eF4GM6Do'
2020
```
2121

2222
2. To set the [base URL](https://jupyter-server.readthedocs.io/en/latest/operators/public-server.html#running-the-notebook-with-a-customized-url-prefix) of the notebook server, you can run the following:
2323

2424
```bash
2525
docker run -it --rm -p 8888:8888 jupyter/base-notebook \
26-
start-notebook.sh --NotebookApp.base_url=/customized/url/prefix/
26+
start-notebook.sh --ServerApp.base_url=/customized/url/prefix/
2727
```
2828

2929
## Docker Options
@@ -148,8 +148,8 @@ docker run -it --rm -p 8888:8888 \
148148
-v /some/host/folder:/etc/ssl/notebook \
149149
jupyter/base-notebook \
150150
start-notebook.sh \
151-
--NotebookApp.keyfile=/etc/ssl/notebook/notebook.key \
152-
--NotebookApp.certfile=/etc/ssl/notebook/notebook.crt
151+
--ServerApp.keyfile=/etc/ssl/notebook/notebook.key \
152+
--ServerApp.certfile=/etc/ssl/notebook/notebook.crt
153153
```
154154

155155
Alternatively, you may mount a single PEM file containing both the key and certificate.
@@ -160,7 +160,7 @@ docker run -it --rm -p 8888:8888 \
160160
-v /some/host/folder/notebook.pem:/etc/ssl/notebook.pem \
161161
jupyter/base-notebook \
162162
start-notebook.sh \
163-
--NotebookApp.certfile=/etc/ssl/notebook.pem
163+
--ServerApp.certfile=/etc/ssl/notebook.pem
164164
```
165165

166166
In either case, Jupyter Notebook expects the key and certificate to be a **base64 encoded text file**.

docs/using/recipes.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -475,15 +475,16 @@ For JupyterLab:
475475
```bash
476476
docker run -it --rm \
477477
jupyter/base-notebook:2023-07-25 \
478-
start.sh jupyter lab --LabApp.token=''
478+
start-notebook.sh --IdentityProvider.token=''
479479
```
480480

481-
For jupyter classic:
481+
For Jupyter Notebook:
482482

483483
```bash
484484
docker run -it --rm \
485+
-e DOCKER_STACKS_JUPYTER_CMD=notebook \
485486
jupyter/base-notebook:2023-07-25 \
486-
start.sh jupyter notebook --NotebookApp.token=''
487+
start-notebook.sh --IdentityProvider.token=''
487488
```
488489

489490
## Enable nbclassic-extension spellchecker for markdown (or any other nbclassic-extension)

examples/docker-compose/notebook/letsencrypt-notebook.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ services:
1919
PASSWORD: ${PASSWORD}
2020
command: >
2121
start-notebook.sh
22-
--NotebookApp.certfile=/etc/letsencrypt/fullchain.pem
23-
--NotebookApp.keyfile=/etc/letsencrypt/privkey.pem
22+
--ServerApp.certfile=/etc/letsencrypt/fullchain.pem
23+
--ServerApp.keyfile=/etc/letsencrypt/privkey.pem
2424
2525
volumes:
2626
work:

examples/make-deploy/letsencrypt.makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ letsencrypt-notebook: DOCKER_ARGS:=-e USE_HTTPS=yes \
5252
-e PASSWORD=$(PASSWORD) \
5353
-v $(SECRETS_VOLUME):/etc/letsencrypt
5454
letsencrypt-notebook: ARGS:=\
55-
--NotebookApp.certfile=/etc/letsencrypt/fullchain.pem \
56-
--NotebookApp.keyfile=/etc/letsencrypt/privkey.pem
55+
--ServerApp.certfile=/etc/letsencrypt/fullchain.pem \
56+
--ServerApp.keyfile=/etc/letsencrypt/privkey.pem
5757
letsencrypt-notebook: check
5858
@test -n "$(PASSWORD)" || \
5959
(echo "ERROR: PASSWORD not defined or blank"; exit 1)

examples/openshift/templates.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
}
3939
},
4040
"data": {
41-
"jupyter_server_config.py": "import os\n\npassword = os.environ.get('JUPYTER_NOTEBOOK_PASSWORD')\n\nif password:\n import notebook.auth\n c.NotebookApp.password = notebook.auth.passwd(password)\n del password\n del os.environ['JUPYTER_NOTEBOOK_PASSWORD']\n\nimage_config_file = '/home/jovyan/.jupyter/jupyter_server_config.py'\n\nif os.path.exists(image_config_file):\n with open(image_config_file) as fp:\n exec(compile(fp.read(), image_config_file, 'exec'), globals())\n"
41+
"jupyter_server_config.py": "import os\n\npassword = os.environ.get('JUPYTER_NOTEBOOK_PASSWORD')\n\nif password:\n from jupyter_server.auth import passwd\n c.ServerApp.password = passwd(password)\n del password\n del os.environ['JUPYTER_NOTEBOOK_PASSWORD']\n\nimage_config_file = '/home/jovyan/.jupyter/jupyter_server_config.py'\n\nif os.path.exists(image_config_file):\n with open(image_config_file) as fp:\n exec(compile(fp.read(), image_config_file, 'exec'), globals())\n"
4242
}
4343
},
4444
{

examples/source-to-image/templates.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@
221221
}
222222
},
223223
"data": {
224-
"jupyter_server_config.py": "import os\n\npassword = os.environ.get('JUPYTER_NOTEBOOK_PASSWORD')\n\nif password:\n import notebook.auth\n c.NotebookApp.password = notebook.auth.passwd(password)\n del password\n del os.environ['JUPYTER_NOTEBOOK_PASSWORD']\n\nimage_config_file = '/home/jovyan/.jupyter/jupyter_server_config.py'\n\nif os.path.exists(image_config_file):\n with open(image_config_file) as fp:\n exec(compile(fp.read(), image_config_file, 'exec'), globals())\n"
224+
"jupyter_server_config.py": "import os\n\npassword = os.environ.get('JUPYTER_NOTEBOOK_PASSWORD')\n\nif password:\n from jupyter_server.auth import passwd\n c.ServerApp.password = passwd(password)\n del password\n del os.environ['JUPYTER_NOTEBOOK_PASSWORD']\n\nimage_config_file = '/home/jovyan/.jupyter/jupyter_server_config.py'\n\nif os.path.exists(image_config_file):\n with open(image_config_file) as fp:\n exec(compile(fp.read(), image_config_file, 'exec'), globals())\n"
225225
}
226226
},
227227
{

tests/base-notebook/test_container_options.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def test_cli_args(container: TrackedContainer, http_client: requests.Session) ->
1616
(e.g., disabling token security)"""
1717
host_port = find_free_port()
1818
running_container = container.run_detached(
19-
command=["start-notebook.sh", "--NotebookApp.token=''"],
19+
command=["start-notebook.sh", "--IdentityProvider.token=''"],
2020
ports={"8888/tcp": host_port},
2121
)
2222
resp = http_client.get(f"http://localhost:{host_port}")
@@ -103,7 +103,7 @@ def test_custom_internal_port(
103103
host_port = find_free_port()
104104
internal_port = env.get("JUPYTER_PORT", 8888)
105105
running_container = container.run_detached(
106-
command=["start-notebook.sh", "--NotebookApp.token=''"],
106+
command=["start-notebook.sh", "--IdentityProvider.token=''"],
107107
environment=env,
108108
ports={internal_port: host_port},
109109
)

tests/base-notebook/test_healthcheck.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,23 @@
2222
(["RESTARTABLE=yes"], None, None),
2323
(["JUPYTER_PORT=8171"], None, None),
2424
(["JUPYTER_PORT=8117", "DOCKER_STACKS_JUPYTER_CMD=notebook"], None, None),
25-
(None, ["start-notebook.sh", "--NotebookApp.base_url=/test"], None),
26-
(None, ["start-notebook.sh", "--NotebookApp.base_url=/test/"], None),
27-
(["GEN_CERT=1"], ["start-notebook.sh", "--NotebookApp.base_url=/test"], None),
25+
(None, ["start-notebook.sh", "--ServerApp.base_url=/test"], None),
26+
(None, ["start-notebook.sh", "--ServerApp.base_url=/test/"], None),
27+
(["GEN_CERT=1"], ["start-notebook.sh", "--ServerApp.base_url=/test"], None),
2828
(
2929
["GEN_CERT=1", "JUPYTER_PORT=7891"],
30-
["start-notebook.sh", "--NotebookApp.base_url=/test"],
30+
["start-notebook.sh", "--ServerApp.base_url=/test"],
3131
None,
3232
),
3333
(["NB_USER=testuser", "CHOWN_HOME=1"], None, "root"),
3434
(
3535
["NB_USER=testuser", "CHOWN_HOME=1"],
36-
["start-notebook.sh", "--NotebookApp.base_url=/test"],
36+
["start-notebook.sh", "--ServerApp.base_url=/test"],
3737
"root",
3838
),
3939
(
4040
["NB_USER=testuser", "CHOWN_HOME=1", "JUPYTER_PORT=8123"],
41-
["start-notebook.sh", "--NotebookApp.base_url=/test"],
41+
["start-notebook.sh", "--ServerApp.base_url=/test"],
4242
"root",
4343
),
4444
],
@@ -75,12 +75,12 @@ def test_health(
7575
(["NB_USER=testuser", "CHOWN_HOME=1"], None, None),
7676
(
7777
["NB_USER=testuser", "CHOWN_HOME=1"],
78-
["start-notebook.sh", "--NotebookApp.base_url=/test"],
78+
["start-notebook.sh", "--ServerApp.base_url=/test"],
7979
None,
8080
),
8181
(
8282
["NB_USER=testuser", "CHOWN_HOME=1", "JUPYTER_PORT=8123"],
83-
["start-notebook.sh", "--NotebookApp.base_url=/test"],
83+
["start-notebook.sh", "--ServerApp.base_url=/test"],
8484
None,
8585
),
8686
],

tests/base-notebook/test_start_container.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ def test_start_notebook(
4545
running_container = container.run_detached(
4646
tty=True,
4747
environment=env,
48-
command=["start-notebook.sh"],
4948
ports={"8888/tcp": host_port},
5049
)
5150
# sleeping some time to let the server start

tests/pluto_check.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,8 @@ def check_pluto_proxy(
1818
token = secrets.token_hex()
1919
container.run_detached(
2020
command=[
21-
"start.sh",
22-
"jupyter",
23-
"lab",
24-
"--port=8888",
25-
f"--LabApp.token={token}",
21+
"start-notebook.sh",
22+
f"--IdentityProvider.token={token}",
2623
],
2724
ports={"8888/tcp": host_port},
2825
)

0 commit comments

Comments
 (0)