Compare commits

...

495 Commits

Author SHA1 Message Date
Min RK
7b2c89d46c Bump to 3.1.1 2023-01-27 12:53:10 +01:00
Min RK
2aa856269f Merge pull request #4318 from meeseeksmachine/auto-backport-of-pr-4316-on-3.x
Backport PR #4316 on branch 3.x (changelog for 3.1.1)
2023-01-27 12:52:36 +01:00
Min RK
9d7f3cd9a3 Backport PR #4316: changelog for 3.1.1 2023-01-27 11:49:35 +00:00
Min RK
767404ab33 Merge pull request #4317 from meeseeksmachine/auto-backport-of-pr-4303-on-3.x
Backport PR #4303 on branch 3.x (make sure event-schemas are installed)
2023-01-27 11:53:32 +01:00
Erik Sundell
3e608cfc38 Backport PR #4303: make sure event-schemas are installed 2023-01-27 10:42:41 +00:00
Min RK
193ebc970c Merge pull request #4315 from minrk/3.x
Backport PR #4302: sqlalchemy 2 compatibility
2023-01-27 11:31:16 +01:00
Min RK
3dccb5dd99 Backport PR #4302: sqlalchemy 2 compatibility 2023-01-27 11:02:54 +01:00
Min RK
43b0897d6e Bump to 3.1.1.dev 2023-01-27 09:14:47 +01:00
Min RK
eca9c00872 Bump to 3.1.0 2022-12-05 14:44:43 +01:00
Min RK
e6e2a7d003 Merge pull request #4232 from minrk/changelog-3.1
changelog for 3.1.0
2022-12-05 14:44:02 +01:00
Min RK
b35a78240c changelog for 1.5.1 2022-12-05 14:02:36 +01:00
Min RK
d317c067d1 Update changelog for 3.1.0 2022-12-05 13:35:59 +01:00
Erik Sundell
681ff09e06 Merge pull request #4233 from minrk/ci-db-versions
ci: update database image versions
2022-12-01 16:40:03 +01:00
Erik Sundell
0d72280e5d Merge pull request #4214 from yuvipanda/metricsss
Add active users prometheus metrics
2022-12-01 15:45:59 +01:00
Simon Li
dca8725876 Merge pull request #4240 from minrk/default-named-server-doc
clarify docstrings for default_server_name
2022-12-01 14:20:37 +00:00
Min RK
3bb1d640ee clearer descriptions of default_server_name behavior
Co-authored-by: Jörg Behrmann <behrmann@physik.fu-berlin.de>
2022-12-01 14:52:23 +01:00
Min RK
954e64e3ca clarify docstrings for default_server_name
and warn if default_server_name is specified but named servers not enabled
2022-12-01 14:39:19 +01:00
Min RK
58475ffcfd make active_users config and methods consistent
- use interval instead of period to match other interval config
- avoid redundant `metric` in both class and method/attr names
- interval is separate per metric group (only one for now)
2022-12-01 14:22:47 +01:00
Georgiana
181aec31af Merge pull request #4236 from minrk/deprecate-extra-handlers
deprecate JupyterHub.extra_handlers
2022-12-01 13:41:36 +02:00
Min RK
c6ac4e0d34 test active users metrics 2022-12-01 10:23:51 +01:00
Min RK
8fe875430a Merge pull request #4209 from ArafatAbdussalam/patch-2
avoid contraction in setup.rst
2022-12-01 09:01:23 +01:00
Min RK
f2dcf96bef remove unused monthy_active_users metric
just jupyterhub_active_users now

Co-authored-by: Erik Sundell <erik.i.sundell@gmail.com>
2022-12-01 08:25:44 +01:00
Yuvi Panda
6e90059580 Merge pull request #4230 from minrk/logout-clear-user
make current_user available to handle_logout hook
2022-11-30 15:19:01 -08:00
Min RK
0a2e6a4042 Merge pull request #4127 from ArafatAbdussalam/branch1
update troubleshooting.md docs
2022-11-30 14:11:53 +01:00
Arafat Abdussalam
672ef34d9b update troubleshooting.md docs
I fixed the grammatical errors on the docs

address review

Co-authored-by: Erik Sundell <erik.i.sundell@gmail.com>
2022-11-30 14:01:13 +01:00
Min RK
2d9285d447 Merge pull request #4156 from liliyao2022/patch-5
Update dockerfile README
2022-11-30 13:54:02 +01:00
Chris Holdgraf
859cff345c Merge pull request #4008 from minrk/capacity-planning 2022-11-30 12:10:16 +01:00
Min RK
4938ed66b6 set base jupyterhub db upgrade-from test version to 1.1
jupyterhub 1.0 is not compatible with more recent mysql
2022-11-30 11:58:37 +01:00
Min RK
770325f695 deprecate JupyterHub.extra_handlers
I don't think we should encourage in-memory extensions.

Point to services, instead.
2022-11-30 11:52:33 +01:00
Min RK
ec8e6e2e4a ci: update database image versions
mysql: 8.0
postgres: 15.1
2022-11-30 09:48:54 +01:00
Min RK
f7ce07ee9e changelog for 3.1.0 2022-11-30 09:45:11 +01:00
Min RK
2b70e768e5 Merge pull request #4229 from jupyterhub/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-11-29 14:59:21 +01:00
Min RK
6d7341b478 clear user before rendering logout page
instead of in clear_login_cookie

ensures current_user is accessible in `handle_logout` hook
2022-11-29 10:04:22 +01:00
pre-commit-ci[bot]
b76e308e71 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/PyCQA/autoflake: v1.7.7 → v2.0.0](https://github.com/PyCQA/autoflake/compare/v1.7.7...v2.0.0)
- [github.com/pre-commit/pre-commit-hooks: v4.3.0 → v4.4.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.3.0...v4.4.0)
- [github.com/PyCQA/flake8: 5.0.4 → 6.0.0](https://github.com/PyCQA/flake8/compare/5.0.4...6.0.0)
2022-11-29 01:55:14 +00:00
Min RK
eac96acadd Merge pull request #4150 from liliyao2022/patch-2
grammar improvements in quickstart.md
2022-11-24 11:26:40 +01:00
Min RK
9992e26a8c Merge pull request #4185 from lumenCodes/instFaq
Edits to institutional FAQ
2022-11-24 11:26:11 +01:00
Min RK
0ec4852800 add 'you will need' to dockerfile readme requirements 2022-11-24 11:25:46 +01:00
Min RK
fdf9fbb65b connect users with infrastructure 2022-11-24 11:23:59 +01:00
Min RK
2f81ea8fb1 Merge pull request #4172 from liliyao2022/patch-10
Deleted unused failRegexEvent
2022-11-24 11:22:40 +01:00
Min RK
cab9c1d9ab Merge pull request #4130 from lumenCodes/tempaltesdoc
refine text in template docs.
2022-11-24 11:20:58 +01:00
Lili Yao
fd172a56e0 grammer improvements in quickstart.md
Modified some grammar issues.
2022-11-24 11:20:23 +01:00
Min RK
6b6946fe8a Merge pull request #4136 from yamakat/Improve-on-documentation-websecurity.md
Update wording in web security docs
2022-11-24 11:18:51 +01:00
Min RK
e97d5c6662 Merge branch 'main' into tempaltesdoc 2022-11-24 11:15:49 +01:00
Min RK
343fe70393 Merge pull request #4072 from ruqayaahh/templates-docs-contributions
[doc] templates: updated obsolete links and made wordings clearer
2022-11-24 11:12:45 +01:00
Min RK
b048bbcd9e Merge pull request #4084 from melissakirabo/patch-1
Refine text in documentation index
2022-11-24 11:07:18 +01:00
Min RK
5639b3a622 Apply suggestions from code review 2022-11-24 11:04:16 +01:00
Min RK
08e6da7584 Merge pull request #4186 from emmanuella194/main
highlight "what is our actual goal" in faq
2022-11-24 10:11:34 +01:00
Min RK
385a4556a4 Merge pull request #4119 from PoorvajaRayas/PoorvajaRayas
Formatting changes to tests.rst
2022-11-24 10:10:00 +01:00
Min RK
40b8393c4b Merge pull request #4094 from Busayo-ojo/busayo-ojo
Fixed typos and added punctuations
2022-11-24 10:09:34 +01:00
Emmanuella Orioma
65464c7029 Updated faq.md
I think the *But what is our actual goal* should be an heading for better reading experience
2022-11-24 10:08:46 +01:00
PoorvajaRayas
869f2dd08d Reviewed documentation and fixed grammatical errors 2022-11-24 10:06:40 +01:00
Min RK
8b471624ee Merge branch 'main' into busayo-ojo 2022-11-24 10:04:08 +01:00
Min RK
51c1ea1f7f restore 'the'
Co-authored-by: Georgiana <georgiana.dolocan@gmail.com>
2022-11-24 10:02:53 +01:00
Min RK
d04c0c28c0 Merge pull request #2641 from ericdill/copyediting
Some suggestions from reading through the docs
2022-11-24 09:46:29 +01:00
pre-commit-ci[bot]
33fa9b953b [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-11-24 08:41:13 +00:00
Min RK
de5fb1e7ce Merge branch 'main' into copyediting 2022-11-24 09:40:21 +01:00
Min RK
1cf13bea66 Merge pull request #4210 from ArafatAbdussalam/patch-3
grammar in security-basics.rst
2022-11-24 09:21:13 +01:00
pre-commit-ci[bot]
abe7150ffe [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-11-23 10:22:56 +00:00
Erik Sundell
95e5a5dea8 Merge pull request #4227 from consideRatio/pr/docs-cleanup
docs: refresh conf.py, add opengraph and rediraffe extensions
2022-11-23 10:45:42 +01:00
YuviPanda
f05778a1ae Add comment clarifying why we freeze time 2022-11-22 14:23:21 -08:00
YuviPanda
06fb211283 Make duration be a label on the metric
- Stops ambiguous wording on 'monthly', use more precise '30d'
- Add a 7d active users metric
- Allows us to make this configurable in the future if needed
2022-11-22 14:18:15 -08:00
Erik Sundell
f877588e52 docs: fix rST syntax error for italics 2022-11-22 17:47:37 +01:00
Erik Sundell
bfe0186ad2 docs: add rediraffe sphinx extension
This extension helps us restructure our documentation without creating
dead links. It requires us to explicitly declare what should be
redirected where though.

It seems better to have it in place ahead of time than to be something
we ask a contributor add just in time when its needed.
2022-11-22 17:47:37 +01:00
Erik Sundell
d23e095106 docs: add opengraph sphinx extension
This extension helps add metadata etc to the rendered HTML documentation
to help for example links on discourse.jupyter.org look good.
2022-11-22 17:47:37 +01:00
Erik Sundell
96d4486ae5 docs: refresh conf.py for readability 2022-11-22 17:47:37 +01:00
Erik Sundell
98710dbc8b Merge pull request #4223 from consideRatio/pr/requirements-details
maint: add test to extras_require, remove greenlet workaround, test final py311, misc cleanup
2022-11-22 17:24:23 +01:00
pre-commit-ci[bot]
8ac3a8e4e6 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-11-22 12:53:06 +00:00
Erik Sundell
0575022186 docs: install jupyterhub package and remove path setup steps
When we install the jupyterhub package, we don't have to put it on the
path explicitly.
2022-11-22 13:51:28 +01:00
Erik Sundell
1ac9c443b5 maint: add test to extras_require, remove dev-requirements.txt 2022-11-22 13:51:28 +01:00
Erik Sundell
08ed8443f2 maint: install html5lib via beautifulsoup4's extra_requires 2022-11-22 13:45:57 +01:00
Erik Sundell
0cdaa833c4 maint: remove unused urllib3 from test requirements 2022-11-22 13:45:57 +01:00
Erik Sundell
87ce2a9b2f maint: add jsonschema to test requirements and cleanup attrs constraint 2022-11-22 13:45:57 +01:00
Erik Sundell
f26b43f209 maint: remove no longer needed py311 greenlet workaround 2022-11-22 13:45:55 +01:00
Erik Sundell
e6e84eabb3 ci: focus tests towards py311 over py310 2022-11-22 13:43:11 +01:00
Erik Sundell
4fadfd42da Merge pull request #4225 from minrk/selenium-wait
selenium: update next_url after waiting for it to change
2022-11-22 09:56:03 +01:00
Min RK
29d84f4192 selenium: update next_url after waiting for it to change 2022-11-22 09:41:24 +01:00
Min RK
fc7ef39f21 Merge pull request #4211 from jupyterhub/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-11-21 15:21:02 +01:00
Min RK
d5d9cb204c Merge pull request #4219 from consideRatio/pr/stricter-flake8
pre-commit: add autoflake and make flake8 checks stricter
2022-11-21 15:10:14 +01:00
pre-commit-ci[bot]
9d592fff31 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-11-18 15:43:10 +00:00
Erik Sundell
12594631e0 maint: use __all__ statements where its reasonable to do
Co-authored-by: Simon Li <orpheus+devel@gmail.com>
2022-11-18 16:42:43 +01:00
Min RK
ffbc981bfe Merge pull request #4222 from consideRatio/pr/docs-maintenance
docs: sphinx config cleanup, removing epub build, fix build warnings
2022-11-17 14:43:33 +01:00
Erik Sundell
7f3fd7e3cc docs: fix broken links and formatting errors 2022-11-17 13:38:25 +01:00
Erik Sundell
1c9499e91e docs: remove epub documentation build 2022-11-17 13:09:06 +01:00
Erik Sundell
26e5efeec4 docs: cleanup unused config for htmlhelp, latex, manual 2022-11-17 13:08:17 +01:00
Erik Sundell
90811196d7 docs: remove unused alabaster_jupyterhub requirement 2022-11-17 13:00:22 +01:00
Min RK
a917de258f Merge pull request #4221 from jupyterhub/dependabot/npm_and_yarn/jsx/loader-utils-2.0.4
Bump loader-utils from 2.0.2 to 2.0.4 in /jsx
2022-11-17 09:24:04 +01:00
dependabot[bot]
5d7383278f Bump loader-utils from 2.0.2 to 2.0.4 in /jsx
Bumps [loader-utils](https://github.com/webpack/loader-utils) from 2.0.2 to 2.0.4.
- [Release notes](https://github.com/webpack/loader-utils/releases)
- [Changelog](https://github.com/webpack/loader-utils/blob/v2.0.4/CHANGELOG.md)
- [Commits](https://github.com/webpack/loader-utils/compare/v2.0.2...v2.0.4)

---
updated-dependencies:
- dependency-name: loader-utils
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-17 04:52:44 +00:00
pre-commit-ci[bot]
865d5f7646 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-11-16 14:53:12 +00:00
Erik Sundell
5a5e0118b8 docs: comment about isort, black, tbump in pyproject.toml 2022-11-16 15:51:26 +01:00
Erik Sundell
b9596b2dee pre-commit: add autoflake 2022-11-16 15:51:26 +01:00
Erik Sundell
3b5b42e620 flake8: manual F408 fix, avoid indirect import of public_host / public_url 2022-11-16 15:51:26 +01:00
Erik Sundell
7a9491c323 flake8: check F408 about unused imports, manual fixes only 2022-11-16 15:51:26 +01:00
Erik Sundell
957fd9cc20 flake8: check F811 about redefinition of unused name 2022-11-16 15:51:26 +01:00
Erik Sundell
eaa096152a flake8: check F403 about import * 2022-11-16 15:51:26 +01:00
Min RK
5ea93add28 Merge pull request #4216 from consideRatio/pr/cleanup-flake8-config
ci: flake8, cleanup unused/redundant config
2022-11-16 09:06:43 +01:00
Erik Sundell
b77e9cbf08 ci: flake8, add back general ignore of pydocstyle warnings 2022-11-16 08:54:23 +01:00
Erik Sundell
24dfa5d228 ci: flake8, cleanup unused/redundant config
- E### warnings were already ignored by E
- Sorting of import warnings won't matter as we have black and isort
- D400: First line should end with a period

  This is not flake8 configuration, but related to `pydocstyle`, which
  isn't used.
2022-11-16 08:16:44 +01:00
Yuvi Panda
98603ef3e4 Merge pull request #4208 from ArafatAbdussalam/patch-1
improved the grammatical structure
2022-11-15 16:09:12 -08:00
YuviPanda
06aded4bce Fix some typos 2022-11-15 16:01:20 -08:00
YuviPanda
a2e80e5d6f Add daily & monthly active users prometheus metrics
These are *extremely useful* for people advocating for
more resources for their JupyterHubs, but a little difficult
to calculate without a full scale log ingestion and analytics
pipeline (such as ELK or equivalent). However, these are easy
to calculate on the JupyterHub side at any given instance -
these are fairly quick SQL queries. Prometheus can capture and
store this as a timeseries, and provide valuble advocacy data
that is hard to get otherwise.

This turns the metrics on by default, but only updates them every
hour - which seems fine for metrics that don't change that often.
This should reduce performance impact. Admins can also turn this
off if needed.

I've had to implement this in many different ways in many different
contexts, and it's also important to be able to *trust* these. Getting
this from other grafana data can be tricky to validate - we had an
experimental one in our grafana dashboards at some point in the past
that we had to kill due to it being hard to validate
(https://github.com/jupyterhub/grafana-dashboards/pull/45). This metric
will provide an authoritative source of truth for this.

Ref https://github.com/2i2c-org/infrastructure/issues/1888
2022-11-15 15:43:01 -08:00
pre-commit-ci[bot]
c993163f0b [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v3.2.0 → v3.2.2](https://github.com/asottile/pyupgrade/compare/v3.2.0...v3.2.2)
2022-11-15 00:12:51 +00:00
Arafat Abdussalam
e6e890b46c Update security-basics.rst 2022-11-14 11:22:12 +01:00
Arafat Abdussalam
d2c6ae925f modified setup.rst
When I needed to set up Linux on my windows, i found out the easier to do so was through Windows Subsystem for Linux. Hence, I needed to add the guide to the development setup
2022-11-14 10:45:14 +01:00
Arafat Abdussalam
32cddfbdfe Update docs.rst 2022-11-14 10:30:56 +01:00
Simon Li
730fe5a446 Merge pull request #4204 from minrk/access-servers
[docs] typo in access:servers scope
2022-11-11 08:41:31 +00:00
Min RK
2ed84b0de1 typo in access:servers scope
it's not access:users:servers
2022-11-11 09:23:23 +01:00
Your Name
de1757bf57 Deleted unused failRegexEvent 2022-11-02 09:23:45 +01:00
Min RK
54c06c33bd Merge pull request #4188 from jupyterhub/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-11-01 09:05:17 +01:00
Min RK
17119a273f Merge pull request #4187 from consideRatio/main
ci: use non-deprecated codecov uploader
2022-11-01 09:01:22 +01:00
Min RK
7effe53c28 Merge pull request #4139 from Joel-Ando/Joel-Ando-patch-1
highlight note about the docker image scope
2022-11-01 08:50:58 +01:00
Joel-Ando
59f14ad7c0 Update quickstart-docker.rst 2022-11-01 08:50:25 +01:00
pre-commit-ci[bot]
54a5d2c152 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v3.1.0 → v3.2.0](https://github.com/asottile/pyupgrade/compare/v3.1.0...v3.2.0)
- [github.com/pre-commit/mirrors-prettier: v3.0.0-alpha.3 → v3.0.0-alpha.4](https://github.com/pre-commit/mirrors-prettier/compare/v3.0.0-alpha.3...v3.0.0-alpha.4)
2022-11-01 00:03:21 +00:00
Erik Sundell
b83a6250ba ci: use non-deprecated codecov uploader 2022-10-31 19:36:37 +01:00
pre-commit-ci[bot]
ca6aba7568 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-28 14:55:47 +00:00
lumenCodes
49ec485614 Merge branch 'main' of https://github.com/jupyterhub/jupyterhub into instFaq 2022-10-28 15:51:08 +01:00
lumenCodes
8de25d08a7 I fixed typo errors and structure 2022-10-28 15:50:47 +01:00
Min RK
a7cfc76a82 Merge pull request #4113 from EstherChristopher/patch-2
proofread upgrading docs
2022-10-28 15:14:32 +02:00
Esther Christopher
c19b3b540a Update upgrading.rst
Hopefully, it's all sorted now and gets merged. Sorry for the back and forth.
2022-10-28 13:50:02 +01:00
Chinwendu
5ec1cf86a7 Update docs/source/reference/templates.md
Co-authored-by: Min RK <benjaminrk@gmail.com>
2022-10-27 14:06:45 +01:00
Min RK
2594a7269e Merge pull request #4140 from Joel-Ando/Joel-Ando-patch-2
add link to rbac index from implementation
2022-10-27 15:00:22 +02:00
Min RK
f20021c068 Merge pull request #4173 from liliyao2022/patch-11
jsx: remove unused useState
2022-10-27 14:28:16 +02:00
Min RK
5708de05ff Merge pull request #4129 from lumenCodes/restapidoc
reorder REST API doc
2022-10-27 14:21:12 +02:00
Min RK
28f2ba9df9 Merge pull request #4168 from lumenCodes/proxy
clarify CHP downsides in proxy doc
2022-10-27 14:19:50 +02:00
Min RK
35297ce87f Merge pull request #4167 from lumenCodes/services
Proofread services.md
2022-10-27 14:17:09 +02:00
Min RK
73d97c0a82 Merge pull request #4109 from EstherChristopher/patch-1
Reviewed the documentation
2022-10-27 14:11:37 +02:00
Esther Christopher
f0957ad247 Resolve conflicts in event doc 2022-10-27 14:10:41 +02:00
pre-commit-ci[bot]
777bbe8e92 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-26 18:06:17 +00:00
lumenCodes
3eb6cd302c Applied PR Changes 2022-10-26 19:02:42 +01:00
lumenCodes
438b285670 I effected PR requested changes 2022-10-26 18:44:51 +01:00
pre-commit-ci[bot]
cf2ec324b7 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-26 17:23:20 +00:00
Chinwendu
b33b8772d3 Merge branch 'main' into restapidoc 2022-10-26 18:22:47 +01:00
pre-commit-ci[bot]
6a4078f977 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-26 17:17:20 +00:00
lumenCodes
12de64828c update to the proxy file. 2022-10-26 18:12:23 +01:00
lumenCodes
23506a25e5 applied PR change suggestions 2022-10-26 11:44:13 +01:00
lumenCodes
8ffa07e82d Update to the services.md 2022-10-26 11:44:13 +01:00
Esther Christopher
2019bd2797 Update upgrading.rst
Hi @minrk, I went through the reference files you sent and made the necessary adjustments. I think everything should be fine now. I also added a new correction. Please review and revert.
2022-10-26 11:24:53 +01:00
Min RK
88e2346bf2 Merge pull request #4171 from liliyao2022/patch-9
typos in example readme
2022-10-26 10:02:02 +02:00
Min RK
2bb7594cd1 Merge pull request #4170 from KaluBuikem/patch-2
Updated deployment gallery links
2022-10-26 10:01:12 +02:00
Min RK
36d596a4d3 Merge pull request #4169 from emmanuella194/main
typo in contributing doc
2022-10-26 09:42:05 +02:00
Min RK
d9c36ed725 Merge pull request #4166 from lumenCodes/contributing
Welcome first-time contributors to the forum
2022-10-26 09:39:38 +02:00
Lili Yao
cb5cc8c1b4 Update Groups.jsx
"useState" was not used in this file.
2022-10-26 17:58:26 +11:00
Lili Yao
76f7ff4721 Update README.md
Corrected some spelling errors.
2022-10-26 15:44:52 +11:00
pre-commit-ci[bot]
22d2bbe1ae [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-26 00:51:27 +00:00
Kalu Chibuikem Victor
d215248d8a Updated gallery-jhub-deployments.md
I embedded links into the text and updated minor text errors
2022-10-26 01:50:28 +01:00
Emmanuella Orioma
488331e033 Update docs.rst
I corrected the spelling error in line 21
2022-10-25 23:26:16 +03:00
Chinwendu
cde1b65252 Update docs/source/contributing/community.md
Co-authored-by: Min RK <benjaminrk@gmail.com>
2022-10-25 16:11:52 +01:00
Joel-Ando
5f32abeeba Update tech-implementation.md 2022-10-25 14:55:53 +01:00
Min RK
41cbcc9502 Merge pull request #4021 from jupyterhub/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-10-25 10:37:38 +02:00
Min RK
297c40195c Merge pull request #4106 from alwasega/server
Edited and restructured `server-api` file
2022-10-25 10:14:10 +02:00
Min RK
209eb4468e Merge pull request #4157 from Uzor13/rest-api-doc
Updated JupyterHub's REST API doc
2022-10-25 09:57:47 +02:00
pre-commit-ci[bot]
7c92902e48 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-24 23:10:47 +00:00
pre-commit-ci[bot]
d5beda293b [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v2.37.3 → v3.1.0](https://github.com/asottile/pyupgrade/compare/v2.37.3...v3.1.0)
- [github.com/psf/black: 22.6.0 → 22.10.0](https://github.com/psf/black/compare/22.6.0...22.10.0)
- [github.com/pre-commit/mirrors-prettier: v2.7.1 → v3.0.0-alpha.3](https://github.com/pre-commit/mirrors-prettier/compare/v2.7.1...v3.0.0-alpha.3)
2022-10-24 23:08:59 +00:00
pre-commit-ci[bot]
3b4c40e5e0 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-24 18:22:26 +00:00
Uzochukwu Precious
5cfa16dbfd review update 2022-10-24 19:21:43 +01:00
lumenCodes
7a22a2cf93 Addittion to the contributing .md 2022-10-24 17:36:38 +01:00
pre-commit-ci[bot]
eb72067ab3 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-24 14:46:42 +00:00
Allan Wasega
3da4dc66c9 Incorporated suggested edits 2022-10-24 17:44:57 +03:00
Allan Wasega
87c2d545df Merge branch 'jupyterhub:main' into server 2022-10-24 17:00:33 +03:00
Joel-Ando
3e4cc0b869 Update tech-implementation.md 2022-10-24 14:14:48 +01:00
Min RK
de8d1b71f8 Merge pull request #4153 from Teniola-theDev/patch-1
Consistent capitalization of Authenticator
2022-10-24 14:43:30 +02:00
Min RK
af7494c460 Merge pull request #4026 from mouse1203/main
Add browser-based tests with Selenium
2022-10-24 14:41:24 +02:00
Joel-Ando
d0a48c0655 Update tech-implementation.md 2022-10-24 13:28:28 +01:00
Teniola Olowookere
48fc74b9b4 removed extra text 2022-10-24 13:17:52 +01:00
Min RK
54ac5226b3 Merge pull request #4152 from emmanuella194/main
Link back to rbac from use-cases
2022-10-24 14:15:27 +02:00
Emmanuella Orioma
ce9feb5139 Update use-case.md
changed RBAC documentation url to the internal rbac jupyter documentation
2022-10-24 15:09:29 +03:00
Teniola Olowookere
ec0cb70f35 removed duplicate link 2022-10-24 13:08:52 +01:00
Teniola Olowookere
c0af08fabd Merge branch 'jupyterhub:main' into patch-1 2022-10-24 13:07:32 +01:00
Teniola Olowookere
a2e59e6867 Update docs/source/getting-started/authenticators-users-basics.md
Co-authored-by: Min RK <benjaminrk@gmail.com>
2022-10-24 13:03:04 +01:00
Min RK
4859c62381 Merge pull request #4154 from minrk/rm-redundant-roles-target
Remove redundant ref target for roles
2022-10-24 13:44:26 +02:00
mouse1203
9b7a77c36f selenium: added docstrings
added docstrings, parameter for open_url function, removed element function (unused)
2022-10-24 13:09:46 +02:00
Min RK
ab7ec8b33d Merge pull request #4160 from Christiandike/update/configsudo.md
Update/configsudo.md
2022-10-24 12:57:53 +02:00
Min RK
15c691b358 Merge pull request #4162 from liliyao2022/patch-8
Typo in institutional-faq
2022-10-24 12:44:03 +02:00
Christian Dike
1c95d94b96 Update config-sudo.md 2022-10-24 11:38:58 +01:00
Christian Dike
e76e9099c2 Update docs/source/reference/config-sudo.md
Co-authored-by: Min RK <benjaminrk@gmail.com>
2022-10-24 11:33:48 +01:00
Min RK
63cd63ffee Merge pull request #4161 from Christiandike/update/separate-proxy.md
Improve text in proxy docs
2022-10-24 12:33:07 +02:00
Min RK
2c4c5fc6fe Merge pull request #4159 from liliyao2022/patch-7
Update roadmap.md
2022-10-24 11:35:52 +02:00
Min RK
c788d6f087 Merge pull request #4158 from liliyao2022/patch-6
Update README.md
2022-10-24 11:35:14 +02:00
Min RK
a1c94a6e13 Merge pull request #4098 from NPDebs/main
Proofread and Improve security-basics.rst
2022-10-24 11:33:05 +02:00
Min RK
37bf8e0724 Merge pull request #4118 from falyne/main
Capitalization typo in troubleshooting.md
2022-10-24 10:52:39 +02:00
Min RK
56161c2aa6 Merge pull request #4155 from Christiandike/update/oauth.md
Add link to OAuth 2
2022-10-24 10:44:16 +02:00
Min RK
66a86f5db0 Merge pull request #4090 from alwasega/community
Restructured Community communication channels file
2022-10-24 10:28:20 +02:00
Min RK
ea0462de1a Merge pull request #4164 from jupyterhub/dependabot/github_actions/docker/setup-buildx-action-2.2.1
Bump docker/setup-buildx-action from 2.1.0 to 2.2.1
2022-10-24 09:21:51 +02:00
dependabot[bot]
37be9b4a5b Bump docker/setup-buildx-action from 2.1.0 to 2.2.1
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2.1.0 to 2.2.1.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](95cb08cb26...8c0edbc76e)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-24 05:27:46 +00:00
Lili Yao
c4d8be22b6 Update institutional-faq.md
Corrected a spelling error.
2022-10-24 12:51:48 +11:00
pre-commit-ci[bot]
ced408c205 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-23 19:18:11 +00:00
Christian Dike
5ce930324c Update separate-proxy.md 2022-10-23 20:16:46 +01:00
Christian Dike
36b15d7ce0 Update separate-proxy.md 2022-10-23 20:11:36 +01:00
Christian Dike
7b636b6f9c Update config-sudo.md 2022-10-23 19:26:24 +01:00
Christian Dike
35b06481e2 Update config-sudo.md 2022-10-23 19:03:32 +01:00
Joel-Ando
18b049e3c9 Update tech-implementation.md 2022-10-23 16:23:35 +01:00
Joel-Ando
6b62fe794e Update tech-implementation.md
did the necessary changes
2022-10-23 16:13:20 +01:00
Lili Yao
ad25ef8f87 Update roadmap.md
It seems that we don't need an "a" here, or should we change it to "an" instead?
2022-10-23 15:42:57 +11:00
Lili Yao
61369ea5da Update README.md
Modified some spelling and grammar errors.
2022-10-23 13:53:02 +11:00
Emmanuella Orioma
a17b4c5801 Updated use-cases.md
Added the RBAC jupyter documentation link
2022-10-22 22:23:26 +03:00
Deborah Udoh
750d36a8f7 Update security-basics.rst 2022-10-22 11:19:27 +01:00
Deborah Udoh
23fc2f42d0 Update security-basics.rst
Co-authored-by: Min RK <benjaminrk@gmail.com>
2022-10-22 10:41:10 +01:00
Deborah Udoh
29ba669c73 Update security-basics.rst 2022-10-22 10:32:16 +01:00
Uzochukwu Precious
eb8f338186 Updated JupyterHub's REST API doc 2022-10-22 10:02:39 +01:00
Melissa Kirabo
76f9cf00c4 Update index.rst 2022-10-22 10:55:50 +03:00
Ngobiri Falyne
fc5f55caf9 Update troubleshooting.md
I replaced the comma, 
adjusted jupyterhub to JuputerHub
and the others as adiced
2022-10-22 06:53:16 +01:00
Lili Yao
131da596c5 Update README.md 2022-10-22 11:26:18 +11:00
Christian Dike
70bfdd6d00 update oauth.md 2022-10-22 00:51:38 +01:00
Christian Dike
02f33073ad update oauth.md 2022-10-22 00:37:08 +01:00
Esther Christopher
411189e54c Update upgrading.rst 2022-10-22 00:32:18 +01:00
Allan Wasega
9f5f19cb26 Fixed minor errors 2022-10-22 01:06:56 +03:00
Allan Wasega
9d93df6baf Fixed a minor error 2022-10-22 00:57:04 +03:00
pre-commit-ci[bot]
39eb1f055f [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-21 21:40:42 +00:00
Allan Wasega
74b0ebefe9 Fixed minor issues in community communication channels file 2022-10-22 00:34:23 +03:00
pre-commit-ci[bot]
28867760a4 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-21 21:05:16 +00:00
Allan Wasega
7a0b98d9ce Updated the server-api file with all comments 2022-10-22 00:04:37 +03:00
Allan Wasega
14e9155eb8 Merge branch 'jupyterhub:main' into server 2022-10-21 23:53:47 +03:00
pre-commit-ci[bot]
7ce4b13998 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-21 20:41:36 +00:00
Allan Wasega
5a16d770da Updated the server-api file as per review comments 2022-10-21 23:41:06 +03:00
Teniola Olowookere
b741a30dc3 Update docs/source/getting-started/authenticators-users-basics.md
I committed your suggestion about changing the target for the "roles". Thank you!

Co-authored-by: Min RK <benjaminrk@gmail.com>
2022-10-21 20:25:21 +01:00
Min RK
aebe33b62b Remove redundant ref target for roles
it's already addressable at that same target name,
having this here results in ambiguous ref targets in MyST
2022-10-21 15:59:49 +02:00
pre-commit-ci[bot]
794a1aa70f [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-21 13:44:46 +00:00
Teniola Olowookere
4e45b89ed1 Capitalised some words 2022-10-21 14:40:24 +01:00
mtkmtk
cd969c5dc4 Update websecurity.md 2022-10-21 10:31:24 -03:00
mtkmtk
de4117cba9 Update docs/source/reference/websecurity.md
Co-authored-by: Min RK <benjaminrk@gmail.com>
2022-10-21 10:25:09 -03:00
Sarah Gibson
f4c129a649 Merge pull request #4148 from Christiandike/update/spawners.md 2022-10-21 14:08:15 +01:00
Emmanuella Orioma
69e973d53a Update use-case.md
Worked on the documentation page  (jupyterhub/docs/source/rbac/use-case.md)

Added a wikipedia reference to [RBCA framework] and also emphasized on the solution under the *service to cull idle servers*
2022-10-21 13:21:20 +01:00
mtkmtk
f566559f9a Merge branch 'main' into Improve-on-documentation-websecurity.md 2022-10-21 09:17:48 -03:00
Christian Dike
37b82f7c2a Update docs/source/reference/spawners.md
Co-authored-by: Sarah Gibson <44771837+sgibson91@users.noreply.github.com>
2022-10-21 12:05:12 +01:00
Christian Dike
a71f6be001 Update docs/source/reference/spawners.md
Co-authored-by: Sarah Gibson <44771837+sgibson91@users.noreply.github.com>
2022-10-21 12:04:45 +01:00
Min RK
3da7021faa Merge pull request #4147 from Teebarh/mychanges
Added punctuations and capitalized words where necessary.
2022-10-21 10:34:24 +02:00
Melissa Kirabo
7330babc7e Update index.rst 2022-10-21 11:34:12 +03:00
Min RK
eeb0e506f3 Merge pull request #4146 from lumenCodes/spawners-basic
Update to the spawner basic file
2022-10-21 10:31:03 +02:00
Min RK
d59d856fa6 Merge pull request #4145 from softkeldozy/configuration_branch
Added text to documentation for more readability
2022-10-21 10:30:08 +02:00
Min RK
a7df46ead7 Merge pull request #4126 from PoorvajaRayas/patch-1
Update troubleshooting.md
2022-10-21 10:15:25 +02:00
Min RK
cb03c6035a Merge pull request #4116 from Eshy10/main
Upgrading.rst (Fix Duplicate statement)
2022-10-21 10:11:20 +02:00
Melissa Kirabo
037943728f Update docs/source/index.rst
Co-authored-by: Min RK <benjaminrk@gmail.com>
2022-10-21 11:07:44 +03:00
Melissa Kirabo
42918352a8 Update docs/source/index.rst
Co-authored-by: Min RK <benjaminrk@gmail.com>
2022-10-21 11:06:55 +03:00
Melissa Kirabo
ec18f7b65a Update docs/source/index.rst
Co-authored-by: Min RK <benjaminrk@gmail.com>
2022-10-21 11:04:04 +03:00
Christian Dike
69869ee823 update spawners.md 2022-10-21 01:49:36 +01:00
Christian Dike
fedcd22b0c update spawners.md 2022-10-21 01:29:31 +01:00
Esther Christopher
2f4691e692 Merge branch 'main' into patch-2 2022-10-20 21:15:43 +01:00
mtkmtk
aaffb66bef Updating websecurity.md after first review 2022-10-20 16:42:51 -03:00
Esther Christopher
e228b017e9 Merge branch 'main' into patch-1 2022-10-20 20:30:50 +01:00
Toyibat Adele
8e111665cd Added Punctuations and Capitalized words where necessary. 2022-10-20 17:44:56 +01:00
Sarah Gibson
283d2b75b6 Merge pull request #4135 from Christiandike/update/websecurity 2022-10-20 17:37:36 +01:00
Sarah Gibson
3f73671adf Merge pull request #4114 from alexanderchosen/alexanderchosen 2022-10-20 17:36:00 +01:00
Adewale Modupe
459793010b Merge branch 'main' into main 2022-10-20 14:40:03 +01:00
Eshy10
248bf8ef83 chore: remove capitalize word and "This is" after the colon for environments 2022-10-20 14:25:36 +01:00
Kelvin Obidozie
f71388633f Added text to documentation for more readability 2022-10-20 13:38:12 +01:00
PoorvajaRayas
dd8259fb46 Updated the document by making necessary changes 2022-10-20 17:47:13 +05:30
pre-commit-ci[bot]
677895c3eb [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-20 11:55:29 +00:00
Alexander Chosen Okon
9fcaf8df52 further simplified the words in the document
I made changes to some of the words used by simplifying them to ensure that all users can easily understand the document.
2022-10-20 11:55:23 +00:00
PoorvajaRayas
cd3f37f6a6 Update troubleshooting.md 2022-10-20 17:24:55 +05:30
lumenCodes
91f06f49e0 update to the spawner basic file 2022-10-20 12:54:42 +01:00
Christian Dike
145ccfbd4f update websecurity.md 2022-10-20 10:36:59 +01:00
Ngobiri Falyne
141f5ea2b4 Update troubleshooting.md 2022-10-20 10:01:44 +01:00
pre-commit-ci[bot]
c3da12c195 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-20 09:00:35 +00:00
Ngobiri Falyne
439b96978e Update troubleshooting.md 2022-10-20 09:58:37 +01:00
Min RK
8ba57f9309 Merge pull request #4132 from ToobaJamal/edit
update spawners-basics.md
2022-10-20 10:56:15 +02:00
pre-commit-ci[bot]
1ea557c999 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-20 08:44:59 +00:00
Ngobiri Falyne
d5f5d837de Merge branch 'main' into main 2022-10-20 09:44:28 +01:00
Melissa Kirabo
462324bba8 Merge branch 'main' into patch-1 2022-10-20 11:42:10 +03:00
Min RK
1dd848e560 Merge pull request #4124 from AdrianaHelga/AdrianaHelga-patch-1
Update services-basics.md
2022-10-20 10:28:07 +02:00
Min RK
864f7dc0c1 Merge pull request #4111 from zeelyha/docs
Typo in templates.md
2022-10-20 10:00:19 +02:00
Min RK
817f6e9c35 Merge pull request #4095 from Goodiec/patch-2
Update config-proxy.md
2022-10-20 09:11:24 +02:00
Min RK
85c67dd05c Merge pull request #4088 from ToobaJamal/main
Grammatical/link fixes in upgrading doc
2022-10-20 09:05:15 +02:00
Min RK
b0c2dd01a1 Merge pull request #4097 from Mackenzie-OO7/fix-typos
Modifications to URLs docs
2022-10-20 09:03:20 +02:00
Christian Dike
281658ccce update websecurity.md
Delete erroneous text from merge conflict
2022-10-20 07:48:52 +01:00
pre-commit-ci[bot]
c14d8e3446 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-20 03:28:21 +00:00
Joel-Ando
d956563ff4 Merge branch 'main' into Joel-Ando-patch-2 2022-10-20 04:27:19 +01:00
pre-commit-ci[bot]
e389e7f6d4 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-19 20:35:22 +00:00
mtkmtk
634bd26ad4 Update websecurity.md 2022-10-19 17:32:58 -03:00
Levai Mackenzie Ágbàrà
e82bd5a96b Merge branch 'jupyterhub:main' into fix-typos 2022-10-19 18:43:22 +01:00
pre-commit-ci[bot]
9c044e863a [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-19 13:33:49 +00:00
Alexander Chosen Okon
0340e9d6ad Merge branch 'main' into alexanderchosen 2022-10-19 13:33:11 +00:00
pre-commit-ci[bot]
ecf486d678 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-19 11:59:10 +00:00
Christian Dike
587059da11 Merge branch 'main' into update/websecurity 2022-10-19 12:57:48 +01:00
Alexander Chosen Okon
6f25abac2e Update config-user-env.md
I made a few changes to the spacing used.
2022-10-19 11:49:55 +00:00
Christian Dike
7d73d5774e update websecurity.md
- fix typos/edit text
- add important links
2022-10-19 12:37:13 +01:00
Georgiana
30e652f59e Merge pull request #4081 from Christiandike/Update/docs
Migrate community channels to markdown, update text
2022-10-19 11:59:43 +02:00
Georgiana
00cc149b0d Merge pull request #4089 from Christiandike/update/tech-implementation.md
Update rbac tech-implementation docs
2022-10-19 11:51:58 +02:00
pre-commit-ci[bot]
d407c96ee8 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-19 09:47:27 +00:00
Christian Dike
84e1216dda Update docs/source/contributing/community.md
Co-authored-by: Georgiana <georgiana.dolocan@gmail.com>
2022-10-19 10:45:49 +01:00
Christian Dike
c8aae0ea1c Update docs/source/contributing/community.md
Co-authored-by: Georgiana <georgiana.dolocan@gmail.com>
2022-10-19 10:44:41 +01:00
Christian Dike
313623256f Update docs/source/contributing/community.md
Co-authored-by: Georgiana <georgiana.dolocan@gmail.com>
2022-10-19 10:44:15 +01:00
Georgiana
da7ac11605 Merge pull request #4069 from chicken-biryani/main
Update the testing docs
2022-10-19 11:29:36 +02:00
Goodness Chris-Ugari
eaeef65560 Update config-proxy.md
Update comment
2022-10-19 09:34:42 +01:00
Alexander Chosen okon
a4597a1c50 alexanderchosen 2022-10-18 23:47:20 +00:00
Alexander Chosen okon
390efc1c5a removed the logo image and resolved some conflicts 2022-10-18 23:24:53 +00:00
Goodness Chris-Ugari
853f8accf5 Update config-proxy.md
update
2022-10-18 15:09:44 +01:00
Goodness Chris-Ugari
1f66237a5a Merge branch 'jupyterhub:main' into patch-2 2022-10-18 15:04:47 +01:00
Georgiana
0881514988 Merge pull request #4096 from Christiandike/update/config-ghoauth
Link reference to github oauth config with jupyter
2022-10-18 15:03:04 +02:00
Georgiana
975a841cdc Merge pull request #4093 from Achele/Achele
fixed some typos and technical terms
2022-10-18 15:01:30 +02:00
Sarah Gibson
ef0a627e28 Merge pull request #4133 from Teniola-theDev/spawner/editone
I capitalized cli and added y to jupterhub
2022-10-18 12:22:22 +01:00
Teniola Olowookere
504ebe9012 capitalized cli and added y to jupterhub 2022-10-18 10:09:31 +01:00
Tooba Jamal
895d713370 update spawners-basics.md 2022-10-18 12:01:13 +05:00
Tooba Jamal
d1ad045335 update index.rst 2022-10-18 11:55:48 +05:00
Tooba Jamal
1041bc53b1 fix typo 2022-10-18 11:21:50 +05:00
lumenCodes
2636a9fff5 added section refrence 2022-10-18 03:26:36 +01:00
lumenCodes
b1dfac546d fix: typo errors 2022-10-18 03:20:34 +01:00
pre-commit-ci[bot]
28de35facd [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-18 01:25:28 +00:00
lumenCodes
10c54353da Rest Api doc update 2022-10-18 02:19:33 +01:00
pre-commit-ci[bot]
b890a7486d [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-17 20:33:17 +00:00
PoorvajaRayas
97c72dd779 Update troubleshooting.md
Improved the documentation to make it clearer
2022-10-18 02:01:50 +05:30
Christian Dike
ae833d4a51 Add link to gh oauth
Co-authored-by: Georgiana <georgiana.dolocan@gmail.com>
2022-10-17 18:09:49 +01:00
Shloka
15b8857728 Update docs/source/contributing/tests.rst
Co-authored-by: Min RK <benjaminrk@gmail.com>
2022-10-17 22:30:55 +05:30
Shloka
79ea4038e5 Update docs/source/contributing/tests.rst
Co-authored-by: Min RK <benjaminrk@gmail.com>
2022-10-17 22:30:47 +05:30
Sarah Gibson
e7284b65ad Merge pull request #4092 from Temidayo32/announcement 2022-10-17 17:33:52 +01:00
Ojoachele Onuh
deaccdc668 Resolved and updated corrections from previous pull request 2022-10-17 17:27:09 +01:00
pre-commit-ci[bot]
838719e7ab [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-17 15:11:38 +01:00
Christian Dike
6ca5c1a276 Update documentation
Fix structure of documentation to aid readability and flow.
2022-10-17 15:09:40 +01:00
dependabot[bot]
d3facd93f1 Merge pull request #4121 from jupyterhub/dependabot/github_actions/docker/setup-buildx-action-2.1.0 2022-10-17 12:46:35 +00:00
Simon Li
8d2a987c81 remove out of date commented tag version 2022-10-17 13:29:25 +01:00
Christian Dike
e7a325ed24 Update docs/source/rbac/tech-implementation.md
update text

Co-authored-by: Min RK <benjaminrk@gmail.com>
2022-10-17 13:20:37 +01:00
Christian Dike
fc6d93bbe3 Update docs/source/rbac/tech-implementation.md
Replace URLs with internal markdown link

Co-authored-by: Min RK <benjaminrk@gmail.com>
2022-10-17 13:20:02 +01:00
Goodness Chris-Ugari
e9f8459681 Merge branch 'jupyterhub:main' into patch-2 2022-10-17 13:06:29 +01:00
Min RK
8785ecd810 Merge pull request #4086 from ArafatAbdussalam/branch2
Updated log messages
2022-10-17 13:45:16 +02:00
Min RK
147f029bf6 Merge pull request #4091 from Goodiec/patch-1
Update config-user-env.md
2022-10-17 13:44:21 +02:00
Min RK
cd440b0f7d Merge pull request #4085 from Goodiec/Goodiec-troubleshooting-doc
Update troubleshooting.md
2022-10-17 13:43:41 +02:00
Min RK
0a9d2b7f76 Merge branch 'main' into branch2 2022-10-17 13:42:02 +02:00
Min RK
658a1fccfe Merge pull request #4083 from ArafatAbdussalam/branch1
updated websecirity.md
2022-10-17 13:10:40 +02:00
dependabot[bot]
ee578dd7b5 Merge pull request #4122 from jupyterhub/dependabot/github_actions/docker/build-push-action-3.2.0 2022-10-17 11:10:16 +00:00
Min RK
d2d9ce9d02 Merge pull request #4074 from ToobaJamal/edit
Update index.rst
2022-10-17 13:05:14 +02:00
Min RK
93529d11bc Merge pull request #4065 from chicken-biryani/community-channels
Modification in community channels docs
2022-10-17 13:01:00 +02:00
dependabot[bot]
9d630add9a Bump docker/setup-buildx-action from 2.0.0 to 2.1.0
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2.0.0 to 2.1.0.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](dc7b9719a9...95cb08cb26)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-17 10:53:28 +00:00
dependabot[bot]
ea88427b7f Bump docker/build-push-action from 3.1.1 to 3.2.0
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 3.1.1 to 3.2.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](c84f382811...c56af95754)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-17 10:53:28 +00:00
Simon Li
cc4a3da32c Merge pull request #4123 from jupyterhub/dependabot/github_actions/docker/setup-qemu-action-2.1.0
Bump docker/setup-qemu-action from 2.0.0 to 2.1.0
2022-10-17 11:52:42 +01:00
Goodness Chris-Ugari
c7f14eec14 Update troubleshooting.md
Removed static header items
2022-10-17 11:07:39 +01:00
Goodness Chris-Ugari
cf1dcd6f3a Update config-user-env.md
update
2022-10-17 10:59:20 +01:00
dependabot[bot]
bcaaaa2d35 Bump docker/setup-qemu-action from 2.0.0 to 2.1.0
Bumps [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) from 2.0.0 to 2.1.0.
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](8b122486ce...e81a89b173)

---
updated-dependencies:
- dependency-name: docker/setup-qemu-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-17 05:20:46 +00:00
AdrianaHelga
7462cfa6fd Update services-basics.md 2022-10-16 11:01:21 +03:00
Arafat Abdussalam
a785b8d38a I made the correction to the PR
I resolved my previous commit as suggested
2022-10-14 02:59:34 -07:00
Arafat Abdussalam
714b5925f6 Correction of previous commit
I made a correction to my previous commit as suggested. I will def try to avoid such mistakes.
2022-10-14 02:51:40 -07:00
Ngobiri Falyne
de3210536f Update troubleshooting.md
Adjusted the Heading sudospawner - Sudospawner to suite sentence case
Under proxy Settings, i adjusted the sentence "a organization to an organization" also singleuser to single-user
under Toree intergration, the sentence is not clear so I adjusted to Toree kernel will raise and issue when running with jupyterHub,
2022-10-14 04:53:09 +01:00
Eshy10
e6e1e90386 chore: captitalize the first letter on explation of hub environment 2022-10-14 03:04:08 +01:00
Eshy10
0667451584 chore: remove duplicate version statement and add color to environments title 2022-10-14 02:55:27 +01:00
Alexander Chosen okon
35d26e75f4 Documentation reviewed, made concise & image added 2022-10-13 23:20:10 +00:00
pre-commit-ci[bot]
9f62c76a8e [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-13 22:41:04 +00:00
Esther Christopher
72096b5166 Edited for Clarity
Edited for sentence restructuring, sentence clarity, change of grammar, grammatical punctuation errors, and grammatical correctness.
2022-10-13 17:00:49 +01:00
Zeelyha
88906c2e1b Update templates.md
Fixed a typo
2022-10-13 15:13:30 +01:00
Esther Christopher
67b62db524 Reviewed the documentation
1. Edited the topic of the documentation to Pascal Case.
2. Completed a sentence for clarity
2022-10-13 13:04:42 +01:00
Allan Wasega
f9dbfd7275 Edited and restructured server-api file 2022-10-13 08:58:42 +03:00
Deborah Udoh
b15d56432d Proofread and improve security-basics.rst 2022-10-12 16:21:07 +01:00
Chidinma Udo
a10879f493 Modifications to URLs docs 2022-10-12 16:20:18 +01:00
Tooba Jamal
c2d1a21d32 update spawners-basics.md 2022-10-12 20:18:18 +05:00
Tooba Jamal
8060003fd6 update spawners-basics.md 2022-10-12 20:12:20 +05:00
Shloka
5018c13b81 Fixes 2022-10-12 19:31:04 +05:30
Tooba Jamal
99255b04ac fix typo 2022-10-12 18:59:56 +05:00
Christian Dike
2e6949c6e1 add reference for github oauth config with jupyter
add link to the reference documentation for github oauth configuration with jupyterhub. Fix typos
2022-10-12 14:59:31 +01:00
Tooba Jamal
0f5f0f0df9 update index.rst
Made the requested changes
2022-10-12 18:58:28 +05:00
Goodness Chris-Ugari
da302f5206 Update config-proxy.md
This PR improves the proxy configuration doc and is part of [issue 41](https://github.com/jupyterhub/outreachy/issues/41)
2022-10-12 14:51:22 +01:00
Shloka
b0f90a0f4b Update docs/source/contributing/tests.rst
Co-authored-by: Simon Li <orpheus+devel@gmail.com>
2022-10-12 19:08:01 +05:30
Shloka
7a915533a6 Update docs/source/contributing/tests.rst
Co-authored-by: Simon Li <orpheus+devel@gmail.com>
2022-10-12 19:07:50 +05:30
Shloka
733e018bdc Update docs/source/contributing/tests.rst
Co-authored-by: Simon Li <orpheus+devel@gmail.com>
2022-10-12 19:07:43 +05:30
Busayo-ojo
4380d1c15a Fixed typos and added punctuations 2022-10-12 14:33:58 +01:00
pre-commit-ci[bot]
a87872e7aa [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-12 13:28:00 +00:00
Shloka
578c78397a Modifications 2022-10-12 18:56:30 +05:30
Shloka
0820f4cfa1 Modifications 2022-10-12 18:52:58 +05:30
Ojoachele Onuh
f386da1b7a fixed some typos and technical terms 2022-10-12 13:12:08 +01:00
Goodness Chris-Ugari
71ce37b834 Update troubleshooting.md
Implement suggested changes.
2022-10-12 13:02:12 +01:00
Goodness Chris-Ugari
64965b7a2e Merge branch 'jupyterhub:main' into Goodiec-troubleshooting-doc 2022-10-12 12:53:25 +01:00
pre-commit-ci[bot]
ef7545fc75 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-12 11:34:19 +00:00
pre-commit-ci[bot]
af95d643b1 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-12 11:33:54 +00:00
Goodness Chris-Ugari
67bca186b4 Update config-user-env.md
This PR improves the 'Configuring user environments' doc and is part of [issue 41](https://github.com/jupyterhub/outreachy/issues/41)
2022-10-12 12:31:44 +01:00
Temidayo
08a125489d fixed a typo 2022-10-12 12:29:07 +01:00
Temidayo
1050dadda4 modified announcement README and config.py 2022-10-12 12:27:57 +01:00
Min RK
5997614f45 Merge pull request #4073 from ikeadeoyin/quickstart-docker-guide
improved the quickstart docker guide
2022-10-12 12:40:08 +02:00
Georgiana
7e78394eb2 Merge pull request #4079 from mahamtariq58/documentation
Improve the documentation about log messages
2022-10-12 12:39:53 +02:00
Min RK
fd2717c5ce Merge pull request #4071 from NPDebs/main
Improve Documentation
2022-10-12 12:35:09 +02:00
Tooba Jamal
dcd4e689aa update index.rst 2022-10-12 12:09:57 +05:00
Tooba Jamal
6ef8120f94 fix grammatical error 2022-10-12 10:58:13 +05:00
Joel-Ando
a697c80475 Update tech-implementation.md 2022-10-12 01:10:09 +01:00
mahamtariq58
c675c29fce Update docs/source/admin/log-messages.md
Co-authored-by: Georgiana <georgiana.dolocan@gmail.com>
2022-10-12 02:53:58 +05:00
mahamtariq58
9b44eec7f7 Update docs/source/admin/log-messages.md
Co-authored-by: Georgiana <georgiana.dolocan@gmail.com>
2022-10-12 02:53:43 +05:00
mahamtariq58
9cb4173042 Update docs/source/admin/log-messages.md
Co-authored-by: Georgiana <georgiana.dolocan@gmail.com>
2022-10-12 02:53:24 +05:00
Christian Dike
916a83a954 Update tech-implementation.md
Fix typos and grammatical errors. Improve sentence structure. Use appropriate technical terms.
2022-10-11 19:03:21 +01:00
mahamtariq58
6933e8fb33 Update docs/source/admin/log-messages.md
Co-authored-by: Georgiana <georgiana.dolocan@gmail.com>
2022-10-11 19:57:11 +05:00
Tooba Jamal
8f30f4afd9 update upgrading.rst 2022-10-11 19:40:15 +05:00
Tooba Jamal
d5790ce386 update upgrading.rst 2022-10-11 19:38:36 +05:00
Tooba Jamal
6b4c5e4bce update upgrading.rst 2022-10-11 19:36:04 +05:00
Tooba Jamal
15cf30156d update upgrading.rst 2022-10-11 19:12:03 +05:00
Georgiana
dff0f054d0 Merge pull request #4068 from Goodiec/Goodiec-improve-setup-doc-apge
Update setup.rst
2022-10-11 14:33:27 +02:00
Goodness Chris-Ugari
45b5a249c6 Update setup.rst
Corrected JupyterHub capitalization
2022-10-11 13:02:10 +01:00
Georgiana
e3a25a883f Merge pull request #4070 from Mackenzie-OO7/mackenzie-oo7
Update the Technical Overview Docs
2022-10-11 14:00:19 +02:00
pre-commit-ci[bot]
3ee21cc967 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-11 09:17:46 +00:00
Arafat Abdussalam
941e8c928a Updated log messages
I improved the log message subsection of the documentation by making the page more user friendly
2022-10-11 10:14:03 +01:00
pre-commit-ci[bot]
5d5a424aea [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-11 08:40:40 +00:00
Goodness Chris-Ugari
f2059c0d03 Update troubleshooting.md
This PR improves the troubleshooting doc and is part of [issue 41](https://github.com/jupyterhub/outreachy/issues/41)
2022-10-11 09:37:54 +01:00
Goodness Chris-Ugari
20f6b13e86 Merge branch 'jupyterhub:main' into Goodiec-improve-setup-doc-apge 2022-10-11 09:14:54 +01:00
Melissa Kirabo
eb6bf3f698 Update index.rst
I have made some changes to the flow of the documentation, added descriptions, and corrected grammatical errors
2022-10-11 10:06:24 +03:00
Arafat Abdussalam
b87b8c52d3 updated websecirity.md
I have the grammatical errors written on the page such as improving the abbreviated words with apostrophes and other typos
2022-10-11 07:21:19 +01:00
pre-commit-ci[bot]
a2852b1b2b [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-10 22:41:59 +00:00
mahamtariq58
b98e981e6a Merge branch 'jupyterhub:main' into documentation 2022-10-11 03:38:52 +05:00
Maham Tariq
d223c0edff Fixed some confused Lines 2022-10-11 02:58:19 +05:00
pre-commit-ci[bot]
53bf7a18ae [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-10 17:03:46 +00:00
Deborah Udoh
835fe8be8f Update roles.md in line with review 2022-10-10 18:03:13 +01:00
Deborah Udoh
ed71aead2b Update roles.md
Co-authored-by: Min RK <benjaminrk@gmail.com>
2022-10-10 17:56:35 +01:00
Georgiana
5713e56fd1 Merge pull request #4067 from Uzor13/uzor-dev
Fixed some typos and add missing links
2022-10-10 14:39:24 +02:00
Uzochukwu Precious
eb65bd7dd6 role link added to note 2022-10-10 12:34:14 +01:00
Tooba Jamal
aa101a7aff Update index.rst 2022-10-10 15:36:10 +05:00
ikeadeoyin
743406e60d made the necessary changes 2022-10-10 10:50:49 +01:00
Chidinma Udo
7f191ea5e8 Applied suggestions from code review
Co-authored-by: Min RK <benjaminrk@gmail.com>
2022-10-10 10:41:57 +01:00
Tooba Jamal
915fab2d26 Update index.rst 2022-10-10 12:55:16 +05:00
ikeadeoyin
b961925bbc improved the quickstart docker guide 2022-10-10 08:48:43 +01:00
Tooba Jamal
3425269cb2 Update index.rst 2022-10-10 12:34:09 +05:00
Min RK
9280621ca8 Merge pull request #4063 from minrk/resolve-excluded-scopes
Fully resolve requested scopes in oauth
2022-10-10 09:24:43 +02:00
ruqayaahh
2661eab54b updated obsolete links and made wordings clearer 2022-10-10 06:07:38 +01:00
pre-commit-ci[bot]
18b1df8bc6 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-09 19:07:30 +00:00
Deborah Udoh
674c441935 Improve documentation 2022-10-09 19:37:59 +01:00
Uzochukwu Precious
e324d89f8a review update 2022-10-09 17:44:32 +01:00
Chidinma Udo
433bb09e9e fixed broken link 2022-10-09 17:13:53 +01:00
Chidinma Udo
facf8039c3 fixed some typos and embedded links 2022-10-09 17:02:27 +01:00
Shloka
395b1a5681 Modifications is testing docs 2022-10-09 19:07:20 +05:30
Goodness Chris-Ugari
65caf37d71 Update setup.rst
This PR improves the setup page and is part of issue #41
2022-10-09 12:37:52 +01:00
Uzochukwu Precious
f5cb617ce7 fixed some typos and also added links #41 2022-10-08 23:16:44 +01:00
pre-commit-ci[bot]
204bfaf8f4 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-10-08 17:13:41 +00:00
Shloka
f0c825cc1e Modification in community channels 2022-10-08 22:40:22 +05:30
Erik Sundell
fd5705b74b Align test variables' naming with tested function's terminology 2022-10-08 17:03:50 +02:00
Min RK
7585026f81 consistent naming, docstrings for disallowed scopes 2022-10-07 10:45:14 -07:00
Min RK
a4fd0980a3 Back off removal of read:servers -> read:users:name
Only remove it when using the !server filter, which doesn't make sense for read:users:name
2022-10-07 10:29:48 -07:00
Erik Sundell
c126cc3f9b Merge pull request #4064 from minrk/oauth-deprecado
set stacklevel for oauth_scopes deprecation warning
2022-10-06 12:51:04 +02:00
Min RK
f70b11af11 resolve full scope intersection for oauth
allows subset filters in oauth (e.g. server requests scope!server while user has scope!user)
2022-10-05 19:53:54 -07:00
Min RK
6024a9780f remove implicit grant of read:users:name from read:servers
results in weird extra permission that aren't needed
2022-10-05 19:53:54 -07:00
Min RK
63c391641a set stacklevel for oauth_scopes deprecation warning
so it's visible where the deprecated API is called
2022-10-05 18:49:32 -07:00
Erik Sundell
7a6c2038d8 Merge pull request #4061 from Temidayo32/main
modified the contributing documentation
2022-10-03 16:12:37 +02:00
Temidayo
83fb49e7cf Merge branch 'jupyterhub:main' into main 2022-10-02 14:52:24 +01:00
Temidayo
15bf61df2a modified the contributing documentation 2022-10-02 14:39:51 +01:00
Min RK
387e983543 Merge pull request #4053 from danilopeixoto/callable-named-server-limit
Set named_server_limit_per_user type as integer or callable
2022-09-30 09:44:15 +02:00
Danilo Peixoto
37d35953bc Set named_server_limit_per_user type as integer or callable 2022-09-30 09:28:04 +02:00
Min RK
666b3cb36e Merge pull request #4054 from jupyterhub/dependabot/github_actions/char0n/swagger-editor-validate-1.3.2
Bump char0n/swagger-editor-validate from 1.3.1 to 1.3.2
2022-09-30 09:24:41 +02:00
dependabot[bot]
2c897a7ca3 Bump char0n/swagger-editor-validate from 1.3.1 to 1.3.2
Bumps [char0n/swagger-editor-validate](https://github.com/char0n/swagger-editor-validate) from 1.3.1 to 1.3.2.
- [Release notes](https://github.com/char0n/swagger-editor-validate/releases)
- [Commits](https://github.com/char0n/swagger-editor-validate/compare/v1.3.1...v1.3.2)

---
updated-dependencies:
- dependency-name: char0n/swagger-editor-validate
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-26 05:27:06 +00:00
Min RK
1a0b46a5c8 Merge pull request #4046 from Neeraj-Natu/main
mentioning limitations of spawner.environment
2022-09-23 13:32:50 +02:00
pre-commit-ci[bot]
596f9669d7 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-09-23 11:25:40 +00:00
neerajnatu
55fbb0b5fe review comments address 2022-09-23 16:54:53 +05:30
Min RK
a3795ad672 Merge pull request #4035 from manics/docker-yarn
setup.py: require npm, check that NPM CSS JSX commands succeed
2022-09-23 10:49:44 +02:00
Min RK
38afbcc0d0 Merge pull request #4045 from miwig/fix_crash_when_removing_scopes
Fix crash when removing scopes attribute from an existing role
2022-09-22 15:08:27 +02:00
mouse1203
08b71e7f56 adding asyncio.sleep into test_invalid_credantials
added asyncio.sleep into test_invalid_credantials
2022-09-19 16:28:33 +02:00
mouse1203
9d90496549 updating regarding to the review
removed time.sleep(), removed inrelevant comments, removed unused packages, added few explanations for some functions (in progress), documenting  in progress, added to conftest.py package with Options class
2022-09-19 15:18:07 +02:00
Simon Li
df222de915 verify sdist can be installed without npm/yarn 2022-09-18 17:14:05 +01:00
pre-commit-ci[bot]
01e4f2b974 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-09-17 10:27:34 +00:00
neerajnatu
bffdf690d9 adding to contributor list 2022-09-17 15:49:26 +05:30
neerajnatu
0f06c9376a mentioning limitations of spawner.environment 2022-09-17 15:17:23 +05:30
pre-commit-ci[bot]
99eb8d6a2a [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-09-16 12:43:30 +00:00
Michael Wigard
3bb0d57e35 Fix crash when removing scopes attribute from an existing role 2022-09-16 14:27:12 +02:00
Min RK
29ffb23d67 Merge pull request #4039 from hjoliver/fix-launch-instance 2022-09-13 17:05:11 +02:00
Min RK
729099f87d test coverage for launch_instance(argv) 2022-09-13 12:02:02 +02:00
Hilary James Oliver
daf395c2c3 Pass launch_instance args on correctly. 2022-09-13 09:27:49 +12:00
Simon Li
8b68286486 setup.py: require npm, check that NPM CSS JSX commands succeed 2022-09-10 17:59:53 +01:00
Erik Sundell
ad44b16104 Merge pull request #4034 from manics/docker-yarn
Fix Dockerfile yarn JSX build
2022-09-10 16:42:04 +02:00
Simon Li
fa33faeefa Dockerfile: check static/js/admin-react.js exists 2022-09-10 12:31:27 +01:00
Simon Li
a3b20bb220 Dockerfile: install yarn with npm 2022-09-10 12:24:17 +01:00
Simon Li
b644052cb4 Dockerfile: Use python -m build to match release workflow 2022-09-10 12:12:58 +01:00
Min RK
02dead8ab1 Bump to 3.1.0.dev 2022-09-09 08:37:18 +02:00
Min RK
24506888ea Bump to 3.0.0 2022-09-09 08:32:58 +02:00
Min RK
457ad3ec85 Merge pull request #4029 from consideRatio/pr/update-changelog-for-3.0.0
Update changelog for 3.0.0
2022-09-09 08:16:24 +02:00
Min RK
75e8274a7b date for 3.0.0 2022-09-09 08:16:07 +02:00
Min RK
dd69213a3c [capacity doc]: add concurrent user section 2022-09-07 12:42:41 +02:00
Min RK
1aafdb1d1b doc: More suggestions from review
- add costs, links
- labels for use cases
- literal math formatting
2022-09-07 12:29:09 +02:00
pre-commit-ci[bot]
9a84b9d9a1 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-09-07 09:56:00 +00:00
Min RK
bf6786c55b Apply suggestions from code review
Co-authored-by: Chris Holdgraf <choldgraf@gmail.com>
2022-09-07 11:55:33 +02:00
Erik Sundell
2a3ceff29f Update changelog for 3.0.0 2022-09-07 09:58:17 +02:00
Min RK
1e9614b218 Add capacity planning doc 2022-09-06 12:25:39 +02:00
Erik Sundell
5e29605341 Merge pull request #4018 from minrk/reset-offset
reset offset to 0 on name filter change
2022-09-05 18:46:08 +02:00
Min RK
34b6bc3a3f call reducers in some tests
allows testing reducer functionality

workaround bug preventing mocked useSelector from behaving realistically
2022-09-05 15:09:11 +02:00
Min RK
485190e5af make selenium tests opt-in
avoids running them over and over again
2022-09-02 14:00:19 +02:00
Min RK
b90200667f fix headless firefox option 2022-09-02 14:00:19 +02:00
mouse1203
5885f88d79 Update jupyterhub/tests/selenium/conftest.py
Co-authored-by: Min RK <benjaminrk@gmail.com>
2022-09-02 13:43:20 +02:00
mouse1203
b87561d396 remove conditional for FireFox
removing conditionals for FF
2022-09-02 13:32:11 +02:00
mouse1203
10aba2c038 Merge branch 'main' of https://github.com/jupyterhub/jupyterhub 2022-09-02 13:14:28 +02:00
mouse1203
09c4fee780 add selenium tests 2022-09-02 13:12:31 +02:00
Erik Sundell
7a48da1916 Merge pull request #4022 from possiblyMikeB/token-template-correction
Use correct expiration labels in drop-down menu on token page.
2022-08-24 20:01:20 +02:00
possiblyMikeB
5eaf59dd72 correct token expiration time labels 2022-08-23 18:29:15 -04:00
Simon Li
73a33ed5fc Merge pull request #4019 from minrk/sync-groups-repeat
avoid database error on repeated group name in sync_groups
2022-08-19 16:54:06 +01:00
Min RK
0b9ae96a96 avoid database error on repeated group name in sync_groups 2022-08-19 10:53:21 +02:00
Min RK
2c9653bc0d reset offset to 0 on name filter change
move offset to redux state, rather than independent,
since it can come from two places (user_page and pagination footer). Keeps things in sync.

Adds reducers for setting offset, name filter explicitly.
2022-08-19 10:25:17 +02:00
Erik Sundell
71e86f3064 Merge pull request #4016 from minrk/edituser-validate
admin: avoid redundant client-side username validation in edit-user
2022-08-16 14:13:49 +02:00
Min RK
8a1110f2c0 admin: avoid redundant client-side username validation
username validation is the server-side's responsibility
2022-08-16 13:48:36 +02:00
Min RK
bb52351a6e Merge pull request #4013 from minrk/test-311
Test 3.11
2022-08-10 11:36:14 +02:00
Min RK
87c745d3bf mock greenlet needs to raise ImportError 2022-08-10 11:02:53 +02:00
Min RK
374c6c848b it's actually greenlet 2022-08-10 10:45:57 +02:00
Min RK
af31ee8c94 condition brackets
Co-authored-by: Erik Sundell <erik.i.sundell@gmail.com>
2022-08-10 10:28:30 +02:00
Min RK
26a9883b93 add mock-gevent to allow install on Python 3.11
gevent is not actually required, but sqlalchemy lists it as a dependency (on linux only)
2022-08-10 10:08:08 +02:00
Min RK
bda3e0c931 test on Python 3.11.0-rc.1 2022-08-10 10:06:37 +02:00
Min RK
f3d17eb77e Merge pull request #4012 from minrk/doc-oauth-no-confirm
document oauth_no_confirm in services
2022-08-10 09:30:48 +02:00
Erik Sundell
5f92cfcc0e Merge pull request #4011 from minrk/trim-form-input
restore trimming of username input
2022-08-10 09:05:34 +02:00
Min RK
b55eaae51f document oauth_no_confirm in services 2022-08-10 08:57:35 +02:00
Min RK
c9e6d6afa3 restore trimming of username input
continue to not trim password or custom fields

trailing/leading space is explicitly forbidden in validate_username
2022-08-10 08:45:50 +02:00
Erik Sundell
2f1d340c42 Merge pull request #4006 from jupyterhub/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-08-09 08:09:29 +02:00
pre-commit-ci[bot]
2ba99656c1 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/PyCQA/flake8: 5.0.2 → 5.0.4](https://github.com/PyCQA/flake8/compare/5.0.2...5.0.4)
2022-08-08 22:58:55 +00:00
Erik Sundell
635f63c1cd Merge pull request #4005 from jupyterhub/dependabot/github_actions/docker/build-push-action-3.1.1
Bump docker/build-push-action from 3.1.0 to 3.1.1
2022-08-08 09:50:23 +02:00
dependabot[bot]
b9b49ff306 Bump docker/build-push-action from 3.1.0 to 3.1.1
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 3.1.0 to 3.1.1.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](1cb9d22b93...c84f382811)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-08 05:29:25 +00:00
Min RK
5640a1506e Merge pull request #4002 from naatebarber/admin-with-pagination-api
Integrate Pagination API into Admin JSX
2022-08-05 12:07:12 +02:00
pre-commit-ci[bot]
4767cfa4e9 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-08-04 14:18:27 +00:00
Nathan Barber
309d687c26 Update jsx/src/components/Groups/Groups.jsx
Co-authored-by: Min RK <benjaminrk@gmail.com>
2022-08-04 10:17:43 -04:00
Nathan Barber
df25c09962 Update jsx/src/components/PaginationFooter/PaginationFooter.jsx
Co-authored-by: Min RK <benjaminrk@gmail.com>
2022-08-04 10:17:35 -04:00
Nathan Barber
09d0909878 Update unit tests to spec 2022-08-03 12:50:29 -04:00
Nathan Barber
72db4624e0 Move user/group queries from app to component uE's 2022-08-03 12:28:05 -04:00
Nathan Barber
e9eca22e3b add useEffect, new pagination style 2022-08-03 12:18:28 -04:00
Nathan Barber
33d4f382d5 Use data.items to display users 2022-08-03 10:59:38 -04:00
Eric Dill
e243812745 Some suggestions from reading through the docs
Thanks to @willingc, @minrk and @manics for the review so far.
This commit is the PR so far rebased onto master and squashed.
2019-07-17 11:51:20 -04:00
152 changed files with 3250 additions and 1637 deletions

View File

@@ -3,14 +3,9 @@
# E: style errors
# W: style warnings
# C: complexity
# F401: module imported but unused
# F403: import *
# F811: redefinition of unused `name` from line `N`
# D: docstring warnings (unused pydocstyle extension)
# F841: local variable assigned but never used
# E402: module level import not at top of file
# I100: Import statements are in the wrong order
# I101: Imported names are in the wrong order. Should be
ignore = E, C, W, F401, F403, F811, F841, E402, I100, I101, D400
ignore = E, C, W, D, F841
builtins = c, get_config
exclude =
.cache,

View File

@@ -62,6 +62,10 @@ jobs:
pip install dist/*.whl
./ci/check_installed_data.py
- name: verify sdist can be installed without npm/yarn
run: |
docker run --rm -v $PWD/dist:/dist:ro docker.io/library/python:3.9-slim-bullseye bash -c 'pip install /dist/jupyterhub-*.tar.gz'
# ref: https://github.com/actions/upload-artifact#readme
- uses: actions/upload-artifact@v3
with:
@@ -104,10 +108,10 @@ jobs:
# https://github.com/docker/build-push-action/tree/v2.4.0#usage
# https://github.com/docker/build-push-action/blob/v2.4.0/docs/advanced/multi-platform.md
- name: Set up QEMU (for docker buildx)
uses: docker/setup-qemu-action@8b122486cedac8393e77aa9734c3528886e4a1a8 # associated tag: v1.0.2
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # associated tag: v1.0.2
- name: Set up Docker Buildx (for multi-arch builds)
uses: docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6 # associated tag: v1.1.2
uses: docker/setup-buildx-action@8c0edbc76e98fa90f69d9a2c020dcb50019dc325
with:
# Allows pushing to registry on localhost:5000
driver-opts: network=host
@@ -145,7 +149,7 @@ jobs:
branchRegex: ^\w[\w-.]*$
- name: Build and push jupyterhub
uses: docker/build-push-action@1cb9d22b932e4832bb29793b7777ec860fc1cde0
uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5
with:
context: .
platforms: linux/amd64,linux/arm64
@@ -166,7 +170,7 @@ jobs:
branchRegex: ^\w[\w-.]*$
- name: Build and push jupyterhub-onbuild
uses: docker/build-push-action@1cb9d22b932e4832bb29793b7777ec860fc1cde0
uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5
with:
build-args: |
BASE_IMAGE=${{ fromJson(steps.jupyterhubtags.outputs.tags)[0] }}
@@ -187,7 +191,7 @@ jobs:
branchRegex: ^\w[\w-.]*$
- name: Build and push jupyterhub-demo
uses: docker/build-push-action@1cb9d22b932e4832bb29793b7777ec860fc1cde0
uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5
with:
build-args: |
BASE_IMAGE=${{ fromJson(steps.onbuildtags.outputs.tags)[0] }}
@@ -211,7 +215,7 @@ jobs:
branchRegex: ^\w[\w-.]*$
- name: Build and push jupyterhub/singleuser
uses: docker/build-push-action@1cb9d22b932e4832bb29793b7777ec860fc1cde0
uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5
with:
build-args: |
JUPYTERHUB_VERSION=${{ github.ref_type == 'tag' && github.ref_name || format('git:{0}', github.sha) }}

View File

@@ -41,7 +41,7 @@ jobs:
- uses: actions/checkout@v3
- name: Validate REST API definition
uses: char0n/swagger-editor-validate@v1.3.1
uses: char0n/swagger-editor-validate@v1.3.2
with:
definition-file: docs/source/_static/rest-api.yml
@@ -55,7 +55,7 @@ jobs:
- name: Install requirements
run: |
pip install -r docs/requirements.txt pytest -e .
pip install -r docs/requirements.txt pytest
- name: pytest docs/
run: |

View File

@@ -29,6 +29,7 @@ env:
# UTF-8 content may be interpreted as ascii and causes errors without this.
LANG: C.UTF-8
PYTEST_ADDOPTS: "--verbose --color=yes"
SQLALCHEMY_WARN_20: "1"
permissions:
contents: read
@@ -71,6 +72,8 @@ jobs:
# NOTE: Since only the value of these parameters are presented in the
# GitHub UI when the workflow run, we avoid using true/false as
# values by instead duplicating the name to signal true.
# Python versions available at:
# https://github.com/actions/python-versions/blob/HEAD/versions-manifest.json
include:
- python: "3.7"
oldest_dependencies: oldest_dependencies
@@ -81,15 +84,13 @@ jobs:
db: mysql
- python: "3.10"
db: postgres
- python: "3.10"
- python: "3.11"
subdomain: subdomain
- python: "3.10"
- python: "3.11"
ssl: ssl
# can't test 3.11.0-beta.4 until a greenlet release
# greenlet is a dependency of sqlalchemy on linux
# see https://github.com/gevent/gevent/issues/1867
# - python: "3.11.0-beta.4"
- python: "3.10"
- python: "3.11"
selenium: selenium
- python: "3.11"
main_dependencies: main_dependencies
steps:
@@ -136,10 +137,11 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: "${{ matrix.python }}"
- name: Install Python dependencies
run: |
pip install --upgrade pip
pip install --upgrade . -r dev-requirements.txt
pip install -e ".[test]"
if [ "${{ matrix.oldest_dependencies }}" != "" ]; then
# take any dependencies in requirements.txt such as tornado>=5.0
@@ -151,6 +153,7 @@ jobs:
if [ "${{ matrix.main_dependencies }}" != "" ]; then
pip install git+https://github.com/ipython/traitlets#egg=traitlets --force
pip install --upgrade --pre sqlalchemy
fi
if [ "${{ matrix.legacy_notebook }}" != "" ]; then
pip uninstall jupyter_server --yes
@@ -205,13 +208,25 @@ jobs:
DB=postgres bash ci/docker-db.sh
DB=postgres bash ci/init-db.sh
fi
- name: Setup Firefox
if: matrix.selenium
uses: browser-actions/setup-firefox@latest
with:
firefox-version: latest
- name: Setup Geckodriver
if: matrix.selenium
uses: browser-actions/setup-geckodriver@latest
- name: Configure selenium tests
if: matrix.selenium
run: echo "PYTEST_ADDOPTS=$PYTEST_ADDOPTS -m selenium" >> "${GITHUB_ENV}"
- name: Run pytest
run: |
pytest --maxfail=2 --cov=jupyterhub jupyterhub/tests
- name: Submit codecov report
run: |
codecov
- uses: codecov/codecov-action@v3
docker-build:
runs-on: ubuntu-20.04

View File

@@ -11,12 +11,21 @@
repos:
# Autoformat: Python code, syntax patterns are modernized
- repo: https://github.com/asottile/pyupgrade
rev: v2.37.3
rev: v3.2.2
hooks:
- id: pyupgrade
args:
- --py36-plus
# Autoformat: Python code
- repo: https://github.com/PyCQA/autoflake
rev: v2.0.0
hooks:
- id: autoflake
# args ref: https://github.com/PyCQA/autoflake#advanced-usage
args:
- --in-place
# Autoformat: Python code
- repo: https://github.com/pycqa/isort
rev: 5.10.1
@@ -25,19 +34,19 @@ repos:
# Autoformat: Python code
- repo: https://github.com/psf/black
rev: 22.6.0
rev: 22.10.0
hooks:
- id: black
# Autoformat: markdown, yaml, javascript (see the file .prettierignore)
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
rev: v3.0.0-alpha.4
hooks:
- id: prettier
# Autoformat and linting, misc. details
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: end-of-file-fixer
exclude: share/jupyterhub/static/js/admin-react.js
@@ -47,6 +56,6 @@ repos:
# Linting: Python code (see the file .flake8)
- repo: https://github.com/PyCQA/flake8
rev: "5.0.2"
rev: "6.0.0"
hooks:
- id: flake8

View File

@@ -1,3 +1,7 @@
# Configuration on how ReadTheDocs (RTD) builds our documentation
# ref: https://readthedocs.org/projects/jupyterhub/
# ref: https://docs.readthedocs.io/en/stable/config-file/v2.html
#
version: 2
sphinx:
@@ -11,10 +15,11 @@ build:
python:
install:
- method: pip
path: .
- requirements: docs/requirements.txt
formats:
# Adding htmlzip enables a Downloads section in the rendered website's RTD
# menu where the html build can be downloaded. This doesn't require any
# additional configuration in docs/source/conf.py.
#
- htmlzip
- epub

View File

@@ -35,13 +35,14 @@ RUN apt-get update \
python3-dev \
python3-pip \
python3-pycurl \
python3-venv \
nodejs \
npm \
yarn \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN python3 -m pip install --upgrade setuptools pip wheel
RUN python3 -m pip install --upgrade setuptools pip build wheel
RUN npm install --global yarn
# copy everything except whats in .dockerignore, its a
# compromise between needing to rebuild and maintaining
@@ -51,7 +52,7 @@ WORKDIR /src/jupyterhub
# Build client component packages (they will be copied into ./share and
# packaged with the built wheel.)
RUN python3 setup.py bdist_wheel
RUN python3 -m build --wheel
RUN python3 -m pip wheel --wheel-dir wheelhouse dist/*.whl

View File

@@ -190,7 +190,7 @@ 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 a ssl enabled proxy.
configuration or by using an ssl enabled proxy.
[Mounting volumes](https://docs.docker.com/engine/admin/volumes/volumes/) will
allow you to **store data outside the docker image (host system) so it will be persistent**, even when you start

View File

@@ -1,39 +1,42 @@
# How to make a release
`jupyterhub` is a package [available on
PyPI](https://pypi.org/project/jupyterhub/) and
[conda-forge](https://conda-forge.org/).
These are instructions on how to make a release on PyPI.
The PyPI release is done automatically by CI when a tag is pushed.
`jupyterhub` is a package available on [PyPI][] and [conda-forge][].
These are instructions on how to make a release.
For you to follow along according to these instructions, you need:
## Pre-requisites
- To have push rights to the [jupyterhub GitHub
repository](https://github.com/jupyterhub/jupyterhub).
- Push rights to [jupyterhub/jupyterhub][]
- Push rights to [conda-forge/jupyterhub-feedstock][]
## Steps to make a release
1. Create a PR updating `docs/source/changelog.md` with [github-activity][] and
continue only when its merged.
```shell
pip install github-activity
github-activity --heading-level=3 jupyterhub/jupyterhub
```
1. Checkout main and make sure it is up to date.
```shell
ORIGIN=${ORIGIN:-origin} # set to the canonical remote, e.g. 'upstream' if 'origin' is not the official repo
git checkout main
git fetch $ORIGIN main
git reset --hard $ORIGIN/main
git fetch origin main
git reset --hard origin/main
```
1. Make sure `docs/source/changelog.md` is up-to-date.
[github-activity][] can help with this.
1. Update the version with `tbump`.
You can see what will happen without making any changes with `tbump --dry-run ${VERSION}`
1. Update the version, make commits, and push a git tag with `tbump`.
```shell
pip install tbump
tbump --dry-run ${VERSION}
tbump ${VERSION}
```
This will tag and publish a release,
which will be finished on CI.
Following this, the [CI system][] will build and publish a release.
1. Reset the version back to dev, e.g. `2.1.0.dev` after releasing `2.0.0`
@@ -42,9 +45,11 @@ For you to follow along according to these instructions, you need:
```
1. Following the release to PyPI, an automated PR should arrive to
[conda-forge/jupyterhub-feedstock][],
check for the tests to succeed on this PR and then merge it to successfully
update the package for `conda` on the conda-forge channel.
[conda-forge/jupyterhub-feedstock][] with instructions.
[github-activity]: https://github.com/choldgraf/github-activity
[pypi]: https://pypi.org/project/jupyterhub/
[conda-forge]: https://anaconda.org/conda-forge/jupyterhub
[jupyterhub/jupyterhub]: https://github.com/jupyterhub/jupyterhub
[conda-forge/jupyterhub-feedstock]: https://github.com/conda-forge/jupyterhub-feedstock
[github-activity]: https://github.com/executablebooks/github-activity
[ci system]: https://github.com/jupyterhub/jupyterhub/actions/workflows/release.yml

View File

@@ -2,19 +2,34 @@
# Check that installed package contains everything we expect
import os
from pathlib import Path
import jupyterhub
from jupyterhub._data import DATA_FILES_PATH
print("Checking jupyterhub._data")
print(f"DATA_FILES_PATH={DATA_FILES_PATH}")
assert os.path.exists(DATA_FILES_PATH), DATA_FILES_PATH
print("Checking jupyterhub._data", end=" ")
print(f"DATA_FILES_PATH={DATA_FILES_PATH}", end=" ")
DATA_FILES_PATH = Path(DATA_FILES_PATH)
assert DATA_FILES_PATH.is_dir(), DATA_FILES_PATH
for subpath in (
"templates/page.html",
"static/css/style.min.css",
"static/components/jquery/dist/jquery.js",
"static/js/admin-react.js",
):
path = os.path.join(DATA_FILES_PATH, subpath)
assert os.path.exists(path), path
path = DATA_FILES_PATH / subpath
assert path.is_file(), path
print("OK")
print("Checking package_data", end=" ")
jupyterhub_path = Path(jupyterhub.__file__).parent.resolve()
for subpath in (
"alembic.ini",
"alembic/versions/833da8570507_rbac.py",
"event-schemas/server-actions/v1.yaml",
):
path = jupyterhub_path / subpath
assert path.is_file(), path
print("OK")

View File

@@ -3,7 +3,6 @@
import sys
import tarfile
from tarfile import TarFile
expected_files = [
"docs/requirements.txt",

View File

@@ -22,7 +22,7 @@ if [[ "$DB" == "mysql" ]]; then
# ref server: https://hub.docker.com/_/mysql/
# ref client: https://dev.mysql.com/doc/refman/5.7/en/setting-environment-variables.html
#
DOCKER_RUN_ARGS="-p 3306:3306 --env MYSQL_ALLOW_EMPTY_PASSWORD=1 mysql:5.7"
DOCKER_RUN_ARGS="-p 3306:3306 --env MYSQL_ALLOW_EMPTY_PASSWORD=1 mysql:8.0"
READINESS_CHECK="mysql --user root --execute \q"
elif [[ "$DB" == "postgres" ]]; then
# Environment variables can influence both the postgresql server in the
@@ -36,7 +36,7 @@ elif [[ "$DB" == "postgres" ]]; then
# used by the postgresql client psql, so we configure the user based on how
# we want to connect.
#
DOCKER_RUN_ARGS="-p 5432:5432 --env "POSTGRES_USER=${PGUSER}" --env "POSTGRES_PASSWORD=${PGPASSWORD}" postgres:9.5"
DOCKER_RUN_ARGS="-p 5432:5432 --env "POSTGRES_USER=${PGUSER}" --env "POSTGRES_PASSWORD=${PGPASSWORD}" postgres:15.1"
READINESS_CHECK="psql --command \q"
else
echo '$DB must be mysql or postgres'

View File

@@ -19,8 +19,9 @@ else
fi
# Configure a set of databases in the database server for upgrade tests
# this list must be in sync with versions in test_db.py:test_upgrade
set -x
for SUFFIX in '' _upgrade_100 _upgrade_122 _upgrade_130 _upgrade_150 _upgrade_211; do
for SUFFIX in '' _upgrade_110 _upgrade_122 _upgrade_130 _upgrade_150 _upgrade_211; do
$SQL_CLIENT "DROP DATABASE jupyterhub${SUFFIX};" 2>/dev/null || true
$SQL_CLIENT "CREATE DATABASE jupyterhub${SUFFIX} ${EXTRA_CREATE_DATABASE_ARGS:-};"
done

View File

@@ -1,25 +0,0 @@
-r requirements.txt
# temporary pin of attrs for jsonschema 0.3.0a1
# seems to be a pip bug
attrs>=17.4.0
beautifulsoup4
codecov
coverage
cryptography
html5lib # needed for beautifulsoup
jupyterlab >=3
mock
# nbclassic provides the '/tree/' handler, which we use in tests
# it is a transitive dependency via jupyterlab,
# but depend on it directly
nbclassic
pre-commit
pytest>=3.3
pytest-asyncio>=0.17
pytest-cov
requests-mock
tbump
# blacklist urllib3 releases affected by https://github.com/urllib3/urllib3/issues/1683
# I *think* this should only affect testing, not production
urllib3!=1.25.4,!=1.25.5
virtualenv

View File

@@ -1,9 +1,11 @@
## What is Dockerfile.alpine
Dockerfile.alpine contains base image for jupyterhub. It does not work independently, but only as part of a full jupyterhub cluster
Dockerfile.alpine contains the base image for jupyterhub. It does not work independently, but only as part of a full jupyterhub cluster
## How to use it?
You will need:
1. A running configurable-http-proxy, whose API is accessible.
2. A jupyterhub_config file.
3. Authentication and other libraries required by the specific jupyterhub_config file.
@@ -15,6 +17,6 @@ Dockerfile.alpine contains base image for jupyterhub. It does not work independe
- put both containers on the same network (e.g. docker network create jupyterhub; docker run ... --net jupyterhub)
- tell jupyterhub where CHP is (e.g. c.ConfigurableHTTPProxy.api_url = 'http://chp:8001')
- tell jupyterhub not to start the proxy itself (c.ConfigurableHTTPProxy.should_start = False)
- Use dummy authenticator for ease of testing. Update following in jupyterhub_config file
- Use a dummy authenticator for ease of testing. Update following in jupyterhub_config file
- c.JupyterHub.authenticator_class = 'dummyauthenticator.DummyAuthenticator'
- c.DummyAuthenticator.password = "your strong password"

View File

@@ -4,6 +4,11 @@ from jupyterhub._data import DATA_FILES_PATH
print(f"DATA_FILES_PATH={DATA_FILES_PATH}")
for sub_path in ("templates", "static/components", "static/css/style.min.css"):
for sub_path in (
"templates",
"static/components",
"static/css/style.min.css",
"static/js/admin-react.js",
):
path = os.path.join(DATA_FILES_PATH, sub_path)
assert os.path.exists(path), path

View File

@@ -63,6 +63,9 @@ scopes: source/rbac/scope-table.md
source/rbac/scope-table.md: source/rbac/generate-scope-table.py
python3 source/rbac/generate-scope-table.py
# If the pre-requisites for the html target is updated, also update the Read The
# Docs section in docs/source/conf.py.
#
html: metrics scopes
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo

View File

@@ -1,5 +1,4 @@
import os
from os.path import join
from pytablewriter import RstSimpleTableWriter
from pytablewriter.style import Style

View File

@@ -1,12 +1,21 @@
-r ../requirements.txt
# We install the jupyterhub package to help autodoc-traits inspect it and
# generate documentation.
#
# FIXME: If there is a way for this requirements.txt file to pass a flag that
# the build system can intercept to not build the javascript artifacts,
# then do so so. That would mean that installing the documentation can
# avoid needing node/npm installed.
#
--editable .
alabaster_jupyterhub
autodoc-traits
myst-parser
pre-commit
pydata-sphinx-theme
pytablewriter>=0.56
ruamel.yaml
sphinx>=1.7
sphinx>=4
sphinx-copybutton
sphinx-jsonschema
sphinxext-opengraph
sphinxext-rediraffe

View File

@@ -6,7 +6,7 @@ info:
description: The REST API for JupyterHub
license:
name: BSD-3-Clause
version: 3.0.0b1
version: 3.1.1
servers:
- url: /hub/api
security:

View File

@@ -0,0 +1,308 @@
# Capacity planning
General capacity planning advice for JupyterHub is hard to give,
because it depends almost entirely on what your users are doing,
and what JupyterHub users do varies _wildly_ in terms of resource consumption.
**There is no single answer to "I have X users, what resources do I need?" or "How many users can I support with this machine?"**
Here are three _typical_ Jupyter use patterns that require vastly different resources:
- **Learning**: negligible resources because computation is mostly idle,
e.g. students learning programming for the first time
- **Production code**: very intense, sustained load, e.g. training machine learning models
- **Bursting**: _mostly_ idle, but needs a lot of resources for short periods of time
(interactive research often looks like this)
But just because there's no single answer doesn't mean we can't help.
So we have gathered here some useful information to help you make your decisions
about what resources you need based on how your users work,
including the relative invariants in terms of resources that JupyterHub itself needs.
## JupyterHub infrastructure
JupyterHub consists of a few components that are always running.
These take up very little resources,
especially relative to the resources consumed by users when you have more than a few.
As an example, an instance of mybinder.org (running JupyterHub 1.5.0),
running with typically ~100-150 users has:
| Component | CPU (mean/peak) | Memory (mean/peak) |
| --------- | --------------- | ------------------ |
| Hub | 4% / 13% | (230 MB / 260 MB) |
| Proxy | 6% / 13% | (47 MB / 65 MB) |
So it would be pretty generous to allocate ~25% of one CPU core
and ~500MB of RAM to overall JupyterHub infrastructure.
The rest is going to be up to your users.
Per-user overhead from JupyterHub is typically negligible
up to at least a few hundred concurrent active users.
```[figure} ../images/mybinder-hub-components-cpu-memory.png
JupyterHub component resource usage for mybinder.org.
```
## Factors to consider
### Static vs elastic resources
A big factor in planning resources is:
**how much does it cost to change your mind?**
If you are using a single shared machine with local storage,
migrating to a new one because it turns out your users don't fit might be very costly.
You will have to get a new machine, set it up, and maybe even migrate user data.
On the other hand, if you are using ephemeral resources,
such as node pools in Kubernetes,
changing resource types costs close to nothing
because nodes can automatically be added or removed as needed.
Take that cost into account when you are picking how much memory or cpu to allocate to users.
Static resources (like [the-littlest-jupyterhub][]) provide for more **stable, predictable costs**,
but elastic resources (like [zero-to-jupyterhub][]) tend to provide **lower overall costs**
(especially when deployed with monitoring allowing cost optimizations over time),
but which are **less predictable**.
[the-littlest-jupyterhub]: https://the-littlest-jupyterhub.readthedocs.io
[zero-to-jupyterhub]: https://zero-to-jupyterhub.readthedocs.io
(limits-requests)=
### Limit vs Request for resources
Many scheduling tools like Kubernetes have two separate ways of allocating resources to users.
A **Request** or **Reservation** describes how much resources are _set aside_ for each user.
Often, this doesn't have any practical effect other than deciding when a given machine is considered 'full'.
If you are using expandable resources like an autoscaling Kubernetes cluster,
a new node must be launched and added to the pool if you 'request' more resources than fit on currently running nodes (a cluster **scale-up event**).
If you are running on a single VM, this describes how many users you can run at the same time, full stop.
A **Limit**, on the other hand, enforces a limit to how much resources any given user can consume.
For more information on what happens when users try to exceed their limits, see [](oversubscription).
In the strictest, safest case, you can have these two numbers be the same.
That means that each user is _limited_ to fit within the resources allocated to it.
This avoids **[oversubscription](oversubscription)** of resources (allowing use of more than you have available),
at the expense (in a literal, this-costs-money sense) of reserving lots of usually-idle capacity.
However, you often find that a small fraction of users use more resources than others.
In this case you may give users limits that _go beyond the amount of resources requested_.
This is called **oversubscribing** the resources available to users.
Having a gap between the request and the limit means you can fit a number of _typical_ users on a node (based on the request),
but still limit how much a runaway user can gobble up for themselves.
(oversubscription)=
### Oversubscribed CPU is okay, running out of memory is bad
An important consideration when assigning resources to users is: **What happens when users need more than I've given them?**
A good summary to keep in mind:
> When tasks don't get enough CPU, things are slow.
> When they don't get enough memory, things are broken.
This means it's **very important that users have enough memory**,
but much less important that they always have exclusive access to all the CPU they can use.
This relates to [Limits and Requests](limits-requests),
because these are the consequences of your limits and/or requests not matching what users actually try to use.
A table of mismatched resource allocation situations and their consequences:
| issue | consequence |
| -------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| Requests too high | Unnecessarily high cost and/or low capacity. |
| CPU limit too low | Poor performance experienced by users |
| CPU oversubscribed (too-low request + too-high limit) | Poor performance across the system; may crash, if severe |
| Memory limit too low | Servers killed by Out-of-Memory Killer (OOM); lost work for users |
| Memory oversubscribed (too-low request + too-high limit) | System memory exhaustion - all kinds of hangs and crashes and weird errors. Very bad. |
Note that the 'oversubscribed' problem case is where the request is lower than _typical_ usage,
meaning that the total reserved resources isn't enough for the total _actual_ consumption.
This doesn't mean that _all_ your users exceed the request,
just that the _limit_ gives enough room for the _average_ user to exceed the request.
All of these considerations are important _per node_.
Larger nodes means more users per node, and therefore more users to average over.
It also means more chances for multiple outliers on the same node.
### Example case for oversubscribing memory
Take for example, this system and sampling of user behavior:
- System memory = 8G
- memory request = 1G, limit = 3G
- typical 'heavy' user: 2G
- typical 'light' user: 0.5G
This will assign 8 users to those 8G of RAM (remember: only requests are used for deciding when a machine is 'full').
As long as the total of 8 users _actual_ usage is under 8G, everything is fine.
But the _limit_ allows a total of 24G to be used,
which would be a mess if everyone used their full limit.
But _not_ everyone uses the full limit, which is the point!
This pattern is fine if 1/8 of your users are 'heavy' because _typical_ usage will be ~0.7G,
and your total usage will be ~5G (`1 × 2 + 7 × 0.5 = 5.5`).
But if _50%_ of your users are 'heavy' you have a problem because that means your users will be trying to use 10G (`4 × 2 + 4 × 0.5 = 10`),
which you don't have.
You can make guesses at these numbers, but the only _real_ way to get them is to measure (see [](measuring)).
### CPU:memory ratio
Most of the time, you'll find that only one resource is the limiting factor for your users.
Most often it's memory, but for certain tasks, it could be CPU (or even GPUs).
Many cloud deployments have just one or a few fixed ratios of cpu to memory
(e.g. 'general purpose', 'high memory', and 'high cpu').
Setting your secondary resource allocation according to this ratio
after selecting the more important limit results in a balanced resource allocation.
For instance, some of Google Cloud's ratios are:
| node type | GB RAM / CPU core |
| ----------- | ----------------- |
| n2-highmem | 8 |
| n2-standard | 4 |
| n2-highcpu | 1 |
(idleness)=
### Idleness
Jupyter being an interactive tool means people tend to spend a lot more time reading and thinking than actually running resource-intensive code.
This significantly affects how much _cpu_ resources a typical active user needs,
but often does not significantly affect the _memory_.
Ways to think about this:
- More idle users means unused CPU.
This generally means setting your CPU _limit_ higher than your CPU _request_.
- What do your users do when they _are_ running code?
Is it typically single-threaded local computation in a notebook?
If so, there's little reason to set a limit higher than 1 CPU core.
- Do typical computations take a long time, or just a few seconds?
Longer typical computations means it's more likely for users to be trying to use the CPU at the same moment,
suggesting a higher _request_.
- Even with idle users, parallel computation adds up quickly - one user fully loading 4 cores and 3 using almost nothing still averages to more than a full CPU core per user.
- Long-running intense computations suggest higher requests.
Again, using mybinder.org as an example—we run around 100 users on 8-core nodes,
and still see fairly _low_ overall CPU usage on each user node.
The limit here is actually Kubernetes' pods per node, not memory _or_ CPU.
This is likely a extreme case, as many Binder users come from clicking links on webpages
without any actual intention of running code.
```[figure} ../images/mybinder-load5.png
mybinder.org node CPU usage is low with 50-150 users sharing just 8 cores
```
### Concurrent users and culling idle servers
Related to [][idleness], all of these resource consumptions and limits are calculated based on **concurrently active users**,
not total users.
You might have 10,000 users of your JupyterHub deployment, but only 100 of them running at any given time.
That 100 is the main number you need to use for your capacity planning.
JupyterHub costs scale very little based on the number of _total_ users,
up to a point.
There are two important definitions for **active user**:
- Are they _actually_ there (i.e. a human interacting with Jupyter, or running code that might be )
- Is their server running (this is where resource reservations and limits are actually applied)
Connecting those two definitions (how long are servers running if their humans aren't using them) is an important area of deployment configuration, usually implemented via the [JupyterHub idle culler service][idle-culler].
[idle-culler]: https://github.com/jupyterhub/jupyterhub-idle-culler
There are a lot of considerations when it comes to culling idle users that will depend:
- How much does it save me to shut down user servers? (e.g. keeping an elastic cluster small, or keeping a fixed-size deployment available to active users)
- How much does it cost my users to have their servers shut down? (e.g. lost work if shutdown prematurely)
- How easy do I want it to be for users to keep their servers running? (e.g. Do they want to run unattended simulations overnight? Do you want them to?)
Like many other things in this guide, there are many correct answers leading to different configuration choices.
For more detail on culling configuration and considerations, consult the [JupyterHub idle culler documentation][idle-culler].
## More tips
### Start strict and generous, then measure
A good tip, in general, is to give your users as much resources as you can afford that you think they _might_ use.
Then, use resource usage metrics like prometheus to analyze what your users _actually_ need,
and tune accordingly.
Remember: **Limits affect your user experience and stability. Requests mostly affect your costs**.
For example, a sensible starting point (lacking any other information) might be:
```yaml
request:
cpu: 0.5
mem: 2G
limit:
cpu: 1
mem: 2G
```
(more memory if significant computations are likely - machine learning models, data analysis, etc.)
Some actions
- If you see out-of-memory killer events, increase the limit (or talk to your users!)
- If you see typical memory well below your limit, reduce the request (but not the limit)
- If _nobody_ uses that much memory, reduce your limit
- If CPU is your limiting scheduling factor and your CPUs are mostly idle,
reduce the cpu request (maybe even to 0!).
- If CPU usage continues to be low, increase the limit to 2 or 4 to allow bursts of parallel execution.
(measuring)=
### Measuring user resource consumption
It is _highly_ recommended to deploy monitoring services such as [Prometheus][]
and [Grafana][] to get a view of your users' resource usage.
This is the only way to truly know what your users need.
JupyterHub has some experimental [grafana dashboards][] you can use as a starting point,
to keep an eye on your resource usage.
Here are some sample charts from (again from mybinder.org),
showing >90% of users using less than 10% CPU and 200MB,
but a few outliers near the limit of 1 CPU and 2GB of RAM.
This is the kind of information you can use to tune your requests and limits.
![Snapshot from JupyterHub's Grafana dashboards on mybinder.org](../images/mybinder-user-resources.png)
[prometheus]: https://prometheus.io
[grafana]: https://grafana.com
[grafana dashboards]: https://github.com/jupyterhub/grafana-dashboards
### Measuring costs
Measuring costs may be as important as measuring your users activity.
If you are using a cloud provider, you can often use cost thresholds and quotas to instruct them to notify you if your costs are too high,
e.g. "Have AWS send me an email if I hit X spending trajectory on week 3 of the month."
You can then use this information to tune your resources based on what you can afford.
You can mix this information with user resource consumption to figure out if you have a problem,
e.g. "my users really do need X resources, but I can only afford to give them 80% of X."
This information may prove useful when asking your budget-approving folks for more funds.
### Additional resources
There are lots of other resources for cost and capacity planning that may be specific to JupyterHub and/or your cloud provider.
Here are some useful links to other resources
- [Zero to JupyterHub](https://zero-to-jupyterhub.readthedocs.io) documentation on
- [projecting costs](https://zero-to-jupyterhub.readthedocs.io/en/latest/administrator/cost.html)
- [configuring user resources](https://zero-to-jupyterhub.readthedocs.io/en/latest/jupyterhub/customizing/user-resources.html)
- Cloud platform cost calculators:
- [Google Cloud](https://cloud.google.com/products/calculator/)
- [Amazon AWS](https://calculator.s3.amazonaws.com)
- [Microsoft Azure](https://azure.microsoft.com/en-us/pricing/calculator/)

View File

@@ -1,33 +1,33 @@
# Interpreting common log messages
When debugging errors and outages, looking at the logs emitted by
JupyterHub is very helpful. This document tries to document some common
log messages, and what they mean.
JupyterHub is very helpful. This document intends to describe some common
log messages, what they mean and what are the most common causes that generated them, as well as some possible ways to fix them.
## Failing suspected API request to not-running server
### Example
Your logs might be littered with lines that might look slightly scary
Your logs might be littered with lines that look scary
```
[W 2022-03-10 17:25:19.774 JupyterHub base:1349] Failing suspected API request to not-running server: /hub/user/<user-name>/api/metrics/v1
```
### Most likely cause
### Cause
This likely means that the user's server has stopped running but they
still have a browser tab open. For example, you might have 3 tabs open and you shut
the server down via one.
Another possible reason could be that you closed your laptop and the server was culled for inactivity, then reopened the laptop!
However, the client-side code (JupyterLab, Classic Notebook, etc) doesn't interpret the shut-down server and continues to make some API requests.
This likely means is that the user's server has stopped running but they
still have a browser tab open. For example, you might have 3 tabs open, and shut
your server down via one. Or you closed your laptop, your server was
culled for inactivity, and then you reopen your laptop again! The
client side code (JupyterLab, Classic Notebook, etc) does not know
yet that the server is dead, and continues to make some API requests.
JupyterHub's architecture means that the proxy routes all requests that
don't go to a running user server to the hub process itself. The hub
process then explicitly returns a failure response, so the client knows
that the server is not running anymore. This is used by JupyterLab to
tell you your server is not running anymore, and offer you the option
to let you restart it.
inform the user that the server is not running anymore, and provide an option
to restart it.
Most commonly, you'll see this in reference to the `/api/metrics/v1`
URL, used by [jupyter-resource-usage](https://github.com/jupyter-server/jupyter-resource-usage).
@@ -47,9 +47,9 @@ This log message is benign, and there is usually no action for you to take.
### Cause
JupyterHub requires the `jupyterhub` python package installed inside the image or
environment the user server starts in. This message indicates that the version of
environment, the user server starts in. This message indicates that the version of
the `jupyterhub` package installed inside the user image or environment is not
the same version as the JupyterHub server itself. This is not necessarily always a
the same as the JupyterHub server's version itself. This is not necessarily always a
problem - some version drift is mostly acceptable, and the only two known cases of
breakage are across the 0.7 and 2.0 version releases. In those cases, issues pop
up immediately after upgrading your version of JupyterHub, so **always check the JupyterHub
@@ -67,6 +67,6 @@ aligned, rather than as an indicator of an existing problem.
### Actions you can take
Upgrade the version of the `jupyterhub` package in your user environment or image
so it matches the version of JupyterHub running your JupyterHub server! If you
so that it matches the version of JupyterHub running your JupyterHub server! If you
are using the [zero-to-jupyterhub](https://z2jh.jupyter.org) helm chart, you can find the appropriate
version of the `jupyterhub` package to install in your user image [here](https://jupyterhub.github.io/helm-chart/)

View File

@@ -6,34 +6,34 @@ JupyterHub offers easy upgrade pathways between minor versions. This
document describes how to do these upgrades.
If you are using :ref:`a JupyterHub distribution <index/distributions>`, you
should consult the distribution's documentation on how to upgrade. This
document is if you have set up your own JupyterHub without using a
distribution.
should consult the distribution's documentation on how to upgrade. This documentation is
for those who have set up their JupyterHub without using a distribution.
It is long because is pretty detailed! Most likely, upgrading
This documentation is lengthy because it is quite detailed. Most likely, upgrading
JupyterHub is painless, quick and with minimal user interruption.
The steps are discussed in detail, so if you get stuck at any step you can always refer to this guide.
Read the Changelog
==================
The `changelog <../changelog.html>`_ contains information on what has
changed with the new JupyterHub release, and any deprecation warnings.
The `changelog <../changelog.md>`_ contains information on what has
changed with the new JupyterHub release and any deprecation warnings.
Read these notes to familiarize yourself with the coming changes. There
might be new releases of authenticators & spawners you are using, so
might be new releases of the authenticators & spawners you use, so
read the changelogs for those too!
Notify your users
=================
If you are using the default configuration where ``configurable-http-proxy``
If you use the default configuration where ``configurable-http-proxy``
is managed by JupyterHub, your users will see service disruption during
the upgrade process. You should notify them, and pick a time to do the
upgrade where they will be least disrupted.
If you are using a different proxy, or running ``configurable-http-proxy``
If you use a different proxy or run ``configurable-http-proxy``
independent of JupyterHub, your users will be able to continue using notebook
servers they had already launched, but will not be able to launch new servers
nor sign in.
servers they had already launched, but will not be able to launch new servers or sign in.
Backup database & config
@@ -41,37 +41,37 @@ Backup database & config
Before doing an upgrade, it is critical to back up:
#. Your JupyterHub database (sqlite by default, or MySQL / Postgres
if you used those). If you are using sqlite (the default), you
should backup the ``jupyterhub.sqlite`` file.
#. Your JupyterHub database (SQLite by default, or MySQL / Postgres if you used those).
If you use SQLite (the default), you should backup the ``jupyterhub.sqlite`` file.
#. Your ``jupyterhub_config.py`` file.
#. Your user's home directories. This is unlikely to be affected directly by
a JupyterHub upgrade, but we recommend a backup since user data is very
critical.
#. Your users' home directories. This is unlikely to be affected directly by
a JupyterHub upgrade, but we recommend a backup since user data is critical.
Shutdown JupyterHub
===================
Shut down JupyterHub
====================
Shutdown the JupyterHub process. This would vary depending on how you
have set up JupyterHub to run. Most likely, it is using a process
Shut down the JupyterHub process. This would vary depending on how you
have set up JupyterHub to run. It is most likely using a process
supervisor of some sort (``systemd`` or ``supervisord`` or even ``docker``).
Use the supervisor specific command to stop the JupyterHub process.
Use the supervisor-specific command to stop the JupyterHub process.
Upgrade JupyterHub packages
===========================
There are two environments where the ``jupyterhub`` package is installed:
#. The *hub environment*, which is where the JupyterHub server process
#. The *hub environment*: where the JupyterHub server process
runs. This is started with the ``jupyterhub`` command, and is what
people generally think of as JupyterHub.
#. The *notebook user environments*. This is where the user notebook
#. The *notebook user environments*: where the user notebook
servers are launched from, and is probably custom to your own
installation. This could be just one environment (different from the
hub environment) that is shared by all users, one environment
per user, or same environment as the hub environment. The hub
per user, or the same environment as the hub environment. The hub
launched the ``jupyterhub-singleuser`` command in this environment,
which in turn starts the notebook server.
@@ -92,10 +92,8 @@ with:
conda install -c conda-forge jupyterhub==<version>
Where ``<version>`` is the version of JupyterHub you are upgrading to.
You should also check for new releases of the authenticator & spawner you
are using. You might wish to upgrade those packages too along with JupyterHub,
are using. You might wish to upgrade those packages, too, along with JupyterHub
or upgrade them separately.
Upgrade JupyterHub database
@@ -109,7 +107,7 @@ database. From the hub environment, in the same directory as your
jupyterhub upgrade-db
This should find the location of your database, and run necessary upgrades
This should find the location of your database, and run the necessary upgrades
for it.
SQLite database disadvantages
@@ -118,11 +116,11 @@ SQLite database disadvantages
SQLite has some disadvantages when it comes to upgrading JupyterHub. These
are:
- ``upgrade-db`` may not work, and you may need delete your database
- ``upgrade-db`` may not work, and you may need to delete your database
and start with a fresh one.
- ``downgrade-db`` **will not** work if you want to rollback to an
earlier version, so backup the ``jupyterhub.sqlite`` file before
upgrading
upgrading.
What happens if I delete my database?
-------------------------------------
@@ -137,10 +135,10 @@ resides only in the Hub database includes:
If the following conditions are true, you should be fine clearing the
Hub database and starting over:
- users specified in config file, or login using an external
- users specified in the config file, or login using an external
authentication provider (Google, GitHub, LDAP, etc)
- user servers are stopped during upgrade
- don't mind causing users to login again after upgrade
- user servers are stopped during the upgrade
- don't mind causing users to log in again after the upgrade
Start JupyterHub
================
@@ -148,7 +146,7 @@ Start JupyterHub
Once the database upgrade is completed, start the ``jupyterhub``
process again.
#. Log-in and start the server to make sure things work as
#. Log in and start the server to make sure things work as
expected.
#. Check the logs for any errors or deprecation warnings. You
might have to update your ``jupyterhub_config.py`` file to

File diff suppressed because one or more lines are too long

View File

@@ -1,72 +1,70 @@
# Configuration file for Sphinx to build our documentation to HTML.
#
# Configuration reference: https://www.sphinx-doc.org/en/master/usage/configuration.html
#
import contextlib
import datetime
import io
import os
import sys
# Set paths
sys.path.insert(0, os.path.abspath('.'))
# -- General configuration ------------------------------------------------
# Minimal Sphinx version
needs_sphinx = '1.4'
# Sphinx extension modules
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.napoleon',
'autodoc_traits',
'sphinx_copybutton',
'sphinx-jsonschema',
'myst_parser',
]
myst_heading_anchors = 2
myst_enable_extensions = [
'colon_fence',
'deflist',
]
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = 'JupyterHub'
copyright = '2016, Project Jupyter team'
author = 'Project Jupyter team'
# Autopopulate version
from os.path import dirname
docs = dirname(dirname(__file__))
root = dirname(docs)
sys.path.insert(0, root)
import jupyterhub
# The short X.Y version.
version = '%i.%i' % jupyterhub.version_info[:2]
# The full version, including alpha/beta/rc tags.
release = jupyterhub.__version__
language = "en"
exclude_patterns = []
pygments_style = 'sphinx'
todo_include_todos = False
# Set the default role so we can use `foo` instead of ``foo``
default_role = 'literal'
from contextlib import redirect_stdout
from io import StringIO
import subprocess
from docutils import nodes
from sphinx.directives.other import SphinxDirective
# -- Config -------------------------------------------------------------
import jupyterhub
from jupyterhub.app import JupyterHub
# create a temp instance of JupyterHub just to get the output of the generate-config
# and help --all commands.
# -- Project information -----------------------------------------------------
# ref: https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
#
project = "JupyterHub"
author = "Project Jupyter Contributors"
copyright = f"{datetime.date.today().year}, {author}"
version = "%i.%i" % jupyterhub.version_info[:2]
release = jupyterhub.__version__
# -- General Sphinx configuration --------------------------------------------
# ref: https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
#
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.napoleon",
"autodoc_traits",
"sphinx_copybutton",
"sphinx-jsonschema",
"sphinxext.opengraph",
"sphinxext.rediraffe",
"myst_parser",
]
root_doc = "index"
source_suffix = [".md", ".rst"]
# default_role let's use use `foo` instead of ``foo`` in rST
default_role = "literal"
# -- MyST configuration ------------------------------------------------------
# ref: https://myst-parser.readthedocs.io/en/latest/configuration.html
#
myst_heading_anchors = 2
myst_enable_extensions = [
"colon_fence",
"deflist",
]
# -- Custom directives to generate documentation -----------------------------
# ref: https://myst-parser.readthedocs.io/en/latest/syntax/roles-and-directives.html
#
# We define custom directives to help us generate documentation using Python on
# demand when referenced from our documentation files.
#
# Create a temp instance of JupyterHub for use by two separate directive classes
# to get the output from using the "--generate-config" and "--help-all" CLI
# flags respectively.
#
jupyterhub_app = JupyterHub()
@@ -83,8 +81,8 @@ class ConfigDirective(SphinxDirective):
# The generated configuration file for this version
generated_config = jupyterhub_app.generate_config_file()
# post-process output
home_dir = os.environ['HOME']
generated_config = generated_config.replace(home_dir, '$HOME', 1)
home_dir = os.environ["HOME"]
generated_config = generated_config.replace(home_dir, "$HOME", 1)
par = nodes.literal_block(text=generated_config)
return [par]
@@ -100,39 +98,55 @@ class HelpAllDirective(SphinxDirective):
def run(self):
# The output of the help command for this version
buffer = StringIO()
with redirect_stdout(buffer):
jupyterhub_app.print_help('--help-all')
buffer = io.StringIO()
with contextlib.redirect_stdout(buffer):
jupyterhub_app.print_help("--help-all")
all_help = buffer.getvalue()
# post-process output
home_dir = os.environ['HOME']
all_help = all_help.replace(home_dir, '$HOME', 1)
home_dir = os.environ["HOME"]
all_help = all_help.replace(home_dir, "$HOME", 1)
par = nodes.literal_block(text=all_help)
return [par]
def setup(app):
app.add_css_file('custom.css')
app.add_directive('jupyterhub-generate-config', ConfigDirective)
app.add_directive('jupyterhub-help-all', HelpAllDirective)
app.add_css_file("custom.css")
app.add_directive("jupyterhub-generate-config", ConfigDirective)
app.add_directive("jupyterhub-help-all", HelpAllDirective)
source_suffix = ['.rst', '.md']
# source_encoding = 'utf-8-sig'
# -- Read The Docs -----------------------------------------------------------
#
# Since RTD runs sphinx-build directly without running "make html", we run the
# pre-requisite steps for "make html" from here if needed.
#
if os.environ.get("READTHEDOCS"):
docs = os.path.dirname(os.path.dirname(__file__))
subprocess.check_call(["make", "metrics", "scopes"], cwd=docs)
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages.
html_theme = 'pydata_sphinx_theme'
# -- Spell checking ----------------------------------------------------------
# ref: https://sphinxcontrib-spelling.readthedocs.io/en/latest/customize.html#configuration-options
#
# The "sphinxcontrib.spelling" extension is optionally enabled if its available.
#
try:
import sphinxcontrib.spelling # noqa
except ImportError:
pass
else:
extensions.append("sphinxcontrib.spelling")
spelling_word_list_filename = "spelling_wordlist.txt"
html_logo = '_static/images/logo/logo.png'
html_favicon = '_static/images/logo/favicon.ico'
# Paths that contain custom static files (such as style sheets)
html_static_path = ['_static']
htmlhelp_basename = 'JupyterHubdoc'
# -- Options for HTML output -------------------------------------------------
# ref: https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
#
html_logo = "_static/images/logo/logo.png"
html_favicon = "_static/images/logo/favicon.ico"
html_static_path = ["_static"]
html_theme = "pydata_sphinx_theme"
html_theme_options = {
"icon_links": [
{
@@ -149,111 +163,53 @@ html_theme_options = {
"use_edit_page_button": True,
"navbar_align": "left",
}
html_context = {
"github_user": "jupyterhub",
"github_repo": "jupyterhub",
"github_version": "main",
"doc_path": "docs",
"doc_path": "docs/source",
}
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# 'papersize': 'letterpaper',
# 'pointsize': '10pt',
# 'preamble': '',
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(
master_doc,
'JupyterHub.tex',
'JupyterHub Documentation',
'Project Jupyter team',
'manual',
)
# -- Options for linkcheck builder -------------------------------------------
# ref: https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-the-linkcheck-builder
#
linkcheck_ignore = [
r"(.*)github\.com(.*)#", # javascript based anchors
r"(.*)/#%21(.*)/(.*)", # /#!forum/jupyter - encoded anchor edge case
r"https://github.com/[^/]*$", # too many github usernames / searches in changelog
"https://github.com/jupyterhub/jupyterhub/pull/", # too many PRs in changelog
"https://github.com/jupyterhub/jupyterhub/compare/", # too many comparisons in changelog
]
linkcheck_anchors_ignore = [
"/#!",
"/#%21",
]
# latex_logo = None
# latex_use_parts = False
# latex_show_pagerefs = False
# latex_show_urls = False
# latex_appendices = []
# latex_domain_indices = True
# -- manual page output -------------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [(master_doc, 'jupyterhub', 'JupyterHub Documentation', [author], 1)]
# man_show_urls = False
# -- Texinfo output -----------------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(
master_doc,
'JupyterHub',
'JupyterHub Documentation',
author,
'JupyterHub',
'One line description of project.',
'Miscellaneous',
)
]
# texinfo_appendices = []
# texinfo_domain_indices = True
# texinfo_show_urls = 'footnote'
# texinfo_no_detailmenu = False
# -- Epub output --------------------------------------------------------
# Bibliographic Dublin Core info.
epub_title = project
epub_author = author
epub_publisher = author
epub_copyright = copyright
# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']
# -- Intersphinx ----------------------------------------------------------
# -- Intersphinx -------------------------------------------------------------
# ref: https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html#configuration
#
intersphinx_mapping = {
'python': ('https://docs.python.org/3/', None),
'tornado': ('https://www.tornadoweb.org/en/stable/', None),
"python": ("https://docs.python.org/3/", None),
"tornado": ("https://www.tornadoweb.org/en/stable/", None),
}
# -- Options for the opengraph extension -------------------------------------
# ref: https://github.com/wpilibsuite/sphinxext-opengraph#options
#
# ogp_site_url is set automatically by RTD
ogp_image = "_static/logo.png"
ogp_use_first_image = True
# -- Read The Docs --------------------------------------------------------
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if on_rtd:
# readthedocs.org uses their theme by default, so no need to specify it
# build both metrics and rest-api, since RTD doesn't run make
from subprocess import check_call as sh
sh(['make', 'metrics', 'scopes'], cwd=docs)
# -- Spell checking -------------------------------------------------------
try:
import sphinxcontrib.spelling
except ImportError:
pass
else:
extensions.append("sphinxcontrib.spelling")
spelling_word_list_filename = 'spelling_wordlist.txt'
# -- Options for the rediraffe extension -------------------------------------
# ref: https://github.com/wpilibsuite/sphinxext-rediraffe#readme
#
# This extensions help us relocated content without breaking links. If a
# document is moved internally, a redirect like should be configured below to
# help us not break links.
#
rediraffe_branch = "main"
rediraffe_redirects = {
# "old-file": "new-folder/new-file-name",
}

View File

@@ -0,0 +1,27 @@
# Community communication channels
We use different channels of communication for different purposes. Whichever one you use will depend on what kind of communication you want to engage in.
## Discourse (recommended)
We use [Discourse](https://discourse.jupyter.org) for online discussions and support questions.
You can ask questions here if you are a first-time contributor to the JupyterHub project.
Everyone in the Jupyter community is welcome to bring ideas and questions there.
We recommend that you first use our Discourse as all past and current discussions on it are archived and searchable. Thus, all discussions remain useful and accessible to the whole community.
## Gitter
We use [our Gitter channel](https://gitter.im/jupyterhub/jupyterhub) for online, real-time text chat; a place for more ephemeral discussions. When you're not on Discourse, you can stop here to have other discussions on the fly.
## Github Issues
[Github issues](https://docs.github.com/en/issues/tracking-your-work-with-issues/about-issues) are used for most long-form project discussions, bug reports and feature requests.
- Issues related to a specific authenticator or spawner should be opened in the appropriate repository for the authenticator or spawner.
- If you are using a specific JupyterHub distribution (such as [Zero to JupyterHub on Kubernetes](http://github.com/jupyterhub/zero-to-jupyterhub-k8s) or [The Littlest JupyterHub](http://github.com/jupyterhub/the-littlest-jupyterhub/)), you should open issues directly in their repository.
- If you cannot find a repository to open your issue in, do not worry! Open the issue in the [main JupyterHub repository](https://github.com/jupyterhub/jupyterhub/) and our community will help you figure it out.
```{note}
Our community is distributed across the world in various timezones, so please be patient if you do not get a response immediately!
```

View File

@@ -1,30 +0,0 @@
.. _contributing/community:
================================
Community communication channels
================================
We use `Discourse <https://discourse.jupyter.org>` for online discussion.
Everyone in the Jupyter community is welcome to bring ideas and questions there.
In addition, we use `Gitter <https://gitter.im>`_ for online, real-time text chat,
a place for more ephemeral discussions.
The primary Gitter channel for JupyterHub is `jupyterhub/jupyterhub <https://gitter.im/jupyterhub/jupyterhub>`_.
Gitter isn't archived or searchable, so we recommend going to discourse first
to make sure that discussions are most useful and accessible to the community.
Remember that our community is distributed across the world in various
timezones, so be patient if you do not get an answer immediately!
GitHub issues are used for most long-form project discussions, bug reports
and feature requests. Issues related to a specific authenticator or
spawner should be directed to the appropriate repository for the
authenticator or spawner. If you are using a specific JupyterHub
distribution (such as `Zero to JupyterHub on Kubernetes <http://github.com/jupyterhub/zero-to-jupyterhub-k8s>`_
or `The Littlest JupyterHub <http://github.com/jupyterhub/the-littlest-jupyterhub/>`_),
you should open issues directly in their repository. If you can not
find a repository to open your issue in, do not worry! Create it in the `main
JupyterHub repository <https://github.com/jupyterhub/jupyterhub/>`_ and our
community will help you figure it out.
A `mailing list <https://groups.google.com/forum/#!forum/jupyter>`_ for all
of Project Jupyter exists, along with one for `teaching with Jupyter
<https://groups.google.com/forum/#!forum/jupyter-education>`_.

View File

@@ -5,7 +5,7 @@ Contributing Documentation
==========================
Documentation is often more important than code. This page helps
you get set up on how to contribute documentation to JupyterHub.
you get set up on how to contribute to JupyterHub's documentation.
Building documentation locally
==============================
@@ -18,7 +18,7 @@ stored under the ``docs/source`` directory) and converts it into various
formats for people to read. To make sure the documentation you write or
change renders correctly, it is good practice to test it locally.
#. Make sure you have successfuly completed :ref:`contributing/setup`.
#. Make sure you have successfully completed :ref:`contributing/setup`.
#. Install the packages required to build the docs.
@@ -27,7 +27,7 @@ change renders correctly, it is good practice to test it locally.
python3 -m pip install -r docs/requirements.txt
#. Build the html version of the docs. This is the most commonly used
output format, so verifying it renders as you should is usually good
output format, so verifying it renders correctly is usually good
enough.
.. code-block:: bash
@@ -44,8 +44,14 @@ change renders correctly, it is good practice to test it locally.
.. tip::
On macOS, you can open a file from the terminal with ``open <path-to-file>``.
On Linux, you can do the same with ``xdg-open <path-to-file>``.
**On Windows**, you can open a file from the terminal with ``start <path-to-file>``.
**On macOS**, you can do the same with ``open <path-to-file>``.
**On Linux**, you can do the same with ``xdg-open <path-to-file>``.
After opening index.html in your browser you can just refresh the page whenever
you rebuild the docs via ``make html``
.. _contributing/docs/conventions:

View File

@@ -4,7 +4,7 @@ This roadmap collects "next steps" for JupyterHub. It is about creating a
shared understanding of the project's vision and direction amongst
the community of users, contributors, and maintainers.
The goal is to communicate priorities and upcoming release plans.
It is not a aimed at limiting contributions to what is listed here.
It is not aimed at limiting contributions to what is listed here.
## Using the roadmap

View File

@@ -7,7 +7,7 @@ Setting up a development install
System requirements
===================
JupyterHub can only run on MacOS or Linux operating systems. If you are
JupyterHub can only run on macOS or Linux operating systems. If you are
using Windows, we recommend using `VirtualBox <https://virtualbox.org>`_
or a similar system to run `Ubuntu Linux <https://ubuntu.com>`_ for
development.
@@ -15,10 +15,10 @@ development.
Install Python
--------------
JupyterHub is written in the `Python <https://python.org>`_ programming language, and
JupyterHub is written in the `Python <https://python.org>`_ programming language and
requires you have at least version 3.6 installed locally. If you havent
installed Python before, the recommended way to install it is to use
`miniconda <https://conda.io/miniconda.html>`_. Remember to get the Python 3 version,
`Miniconda <https://conda.io/miniconda.html>`_. Remember to get the Python 3 version,
and **not** the Python 2 version!
Install nodejs
@@ -26,13 +26,16 @@ Install nodejs
`NodeJS 12+ <https://nodejs.org/en/>`_ is required for building some JavaScript components.
``configurable-http-proxy``, the default proxy implementation for JupyterHub, is written in Javascript.
If you have not installed nodejs before, we recommend installing it in the ``miniconda`` environment you set up for Python.
If you have not installed NodeJS before, we recommend installing it in the ``miniconda`` environment you set up for Python.
You can do so with ``conda install nodejs``.
Many in the Jupyter community use [``nvm``](https://github.com/nvm-sh/nvm) to
managing node dependencies.
Install git
-----------
JupyterHub uses `git <https://git-scm.com>`_ & `GitHub <https://github.com>`_
JupyterHub uses `Git <https://git-scm.com>`_ & `GitHub <https://github.com>`_
for development & collaboration. You need to `install git
<https://git-scm.com/book/en/v2/Getting-Started-Installing-Git>`_ to work on
JupyterHub. We also recommend getting a free account on GitHub.com.
@@ -40,13 +43,11 @@ JupyterHub. We also recommend getting a free account on GitHub.com.
Setting up a development install
================================
When developing JupyterHub, you need to make changes to the code & see
their effects quickly. You need to do a developer install to make that
happen.
When developing JupyterHub, you would need to make changes and be able to instantly view the results of the changes. To achieve that, a developer install is required.
.. note:: This guide does not attempt to dictate *how* development
environments should be isolated since that is a personal preference and can
be achieved in many ways, for example `tox`, `conda`, `docker`, etc. See this
be achieved in many ways, for example, `tox`, `conda`, `docker`, etc. See this
`forum thread <https://discourse.jupyter.org/t/thoughts-on-using-tox/3497>`_ for
a more detailed discussion.
@@ -79,9 +80,9 @@ happen.
npm install -g configurable-http-proxy yarn
If you get an error that says ``Error: EACCES: permission denied``,
you might need to prefix the command with ``sudo``. If you do not
have access to sudo, you may instead run the following commands:
If you get an error that says ``Error: EACCES: permission denied``, you might need to prefix the command with ``sudo``.
``sudo`` may be required to perform a system-wide install.
If you do not have access to sudo, you may instead run the following commands:
.. code:: bash
@@ -96,35 +97,28 @@ happen.
conda install configurable-http-proxy yarn
4. Install the python packages required for JupyterHub development.
4. Install an editable version of JupyterHub and its requirements for
development and testing. This lets you edit JupyterHub code in a text editor
& restart the JupyterHub process to see your code changes immediately.
.. code:: bash
python3 -m pip install -r dev-requirements.txt
python3 -m pip install -r requirements.txt
python3 -m pip install --editable ".[test]"
5. Setup a database.
5. Set up a database.
The default database engine is ``sqlite`` so if you are just trying
to get up and running quickly for local development that should be
available via `python <https://docs.python.org/3.5/library/sqlite3.html>`__.
available via `Python <https://docs.python.org/3.5/library/sqlite3.html>`__.
See :doc:`/reference/database` for details on other supported databases.
6. Install the development version of JupyterHub. This lets you edit
JupyterHub code in a text editor & restart the JupyterHub process to
see your code changes immediately.
.. code:: bash
python3 -m pip install --editable .
7. You are now ready to start JupyterHub!
6. You are now ready to start JupyterHub!
.. code:: bash
jupyterhub
8. You can access JupyterHub from your browser at
7. You can access JupyterHub from your browser at
``http://localhost:8000`` now.
Happy developing!
@@ -132,12 +126,12 @@ Happy developing!
Using DummyAuthenticator & SimpleLocalProcessSpawner
====================================================
To simplify testing of JupyterHub, its helpful to use
To simplify testing of JupyterHub, it is helpful to use
:class:`~jupyterhub.auth.DummyAuthenticator` instead of the default JupyterHub
authenticator and SimpleLocalProcessSpawner instead of the default spawner.
There is a sample configuration file that does this in
``testing/jupyterhub_config.py``. To launch jupyterhub with this
``testing/jupyterhub_config.py``. To launch JupyterHub with this
configuration:
.. code:: bash
@@ -153,14 +147,14 @@ JupyterHub as.
DummyAuthenticator allows you to log in with any username & password,
while SimpleLocalProcessSpawner allows you to start servers without having to
create a unix user for each JupyterHub user. Together, these make it
create a Unix user for each JupyterHub user. Together, these make it
much easier to test JupyterHub.
Tip: If you are working on parts of JupyterHub that are common to all
authenticators & spawners, we recommend using both DummyAuthenticator &
SimpleLocalProcessSpawner. If you are working on just authenticator related
SimpleLocalProcessSpawner. If you are working on just authenticator-related
parts, use only SimpleLocalProcessSpawner. Similarly, if you are working on
just spawner related parts, use only DummyAuthenticator.
just spawner-related parts, use only DummyAuthenticator.
Troubleshooting
===============

View File

@@ -4,20 +4,19 @@
Testing JupyterHub and linting code
===================================
Unit test help validate that JupyterHub works the way we think it does,
Unit testing helps to validate that JupyterHub works the way we think it does,
and continues to do so when changes occur. They also help communicate
precisely what we expect our code to do.
JupyterHub uses `pytest <https://pytest.org>`_ for all our tests. You
can find them under ``jupyterhub/tests`` directory in the git repository.
JupyterHub uses `pytest <https://pytest.org>`_ for all the tests. You
can find them under the `jupyterhub/tests <https://github.com/jupyterhub/jupyterhub/tree/main/jupyterhub/tests>`_ directory in the git repository.
Running the tests
==================
#. Make sure you have completed :ref:`contributing/setup`. You should be able
to start ``jupyterhub`` from the commandline & access it from your
web browser. This ensures that the dev environment is properly set
up for tests to run.
#. Make sure you have completed :ref:`contributing/setup`.
Once you are done, you would be able to run ``jupyterhub`` from the command line and access it from your web browser.
This ensures that the dev environment is properly set up for tests to run.
#. You can run all tests in JupyterHub
@@ -57,7 +56,7 @@ Running the tests
pytest -v jupyterhub/tests/test_api.py::test_shutdown
See the `pytest usage documentation <https://pytest.readthedocs.io/en/latest/usage.html>`_ for more details.
For more details, refer to the `pytest usage documentation <https://pytest.readthedocs.io/en/latest/usage.html>`_.
Test organisation
=================
@@ -98,9 +97,7 @@ And fixtures to add functionality or spawning behavior:
- ``bad_spawn``: enables the BadSpawner (a spawner that fails immediately)
- ``slow_bad_spawn``: enables the SlowBadSpawner (a spawner that fails after a short delay)
See the `pytest fixtures documentation <https://pytest.readthedocs.io/en/latest/fixture.html>`_
for how to use the existing fixtures, and how to create new ones.
Refer to the `pytest fixtures documentation <https://pytest.readthedocs.io/en/latest/fixture.html>`_ to learn how to use fixtures that exists already and to create new ones.
Troubleshooting Test Failures
=============================
@@ -108,29 +105,34 @@ Troubleshooting Test Failures
All the tests are failing
-------------------------
Make sure you have completed all the steps in :ref:`contributing/setup` successfully, and
can launch ``jupyterhub`` from the terminal.
Make sure you have completed all the steps in :ref:`contributing/setup` successfully, and are able to access JupyterHub from your browser at http://localhost:8000 after starting ``jupyterhub`` in your command line.
Code formatting and linting
===========================
JupyterHub has adopted automatic code formatting and linting.
As long as your code is valid, the pre-commit hook should take care of how it should look.
You can invoke the pre-commit hook by hand at any time with:
JupyterHub automatically enforces code formatting. This means that pull requests
with changes breaking this formatting will receive a commit from pre-commit.ci
automatically.
To automatically format code locally, you can install pre-commit and register a
*git hook* to automatically check with pre-commit before you make a commit if
the formatting is okay.
.. code:: bash
pip install pre-commit
pre-commit install --install-hooks
To run pre-commit manually you would do:
.. code:: bash
# check for changes to code not yet committed
pre-commit run
which should run any autoformatting on your code and tell you about any errors it couldn't fix automatically.
You may also install `black integration <https://github.com/psf/black#editor-integration>`_
into your text editor to format code automatically.
If you have already committed files before running pre-commit you can fix everything using:
.. code:: bash
# check for changes also in already committed code
pre-commit run --all-files
And committing the changes.
You may also install `black integration <https://github.com/psf/black#editor-integration>`_
into your text editor to format code automatically.

View File

@@ -120,3 +120,4 @@ contribution on JupyterHub:
- yuvipanda
- zoltan-fedor
- zonca
- Neeraj Natu

View File

@@ -1,5 +1,5 @@
Eventlogging and Telemetry
==========================
Event logging and telemetry
===========================
JupyterHub can be configured to record structured events from a running server using Jupyter's `Telemetry System`_. The types of events that JupyterHub emits are defined by `JSON schemas`_ listed at the bottom of this page_.
@@ -15,7 +15,7 @@ Event logging is handled by its ``Eventlog`` object. This leverages Python's sta
To begin recording events, you'll need to set two configurations:
1. ``handlers``: tells the EventLog *where* to route your events. This trait is a list of Python logging handlers that route events to
1. ``handlers``: tells the EventLog *where* to route your events. This trait is a list of Python logging handlers that route events to the event log file.
2. ``allows_schemas``: tells the EventLog *which* events should be recorded. No events are emitted by default; all recorded events must be listed here.
Here's a basic example:

View File

@@ -97,7 +97,7 @@ easy to do with RStudio too.
### University of Illinois
- https://datascience.business.illinois.edu (currently down; checked 04/26/19)
- https://datascience.business.illinois.edu (currently down; checked 10/26/22)
### IllustrisTNG Simulation Project
@@ -126,7 +126,7 @@ easy to do with RStudio too.
### Penn State University
- [Press release](https://news.psu.edu/story/523093/2018/05/24/new-open-source-web-apps-available-students-and-faculty): "New open-source web apps available for students and faculty" (but Hub is currently down; checked 04/26/19)
- [Press release](https://news.psu.edu/story/523093/2018/05/24/new-open-source-web-apps-available-students-and-faculty): "New open-source web apps available for students and faculty"
### University of Rochester CIRC
@@ -156,13 +156,13 @@ easy to do with RStudio too.
### Elucidata
- What's new in Jupyter Notebooks @[Elucidata](https://elucidata.io/):
- Using Jupyter Notebooks with Jupyterhub on GCP, managed by GKE - https://medium.com/elucidata/why-you-should-be-using-a-jupyter-notebook-8385a4ccd93d
- [Using Jupyter Notebooks with Jupyterhub on GCP, managed by GKE](https://medium.com/elucidata/why-you-should-be-using-a-jupyter-notebook-8385a4ccd93d)
## Service Providers
### AWS
- [running-jupyter-notebook-and-jupyterhub-on-amazon-emr](https://aws.amazon.com/blogs/big-data/running-jupyter-notebook-and-jupyterhub-on-amazon-emr/)
- [Run Jupyter Notebook and JupyterHub on Amazon EMR](https://aws.amazon.com/blogs/big-data/running-jupyter-notebook-and-jupyterhub-on-amazon-emr/)
### Google Cloud Platform
@@ -175,12 +175,12 @@ easy to do with RStudio too.
### Microsoft Azure
- https://docs.microsoft.com/en-us/azure/machine-learning/machine-learning-data-science-linux-dsvm-intro
- [Azure Data Science Virtual Machine release notes](https://docs.microsoft.com/en-us/azure/machine-learning/machine-learning-data-science-linux-dsvm-intro)
### Rackspace Carina
- https://getcarina.com/blog/learning-how-to-whale/
- http://carolynvanslyck.com/talk/carina/jupyterhub/#/
- http://carolynvanslyck.com/talk/carina/jupyterhub/#/ (but carolynvanslyck is currently down; checked 10/26/22)
### Hadoop
@@ -189,13 +189,14 @@ easy to do with RStudio too.
## Miscellaneous
- https://medium.com/@ybarraud/setting-up-jupyterhub-with-sudospawner-and-anaconda-844628c0dbee#.rm3yt87e1
- https://groups.google.com/forum/#!topic/jupyter/nkPSEeMr8c0 Mailing list UT deployment
- JupyterHub setup on Centos https://gist.github.com/johnrc/604971f7d41ebf12370bf5729bf3e0a4
- Deploy JupyterHub to Docker Swarm https://jupyterhub.surge.sh/#/welcome
- [Mailing list UT deployment](https://groups.google.com/forum/#!topic/jupyter/nkPSEeMr8c0)
- [JupyterHub setup on Centos](https://gist.github.com/johnrc/604971f7d41ebf12370bf5729bf3e0a4)
- [Deploy JupyterHub to Docker Swarm](https://jupyterhub.surge.sh/#/welcome)
- http://www.laketide.com/building-your-lab-part-3/
- http://estrellita.hatenablog.com/entry/2015/07/31/083202
- http://www.walkingrandomly.com/?p=5734
- https://wrdrd.com/docs/consulting/education-technology
- https://bitbucket.org/jackhale/fenics-jupyter
- [LinuxCluster blog](https://linuxcluster.wordpress.com/category/application/jupyterhub/)
- [Network Technology](https://arnesund.com/tag/jupyterhub/) [Spark Cluster on OpenStack with Multi-User Jupyter Notebook](https://arnesund.com/2015/09/21/spark-cluster-on-openstack-with-multi-user-jupyter-notebook/)
- [Network Technology](https://arnesund.com/tag/jupyterhub/)
- [Spark Cluster on OpenStack with Multi-User Jupyter Notebook](https://arnesund.com/2015/09/21/spark-cluster-on-openstack-with-multi-user-jupyter-notebook/)

View File

@@ -1,10 +1,10 @@
# Authentication and User Basics
The default Authenticator uses [PAM][] to authenticate system users with
The default Authenticator uses [PAM][] (Pluggable Authentication Module) to authenticate system users with
their username and password. With the default Authenticator, any user
with an account and password on the system will be allowed to login.
## Create a set of allowed users
## Create a set of allowed users (`allowed_users`)
You can restrict which users are allowed to login with a set,
`Authenticator.allowed_users`:
@@ -25,7 +25,7 @@ If this configuration value is not set, then **all authenticated users will be a
```{note}
As of JupyterHub 2.0, the full permissions of `admin_users`
should not be required.
Instead, you can assign [roles][] to users or groups
Instead, you can assign [roles](define-role-target) to users or groups
with only the scopes they require.
```
@@ -42,10 +42,10 @@ c.Authenticator.admin_users = {'mal', 'zoe'}
Users in the admin set are automatically added to the user `allowed_users` set,
if they are not already present.
Each authenticator may have different ways of determining whether a user is an
administrator. By default JupyterHub uses the PAMAuthenticator which provides the
Each Authenticator may have different ways of determining whether a user is an
administrator. By default, JupyterHub uses the PAMAuthenticator which provides the
`admin_groups` option and can set administrator status based on a user
group. For example we can let any user in the `wheel` group be admin:
group. For example, we can let any user in the `wheel` group be an admin:
```python
c.PAMAuthenticator.admin_groups = {'wheel'}
@@ -57,12 +57,12 @@ Since the default `JupyterHub.admin_access` setting is `False`, the admins
do not have permission to log in to the single user notebook servers
owned by _other users_. If `JupyterHub.admin_access` is set to `True`,
then admins have permission to log in _as other users_ on their
respective machines, for debugging. **As a courtesy, you should make
respective machines for debugging. **As a courtesy, you should make
sure your users know if admin_access is enabled.**
## Add or remove users from the Hub
Users can be added to and removed from the Hub via either the admin
Users can be added to and removed from the Hub via the admin
panel or the REST API. When a user is **added**, the user will be
automatically added to the `allowed_users` set and database. Restarting the Hub
will not require manually updating the `allowed_users` set in your config file,
@@ -76,12 +76,12 @@ fresh.
## Use LocalAuthenticator to create system users
The `LocalAuthenticator` is a special kind of authenticator that has
The `LocalAuthenticator` is a special kind of Authenticator that has
the ability to manage users on the local system. When you try to add a
new user to the Hub, a `LocalAuthenticator` will check if the user
already exists. If you set the configuration value, `create_system_users`,
to `True` in the configuration file, the `LocalAuthenticator` has
the privileges to add users to the system. The setting in the config
the ability to add users to the system. The setting in the config
file is:
```python
@@ -91,7 +91,7 @@ c.LocalAuthenticator.create_system_users = True
Adding a user to the Hub that doesn't already exist on the system will
result in the Hub creating that user via the system `adduser` command
line tool. This option is typically used on hosted deployments of
JupyterHub, to avoid the need to manually create all your users before
JupyterHub to avoid the need to manually create all your users before
launching the service. This approach is not recommended when running
JupyterHub in situations where JupyterHub users map directly onto the
system's UNIX users.
@@ -101,25 +101,25 @@ system's UNIX users.
JupyterHub's [OAuthenticator][] currently supports the following
popular services:
- Auth0
- Azure AD
- Bitbucket
- CILogon
- GitHub
- GitLab
- Globus
- Google
- MediaWiki
- Okpy
- OpenShift
- [Auth0](https://oauthenticator.readthedocs.io/en/latest/api/gen/oauthenticator.auth0.html#module-oauthenticator.auth0)
- [Azure AD](https://oauthenticator.readthedocs.io/en/latest/api/gen/oauthenticator.azuread.html#module-oauthenticator.azuread)
- [Bitbucket](https://oauthenticator.readthedocs.io/en/latest/api/gen/oauthenticator.bitbucket.html#module-oauthenticator.bitbucket)
- [CILogon](https://oauthenticator.readthedocs.io/en/latest/api/gen/oauthenticator.cilogon.html#module-oauthenticator.cilogon)
- [GitHub](https://oauthenticator.readthedocs.io/en/latest/api/gen/oauthenticator.github.html#module-oauthenticator.github)
- [GitLab](https://oauthenticator.readthedocs.io/en/latest/api/gen/oauthenticator.gitlab.html#module-oauthenticator.gitlab)
- [Globus](https://oauthenticator.readthedocs.io/en/latest/api/gen/oauthenticator.globus.html#module-oauthenticator.globus)
- [Google](https://oauthenticator.readthedocs.io/en/latest/api/gen/oauthenticator.google.html#module-oauthenticator.google)
- [MediaWiki](https://oauthenticator.readthedocs.io/en/latest/api/gen/oauthenticator.mediawiki.html#module-oauthenticator.mediawiki)
- [Okpy](https://oauthenticator.readthedocs.io/en/latest/api/gen/oauthenticator.okpy.html#module-oauthenticator.okpy)
- [OpenShift](https://oauthenticator.readthedocs.io/en/latest/api/gen/oauthenticator.openshift.html#module-oauthenticator.openshift)
A generic implementation, which you can use for OAuth authentication
A [generic implementation](https://oauthenticator.readthedocs.io/en/latest/api/gen/oauthenticator.generic.html#module-oauthenticator.generic), which you can use for OAuth authentication
with any provider, is also available.
## Use DummyAuthenticator for testing
The `DummyAuthenticator` is a simple authenticator that
allows for any username/password unless a global password has been set. If
The `DummyAuthenticator` is a simple Authenticator that
allows for any username or password unless a global password has been set. If
set, it will allow for any username as long as the correct password is provided.
To set a global password, add this to the config file:

View File

@@ -1,6 +1,6 @@
# Configuration Basics
The section contains basic information about configuring settings for a JupyterHub
This section contains basic information about configuring settings for a JupyterHub
deployment. The [Technical Reference](../reference/index)
documentation provides additional details.
@@ -49,7 +49,7 @@ that Jupyter uses.
## Configure using command line options
To display all command line options that are available for configuration:
To display all command line options that are available for configuration run the following command:
```bash
jupyterhub --help-all
@@ -77,11 +77,11 @@ jupyterhub --Spawner.notebook_dir='~/assignments'
## Configure for various deployment environments
The default authentication and process spawning mechanisms can be replaced, and
specific [authenticators](./authenticators-users-basics) and
[spawners](./spawners-basics) can be set in the configuration file.
specific [authenticators](authenticators-users-basics) and
[spawners](spawners-basics) can be set in the configuration file.
This enables JupyterHub to be used with a variety of authentication methods or
process control and deployment environments. [Some examples](../reference/config-examples),
meant as illustration, are:
meant as illustrations, are:
- Using GitHub OAuth instead of PAM with [OAuthenticator](https://github.com/jupyterhub/oauthenticator)
- Spawning single-user servers with Docker, using the [DockerSpawner](https://github.com/jupyterhub/dockerspawner)

View File

@@ -16,7 +16,8 @@ to come to _your server_ and look at the exact same file.
In most circumstances, this is forbidden by permissions because the person you share with does not have access to your server.
What actually happens when someone visits this URL will depend on whether your server is running and other factors.
But what is our actual goal?
**But what is our actual goal?**
A typical situation is that you have some shared or common filesystem,
such that the same path corresponds to the same document
(either the exact same document or another copy of it).

View File

@@ -8,10 +8,16 @@ broken down by their roles within organizations.
### Is it appropriate for adoption within a larger institutional context?
Yes! JupyterHub has been used at-scale for large pools of users, as well
as complex and high-performance computing. For example, UC Berkeley uses
JupyterHub for its Data Science Education Program courses (serving over
3,000 students). The Pangeo project uses JupyterHub to provide access
to scalable cloud computing with Dask. JupyterHub is stable and customizable
as complex and high-performance computing.
For example,
- UC Berkeley uses
JupyterHub for its Data Science Education Program courses (serving over
3,000 students).
- The Pangeo project uses JupyterHub to provide access
to scalable cloud computing with Dask.
JupyterHub is stable and customizable
to the use-cases of large organizations.
### I keep hearing about Jupyter Notebook, JupyterLab, and now JupyterHub. Whats the difference?
@@ -26,7 +32,7 @@ Here is a quick breakdown of these three tools:
has several extensions that are tailored for using Jupyter Notebooks, as well as extensions
for other parts of the data science stack.
- **JupyterHub** is an application that manages interactive computing sessions for **multiple users**.
It also connects them with infrastructure those users wish to access. It can provide
It also connects users with infrastructure they wish to access. It can provide
remote access to Jupyter Notebooks and JupyterLab for many people.
## For management
@@ -35,7 +41,7 @@ Here is a quick breakdown of these three tools:
JupyterHub provides a shared platform for data science and collaboration.
It allows users to utilize familiar data science workflows (such as the scientific Python stack,
the R tidyverse, and Jupyter Notebooks) on institutional infrastructure. It also allows administrators
the R tidyverse, and Jupyter Notebooks) on institutional infrastructure. It also gives administrators
some control over access to resources, security, environments, and authentication.
### Is JupyterHub mature? Why should we trust it?
@@ -78,7 +84,7 @@ gives administrators more control over their setup and hardware.
Because JupyterHub is an open-source, community-driven tool, it can be extended and
modified to fit an institution's needs. It plays nicely with the open source data science
stack, and can serve a variety of computing enviroments, user interfaces, and
stack, and can serve a variety of computing environments, user interfaces, and
computational hardware. It can also be deployed anywhere - on enterprise cloud infrastructure, on
High-Performance-Computing machines, on local hardware, or even on a single laptop, which
is not possible with most other tools for shared interactive computing.
@@ -99,12 +105,12 @@ that we currently suggest are:
guide that runs on Kubernetes. Better for larger or dynamic user groups (50-10,000) or more complex
compute/data needs.
- [The Littlest JupyterHub](https://tljh.jupyter.org) is a lightweight JupyterHub that runs on a single
single machine (in the cloud or under your desk). Better for smaller user groups (4-80) or more
machine (in the cloud or under your desk). Better for smaller user groups (4-80) or more
lightweight computational resources.
### Does JupyterHub run well in the cloud?
Yes - most deployments of JupyterHub are run via cloud infrastructure and on a variety of cloud providers.
**Yes** - most deployments of JupyterHub are run via cloud infrastructure and on a variety of cloud providers.
Depending on the distribution of JupyterHub that you'd like to use, you can also connect your JupyterHub
deployment with a number of other cloud-native services so that users have access to other resources from
their interactive computing sessions.
@@ -118,7 +124,8 @@ as more resources are needed - allowing you to utilize the benefits of a flexibl
### Is JupyterHub secure?
The short answer: yes. JupyterHub as a standalone application has been battle-tested at an institutional
The short answer: yes.
JupyterHub as a standalone application has been battle-tested at an institutional
level for several years, and makes a number of "default" security decisions that are reasonable for most
users.
@@ -134,11 +141,11 @@ in these cases, and the security of your JupyterHub deployment will often depend
If you are worried about security, don't hesitate to reach out to the JupyterHub community in the
[Jupyter Community Forum](https://discourse.jupyter.org/c/jupyterhub). This community of practice has many
individuals with experience running secure JupyterHub deployments.
individuals with experience running secure JupyterHub deployments and will be very glad to help you out.
### Does JupyterHub provide computing or data infrastructure?
No - JupyterHub manages user sessions and can _control_ computing infrastructure, but it does not provide these
**No** - JupyterHub manages user sessions and can _control_ computing infrastructure, but it does not provide these
things itself. You are expected to run JupyterHub on your own infrastructure (local or in the cloud). Moreover,
JupyterHub has no internal concept of "data", but is designed to be able to communicate with data repositories
(again, either locally or remotely) for use within interactive computing sessions.
@@ -191,7 +198,7 @@ complex computing infrastructures from the interactive sessions of a JupyterHub.
This is highly configurable by the administrator. If you wish for your users to have simple
data analytics environments for prototyping and light data exploring, you can restrict their
memory and CPU based on the resources that you have available. If you'd like your JupyterHub
to serve as a gateway to high-performance compute or data resources, you may increase the
to serve as a gateway to high-performance computing or data resources, you may increase the
resources available on user machines, or connect them with computing infrastructures elsewhere.
### Can I customize the look and feel of a JupyterHub?

View File

@@ -41,9 +41,9 @@ port.
## Set the Proxy's REST API communication URL (optional)
By default, this REST API listens on port 8001 of `localhost` only.
The Hub service talks to the proxy via a REST API on a secondary port. The
API URL can be configured separately to override the default settings.
By default, the proxy's REST API listens on port 8081 of `localhost` only.
The Hub service talks to the proxy via a REST API on a secondary port.
The REST API URL (hostname and port) can be configured separately and override the default settings.
### Set api_url

View File

@@ -5,17 +5,17 @@ Security settings
You should not run JupyterHub without SSL encryption on a public network.
Security is the most important aspect of configuring Jupyter. Three
configuration settings are the main aspects of security configuration:
Security is the most important aspect of configuring Jupyter.
Three (3) configuration settings are the main aspects of security configuration:
1. :ref:`SSL encryption <ssl-encryption>` (to enable HTTPS)
2. :ref:`Cookie secret <cookie-secret>` (a key for encrypting browser cookies)
3. Proxy :ref:`authentication token <authentication-token>` (used for the Hub and
other services to authenticate to the Proxy)
The Hub hashes all secrets (e.g., auth tokens) before storing them in its
The Hub hashes all secrets (e.g. auth tokens) before storing them in its
database. A loss of control over read-access to the database should have
minimal impact on your deployment; if your database has been compromised, it
minimal impact on your deployment. If your database has been compromised, it
is still a good idea to revoke existing tokens.
.. _ssl-encryption:
@@ -31,7 +31,7 @@ Using an SSL certificate
This will require you to obtain an official, trusted SSL certificate or create a
self-signed certificate. Once you have obtained and installed a key and
certificate you need to specify their locations in the ``jupyterhub_config.py``
certificate, you need to specify their locations in the ``jupyterhub_config.py``
configuration file as follows:
.. code-block:: python
@@ -72,13 +72,13 @@ would be the needed configuration:
If SSL termination happens outside of the Hub
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In certain cases, for example if the hub is running behind a reverse proxy, and
In certain cases, for example, if the hub is running behind a reverse proxy, and
`SSL termination is being provided by NGINX <https://www.nginx.com/resources/admin-guide/nginx-ssl-termination/>`_,
it is reasonable to run the hub without SSL.
To achieve this, simply omit the configuration settings
``c.JupyterHub.ssl_key`` and ``c.JupyterHub.ssl_cert``
(setting them to ``None`` does not have the same effect, and is an error).
To achieve this, remove ``c.JupyterHub.ssl_key`` and ``c.JupyterHub.ssl_cert``
from your configuration (setting them to ``None`` or an empty string does not
have the same effect, and will result in an error).
.. _authentication-token:
@@ -92,7 +92,7 @@ use an auth token.
The value of this token should be a random string (for example, generated by
``openssl rand -hex 32``). You can store it in the configuration file or an
environment variable
environment variable.
Generating and storing token in the configuration file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -118,8 +118,8 @@ This environment variable needs to be visible to the Hub and Proxy.
Default if token is not set
~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you don't set the Proxy authentication token, the Hub will generate a random
key itself, which means that any time you restart the Hub you **must also
If you do not set the Proxy authentication token, the Hub will generate a random
key itself. This means that any time you restart the Hub, you **must also
restart the Proxy**. If the proxy is a subprocess of the Hub, this should happen
automatically (this is the default configuration).
@@ -128,7 +128,7 @@ automatically (this is the default configuration).
Cookie secret
-------------
The cookie secret is an encryption key, used to encrypt the browser cookies
The cookie secret is an encryption key, used to encrypt the browser cookies,
which are used for authentication. Three common methods are described for
generating and configuring the cookie secret.
@@ -136,8 +136,8 @@ Generating and storing as a cookie secret file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The cookie secret should be 32 random bytes, encoded as hex, and is typically
stored in a ``jupyterhub_cookie_secret`` file. An example command to generate the
``jupyterhub_cookie_secret`` file is:
stored in a ``jupyterhub_cookie_secret`` file. Below, is an example command to generate the
``jupyterhub_cookie_secret`` file:
.. code-block:: bash
@@ -155,7 +155,7 @@ The location of the ``jupyterhub_cookie_secret`` file can be specified in the
If the cookie secret file doesn't exist when the Hub starts, a new cookie
secret is generated and stored in the file. The file must not be readable by
``group`` or ``other`` or the server won't start. The recommended permissions
``group`` or ``other``, otherwise the server won't start. The recommended permissions
for the cookie secret file are ``600`` (owner-only rw).
Generating and storing as an environment variable
@@ -176,8 +176,8 @@ the Hub starts.
Generating and storing as a binary string
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can also set the cookie secret in the configuration file
itself, ``jupyterhub_config.py``, as a binary string:
You can also set the cookie secret, as a binary string,
in the configuration file (``jupyterhub_config.py``) itself:
.. code-block:: python
@@ -198,7 +198,7 @@ jupyterhub-hub-login
~~~~~~~~~~~~~~~~~~~~
This is the login token used when visiting Hub-served pages that are
protected by authentication such as the main home, the spawn form, etc.
protected by authentication, such as the main home, the spawn form, etc.
If this cookie is set, then the user is logged in.
Resetting the Hub cookie secret effectively revokes this cookie.
@@ -209,7 +209,7 @@ jupyterhub-user-<username>
~~~~~~~~~~~~~~~~~~~~~~~~~~
This is the cookie used for authenticating with a single-user server.
It is set by the single-user server after OAuth with the Hub.
It is set by the single-user server, after OAuth with the Hub.
Effectively the same as ``jupyterhub-hub-login``, but for the
single-user server instead of the Hub. It contains an OAuth access token,
@@ -218,14 +218,13 @@ which is checked with the Hub to authenticate the browser.
Each OAuth access token is associated with a session id (see ``jupyterhub-session-id`` section
below).
To avoid hitting the Hub on every request, the authentication response
is cached. And to avoid a stale cache the cache key is comprised of both
the token and session id.
To avoid hitting the Hub on every request, the authentication response is cached.
The cache key is comprised of both the token and session id, to avoid a stale cache.
Resetting the Hub cookie secret effectively revokes this cookie.
This cookie is restricted to the path ``/user/<username>``, so that
only the users server receives it.
This cookie is restricted to the path ``/user/<username>``,
to ensure that only the users server receives it.
jupyterhub-session-id
~~~~~~~~~~~~~~~~~~~~~
@@ -233,9 +232,9 @@ jupyterhub-session-id
This is a random string, meaningless in itself, and the only cookie
shared by the Hub and single-user servers.
Its sole purpose is to coordinate logout of the multiple OAuth cookies.
Its sole purpose is to coordinate the logout of the multiple OAuth cookies.
This cookie is set to ``/`` so all endpoints can receive it, or clear it, etc.
This cookie is set to ``/`` so all endpoints can receive it, clear it, etc.
jupyterhub-user-<username>-oauth-state
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -245,7 +244,7 @@ It is only set while OAuth between the single-user server and the Hub
is processing.
If you use your browser development tools, you should see this cookie
for a very brief moment before your are logged in,
for a very brief moment before you are logged in,
with an expiration date shorter than ``jupyterhub-hub-login`` or
``jupyterhub-user-<username>``.

View File

@@ -24,7 +24,7 @@ Hub via the REST API.
## API Token basics
### Create an API token
### Step 1: Generate an API token
To run such an external service, an API token must be created and
provided to the service.
@@ -43,12 +43,12 @@ generating an API token is available from the JupyterHub user interface:
![API TOKEN success page](../images/token-request-success.png)
### Pass environment variable with token to the Hub
### Step 2: Pass environment variable with token to the Hub
In the case of `cull_idle_servers`, it is passed as the environment
variable called `JUPYTERHUB_API_TOKEN`.
### Use API tokens for services and tasks that require external access
### Step 3: Use API tokens for services and tasks that require external access
While API tokens are often associated with a specific user, API tokens
can be used by services that require external access for activities
@@ -62,12 +62,12 @@ c.JupyterHub.services = [
]
```
### Restart JupyterHub
### Step 4: Restart JupyterHub
Upon restarting JupyterHub, you should see a message like below in the
logs:
```
```none
Adding API token for <username>
```
@@ -78,16 +78,15 @@ single-user servers, and only cookies can be used for authentication.
0.8 supports using JupyterHub API tokens to authenticate to single-user
servers.
## Configure the idle culler to run as a Hub-Managed Service
## How to configure the idle culler to run as a Hub-Managed Service
Install the idle culler:
### Step 1: Install the idle culler:
```
pip install jupyterhub-idle-culler
```
In `jupyterhub_config.py`, add the following dictionary for the
`idle-culler` Service to the `c.JupyterHub.services` list:
### Step 2: In `jupyterhub_config.py`, add the following dictionary for the `idle-culler` Service to the `c.JupyterHub.services` list:
```python
c.JupyterHub.services = [
@@ -127,7 +126,7 @@ It now needs the scopes:
- `admin:servers` to start/stop servers
```
## Run `cull-idle` manually as a standalone script
## How to run `cull-idle` manually as a standalone script
Now you can run your script by providing it
the API token and it will authenticate through the REST API to

View File

@@ -1,12 +1,12 @@
# Spawners and single-user notebook servers
Since the single-user server is an instance of `jupyter notebook`, an entire separate
multi-process application, there are many aspects of that server that can be configured, and a lot
A Spawner starts each single-user notebook server. Since the single-user server is an instance of `jupyter notebook`, an entire separate
multi-process application, many aspects of that server can be configured and there are a lot
of ways to express that configuration.
At the JupyterHub level, you can set some values on the Spawner. The simplest of these is
`Spawner.notebook_dir`, which lets you set the root directory for a user's server. This root
notebook directory is the highest level directory users will be able to access in the notebook
notebook directory is the highest-level directory users will be able to access in the notebook
dashboard. In this example, the root notebook directory is set to `~/notebooks`, where `~` is
expanded to the user's home directory.
@@ -20,7 +20,7 @@ You can also specify extra command line arguments to the notebook server with:
c.Spawner.args = ['--debug', '--profile=PHYS131']
```
This could be used to set the users default page for the single user server:
This could be used to set the user's default page for the single-user server:
```python
c.Spawner.args = ['--NotebookApp.default_url=/notebooks/Welcome.ipynb']

Binary file not shown.

After

Width:  |  Height:  |  Size: 1017 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 607 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

View File

@@ -9,6 +9,7 @@ well as other information relevant to running your own JupyterHub over time.
:maxdepth: 2
troubleshooting
admin/capacity-planning
admin/upgrading
admin/log-messages
changelog

View File

@@ -1,32 +1,32 @@
==========
JupyterHub
==========
`JupyterHub`_ is the best way to serve `Jupyter notebook`_ for multiple users.
It can be used in a class of students, a corporate data science group or scientific
Because JupyterHub manages a separate Jupyter environment for each user,
it can be used in a class of students, a corporate data science group, or a scientific
research group. It is a multi-user **Hub** that spawns, manages, and proxies multiple
instances of the single-user `Jupyter notebook`_ server.
To make life easier, JupyterHub has distributions. Be sure to
take a look at them before continuing with the configuration of the broad
original system of `JupyterHub`_. Today, you can find two main cases:
JupyterHub offers distributions for different use cases. As of now, you can find two main cases:
1. If you need a simple case for a small amount of users (0-100) and single server
take a look at
`The Littlest JupyterHub <https://github.com/jupyterhub/the-littlest-jupyterhub>`__ distribution.
2. If you need to allow for even more users, a dynamic amount of servers can be used on a cloud,
take a look at the `Zero to JupyterHub with Kubernetes <https://github.com/jupyterhub/zero-to-jupyterhub-k8s>`__ .
1. `The Littlest JupyterHub <https://github.com/jupyterhub/the-littlest-jupyterhub>`__ distribution is suitable if you need a small number of users (1-100) and a single server with a simple environment.
2. `Zero to JupyterHub with Kubernetes <https://github.com/jupyterhub/zero-to-jupyterhub-k8s>`__ allows you to deploy dynamic servers on the cloud if you need even more users.
Four subsystems make up JupyterHub:
JupyterHub can be used in a collaborative environment by both both small (0-100 users) and
large teams (more than 100 users) such as a class of students, corporate data science group
or scientific research group. It has distributions which are developed to serve the needs of
each of these teams respectively.
JupyterHub is made up of four subsystems:
* a **Hub** (tornado process) that is the heart of JupyterHub
* a **configurable http proxy** (node-http-proxy) that receives the requests from the client's browser
* multiple **single-user Jupyter notebook servers** (Python/IPython/tornado) that are monitored by Spawners
* an **authentication class** that manages how users can access the system
Besides these central pieces, you can add optional configurations through a `config.py` file and manage users kernels on an admin panel. A simplification of the whole system can be seen in the figure below:
Additionally, optional configurations can be added through a `config.py` file and manage users
kernels on an admin panel. A simplification of the whole system is displayed in the figure below:
.. image:: images/jhub-fluxogram.jpeg
:alt: JupyterHub subsystems
@@ -56,17 +56,22 @@ Contents
Distributions
-------------
A JupyterHub **distribution** is tailored towards a particular set of
use cases. These are generally easier to set up than setting up
JupyterHub from scratch, assuming they fit your use case.
A JupyterHub **distribution** is tailored
towards a particular set of use cases. These are generally easier
to set up than setting up JupyterHub from scratch, assuming they fit your use case.
The two popular ones are:
Today, you can find two main use cases:
* `Zero to JupyterHub on Kubernetes <http://z2jh.jupyter.org>`_, for
running JupyterHub on top of `Kubernetes <https://k8s.io>`_. This
can scale to large number of machines & users.
* `The Littlest JupyterHub <http://tljh.jupyter.org>`_, for an easy
to set up & run JupyterHub supporting 1-100 users on a single machine.
1. If you need a simple case for a small amount of users (0-100) and single server
take a look at
`The Littlest JupyterHub <https://github.com/jupyterhub/the-littlest-jupyterhub>`__ distribution.
2. If you need to allow for a larger number of machines and users,
a dynamic amount of servers can be used on a cloud,
take a look at the `Zero to JupyterHub with Kubernetes <https://github.com/jupyterhub/zero-to-jupyterhub-k8s>`__ distribution.
This distribution runs JupyterHub on top of `Kubernetes <https://k8s.io>`_.
*It is important to evaluate these distributions before you can continue with the
configuration of JupyterHub*.
Installation Guide
------------------
@@ -119,13 +124,12 @@ RBAC Reference
Contributing
------------
We want you to contribute to JupyterHub in ways that are most exciting
& useful to you. We value documentation, testing, bug reporting & code equally,
We welcome you to contribute to JupyterHub in ways that are most exciting
& useful to you. We value documentation, testing, bug reporting & code equally
and are glad to have your contributions in whatever form you wish :)
Our `Code of Conduct <https://github.com/jupyter/governance/blob/HEAD/conduct/code_of_conduct.md>`_
(`reporting guidelines <https://github.com/jupyter/governance/blob/HEAD/conduct/reporting_online.md>`_)
helps keep our community welcoming to as many people as possible.
Our `Code of Conduct <https://github.com/jupyter/governance/blob/HEAD/conduct/code_of_conduct.md>`_ and `reporting guidelines <https://github.com/jupyter/governance/blob/HEAD/conduct/reporting_online.md>`_
help keep our community welcoming to as many people as possible.
.. toctree::
:maxdepth: 2
@@ -149,9 +153,9 @@ Indices and tables
Questions? Suggestions?
=======================
All questions and suggestions are welcome. Please feel free to use our `Jupyter Discourse Forum <https://discourse.jupyter.org/>`_ to contact our team.
- `Jupyter mailing list <https://groups.google.com/forum/#!forum/jupyter>`_
- `Jupyter website <https://jupyter.org>`_
Looking forward to hearing from you!
.. _JupyterHub: https://github.com/jupyterhub/jupyterhub
.. _Jupyter notebook: https://jupyter-notebook.readthedocs.io/en/latest/

View File

@@ -1,49 +1,69 @@
Using Docker
============
Install JupyterHub with Docker
==============================
.. important::
We highly recommend following the `Zero to JupyterHub`_ tutorial for
installing JupyterHub.
Alternate installation using Docker
-----------------------------------
A ready to go `docker image <https://hub.docker.com/r/jupyterhub/jupyterhub/>`_
gives a straightforward deployment of JupyterHub.
The JupyterHub `docker image <https://hub.docker.com/r/jupyterhub/jupyterhub/>`_ is the fastest way to set up Jupyterhub in your local development environment.
.. note::
This ``jupyterhub/jupyterhub`` docker image is only an image for running
the Hub service itself. It does not provide the other Jupyter components,
such as Notebook installation, which are needed by the single-user servers.
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.
not, `JupyterLab <https://jupyterlab.readthedocs.io/>`_ or Jupyter Notebook must be installed.
Starting JupyterHub with docker
-------------------------------
The JupyterHub docker image can be started with the following command::
.. important::
We strongly recommend that you follow the `Zero to JupyterHub`_ tutorial to
install JupyterHub.
Prerequisites
-------------
You should have `Docker`_ installed on a Linux/Unix based system.
Run the Docker Image
--------------------
To pull the latest JupyterHub image and start the `jupyterhub` container, run this command in your terminal.
::
docker run -d -p 8000:8000 --name jupyterhub 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**.
This command exposes the Jupyter container on port:8000. Navigate to `http://localhost:8000` in a web browser to access the JupyterHub console.
You can stop and resume the container by running `docker stop` and `docker start` respectively.
::
# find the container id
docker ps
# stop the running container
docker stop <container-id>
# resume the paused container
docker start <container-id>
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 using a ssl enabled proxy.
configuration or using an ssl enabled proxy.
`Mounting volumes <https://docs.docker.com/engine/admin/volumes/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.
enables you to persist and store the data generated by the docker container, even when you stop the container.
The persistent data can be stored on the host system, outside the container.
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
Create System Users
-------------------
Spawn a root shell in your docker container by running this command in the terminal.::
docker exec -it jupyterhub bash
The created accounts will be used for authentication in JupyterHub's default
configuration.
.. _Zero to JupyterHub: https://zero-to-jupyterhub.readthedocs.io/en/latest/
.. _Docker: https://www.docker.com/

View File

@@ -4,7 +4,7 @@
Before installing JupyterHub, you will need:
- a Linux/Unix based system
- a Linux/Unix-based system
- [Python](https://www.python.org/downloads/) 3.6 or greater. An understanding
of using [`pip`](https://pip.pypa.io) or
[`conda`](https://conda.io/docs/get-started.html) for
@@ -80,7 +80,7 @@ To start the Hub server, run the command:
jupyterhub
```
Visit `http://localhost:8000` in your browser, and sign in with your unix
Visit `http://localhost:8000` in your browser, and sign in with your Unix
credentials.
To **allow multiple users to sign in** to the Hub server, you must start

View File

@@ -1,8 +1,6 @@
(roles)=
# Roles
JupyterHub provides four roles that are available by default:
JupyterHub provides four (4) roles that are available by default:
```{admonition} **Default roles**
- `user` role provides a {ref}`default user scope <default-user-scope-target>` `self` that grants access to the user's own resources.
@@ -13,11 +11,11 @@ JupyterHub provides four roles that are available by default:
**These roles cannot be deleted.**
```
These default roles have a default collection of scopes,
but you can define the scopes associated with each role (excluding admin) to suit your needs,
We call these 'default' roles because they are available by default and have a default collection of scopes.
However, you can define the scopes associated with each role (excluding the admin role) to suit your needs,
as seen [below](overriding-default-roles).
The `user`, `admin`, and `token` roles by default all preserve the permissions prior to RBAC.
The `user`, `admin`, and `token` roles, by default, all preserve the permissions prior to Role-based Access Control (RBAC).
Only the `server` role is changed from pre-2.0, to reduce its permissions to activity-only
instead of the default of a full access token.
@@ -31,10 +29,10 @@ Roles can be assigned to the following entities:
An entity can have zero, one, or multiple roles, and there are no restrictions on which roles can be assigned to which entity. Roles can be added to or removed from entities at any time.
**Users** \
When a new user gets created, they are assigned their default role `user`. Additionaly, if the user is created with admin privileges (via `c.Authenticator.admin_users` in `jupyterhub_config.py` or `admin: true` via API), they will be also granted `admin` role. If existing user's admin status changes via API or `jupyterhub_config.py`, their default role will be updated accordingly (after next startup for the latter).
When a new user gets created, they are assigned their default role, `user`. Additionally, if the user is created with admin privileges (via `c.Authenticator.admin_users` in `jupyterhub_config.py` or `admin: true` via API), they will be also granted `admin` role. If existing user's admin status changes via API or `jupyterhub_config.py`, their default role will be updated accordingly (after next startup for the latter).
**Services** \
Services do not have a default role. Services without roles have no access to the guarded API end-points, so most services will require assignment of a role in order to function.
Services do not have a default role. Services without roles have no access to the guarded API end-points. So, most services will require assignment of a role in order to function.
**Groups** \
A group does not require any role, and has no roles by default. If a user is a member of a group, they automatically inherit any of the group's permissions (see {ref}`resolving-roles-scopes-target` for more details). This is useful for assigning a set of common permissions to several users.
@@ -113,7 +111,7 @@ In case the role with a certain name already exists in the database, its definit
(overriding-default-roles)=
### Overriding default roles
### Overriding Default Roles
Role definitions can include those of the "default" roles listed above (admin excluded),
if the default scopes associated with those roles do not suit your deployment.
@@ -154,7 +152,7 @@ c.JupyterHub.load_roles = [
(removing-roles-target)=
## Removing roles
## Removing Roles
Only the entities present in the role definition in the `jupyterhub_config.py` remain the role bearers. If a user, service or group is removed from the role definition, they will lose the role on the next startup.

View File

@@ -1,8 +1,8 @@
# Technical Implementation
Roles are stored in the database, where they are associated with users, services, etc., and can be added or modified as explained in {ref}`define-role-target` section. Users, services, groups, and tokens can gain, change, and lose roles. This is currently achieved via `jupyterhub_config.py` (see {ref}`define-role-target`) and will be made available via API in future. The latter will allow for changing a token's role, and thereby its permissions, without the need to issue a new token.
[Roles](roles) are stored in the database, where they are associated with users, services, and groups. Roles can be added or modified as explained in the {ref}`define-role-target` section. Users, services, groups, and tokens can gain, change, and lose roles. This is currently achieved via `jupyterhub_config.py` (see {ref}`define-role-target`) and will be made available via API in the future. The latter will allow for changing a user's role, and thereby its permissions, without the need to restart JupyterHub.
Roles and scopes utilities can be found in `roles.py` and `scopes.py` modules. Scope variables take on five different formats which is reflected throughout the utilities via specific nomenclature:
Roles and scopes utilities can be found in `roles.py` and `scopes.py` modules. Scope variables take on five different formats that are reflected throughout the utilities via specific nomenclature:
```{admonition} **Scope variable nomenclature**
:class: tip
@@ -11,22 +11,22 @@ Roles and scopes utilities can be found in `roles.py` and `scopes.py` modules. S
- _expanded scopes_ \
Set of fully expanded scopes without abbreviations (i.e., resolved metascopes, filters, and subscopes). E.g., `{"users:activity!user=charlie", "read:users:activity!user=charlie"}`.
- _parsed scopes_ \
Dictionary represenation of expanded scopes. E.g., `{"users:activity": {"user": ["charlie"]}, "read:users:activity": {"users": ["charlie"]}}`.
Dictionary representation of expanded scopes. E.g., `{"users:activity": {"user": ["charlie"]}, "read:users:activity": {"users": ["charlie"]}}`.
- _intersection_ \
Set of expanded scopes as intersection of 2 expanded scope sets.
- _identify scopes_ \
Set of expanded scopes needed for identify (whoami) endpoints.
Set of expanded scopes needed for identity (whoami) endpoints.
```
(resolving-roles-scopes-target)=
## Resolving roles and scopes
**Resolving roles** refers to determining which roles a user, service, or group has, extracting the list of scopes from each role and combining them into a single set of scopes.
**Resolving roles** involves determining which roles a user, service, or group has, extracting the list of scopes from each role and combining them into a single set of scopes.
**Resolving scopes** involves expanding scopes into all their possible subscopes (_expanded scopes_), parsing them into format used for access evaluation (_parsed scopes_) and, if applicable, comparing two sets of scopes (_intersection_). All procedures take into account the scope hierarchy, {ref}`vertical <vertical-filtering-target>` and {ref}`horizontal filtering <horizontal-filtering-target>`, limiting or elevated permissions (`read:<resource>` or `admin:<resource>`, respectively), and metascopes.
**Resolving scopes** involves expanding scopes into all their possible subscopes (_expanded scopes_), parsing them into the format used for access evaluation (_parsed scopes_) and, if applicable, comparing two sets of scopes (_intersection_). All procedures take into account the scope hierarchy, {ref}`vertical <vertical-filtering-target>` and {ref}`horizontal filtering <horizontal-filtering-target>`, limiting or elevated permissions (`read:<resource>` or `admin:<resource>`, respectively), and metascopes.
Roles and scopes are resolved on several occasions, for example when requesting an API token with specific scopes or making an API request. The following sections provide more details.
Roles and scopes are resolved on several occasions, for example when requesting an API token with specific scopes or when making an API request. The following sections provide more details.
(requesting-api-token-target)=
@@ -43,25 +43,24 @@ Prior to 3.0, tokens stored _roles_,
which meant their scopes were resolved on each request.
:::
API tokens grant access to JupyterHub's APIs. The RBAC framework allows for requesting tokens with specific permissions.
API tokens grant access to JupyterHub's APIs. The [RBAC framework](./index.md) allows for requesting tokens with specific permissions.
RBAC is involved in several stages of the OAuth token flow.
When requesting a token via the tokens API (`/users/:name/tokens`), or the token page (`/hub/token`),
if no scopes are requested, the token is issued with the permissions stored on the default `token` role
(providing the requester is allowed to create the token).
(provided the requester is allowed to create the token).
OAuth tokens are also requested via OAuth flow
If the token is requested with any scopes, the permissions of requesting entity are checked against the requested permissions to ensure the token would not grant its owner additional privileges.
If, due to modifications of permissions of the token or token owner,
at API request time a token has any scopes that its owner does not,
those scopes are removed.
If a token has any scopes that its owner does not possess
at the time of making the API request, those scopes are removed.
The API request is resolved without additional errors using the scope _intersection_;
the Hub logs a warning in this case (see {ref}`Figure 2 <api-request-chart>`).
Resolving a token's scope (yellow box in {ref}`Figure 1 <token-request-chart>`) corresponds to resolving all the token's owner roles (including the roles associated with their groups) and the token's own scopes into a set of scopes. The two sets are compared (Resolve the scopes box in orange in {ref}`Figure 1 <token-request-chart>`), taking into account the scope hierarchy.
Resolving a token's scope (yellow box in {ref}`Figure 1 <token-request-chart>`) corresponds to resolving all the roles of the token's owner (including the roles associated with their groups) and the token's own scopes into a set of scopes. The two sets are compared (Resolve the scopes box in orange in {ref}`Figure 1 <token-request-chart>`), taking into account the scope hierarchy.
If the token's scopes are a subset of the token owner's scopes, the token is issued with the requested scopes; if not, JupyterHub will raise an error.
{ref}`Figure 1 <token-request-chart>` below illustrates the steps involved. The orange rectangles highlight where in the process the roles and scopes are resolved.
@@ -75,10 +74,10 @@ Figure 1. Resolving roles and scopes during API token request
### Making an API request
With the RBAC framework, each authenticated JupyterHub API request is guarded by a scope decorator that specifies which scopes are required to gain the access to the API.
With the RBAC framework, each authenticated JupyterHub API request is guarded by a scope decorator that specifies which scopes are required in order to gain the access to the API.
When an API request is performed, the requesting API token's scopes are again intersected with its owner's (yellow box in {ref}`Figure 2 <api-request-chart>`) to ensure the token does not grant more permissions than its owner has at the request time (e.g., due to changing/losing roles).
If the owner's roles do not include some scopes of the token's scopes, only the _intersection_ of the token's and owner's scopes will be used. For example, using a token with scope `users` whose owner's role scope is `read:users:name` will result in only the `read:users:name` scope being passed on. In the case of no _intersection_, an empty set of scopes will be used.
When an API request is made, the requesting API token's scopes are again intersected with its owner's (yellow box in {ref}`Figure 2 <api-request-chart>`) to ensure that the token does not grant more permissions than its owner has at the request time (e.g., due to changing/losing roles).
If the owner's roles do not include some scopes of the token, only the _intersection_ of the token's and owner's scopes will be used. For example, using a token with scope `users` whose owner's role scope is `read:users:name` will result in only the `read:users:name` scope being passed on. In the case of no _intersection_, an empty set of scopes will be used.
The passed scopes are compared to the scopes required to access the API as follows:
@@ -86,7 +85,7 @@ The passed scopes are compared to the scopes required to access the API as follo
- if that is not the case, another check is utilized to determine if subscopes of the required API scopes can be found in the passed scope set:
- if found, the RBAC framework employs the {ref}`filtering <vertical-filtering-target>` procedures to refine the API response to access only resource attributes corresponding to the passed scopes. For example, providing a scope `read:users:activity!group=class-C` for the _GET /users_ API will return a list of user models from group `class-C` containing only the `last_activity` attribute for each user model
- if found, the RBAC framework employs the {ref}`filtering <vertical-filtering-target>` procedures to refine the API response to access only resource attributes corresponding to the passed scopes. For example, providing a scope `read:users:activity!group=class-C` for the `GET /users` API will return a list of user models from group `class-C` containing only the `last_activity` attribute for each user model
- if not found, the access to API is denied

View File

@@ -9,12 +9,12 @@ To determine which scopes a role should have, one can follow these steps:
5. Customize the scopes with filters if needed
6. Define the role with required scopes and assign to users/services/groups/tokens
Below, different use cases are presented on how to use the RBAC framework.
Below, different use cases are presented on how to use the [RBAC framework](./index.md)
## Service to cull idle servers
Finding and shutting down idle servers can save a lot of computational resources.
We can make use of [jupyterhub-idle-culler](https://github.com/jupyterhub/jupyterhub-idle-culler) to manage this for us.
**We can make use of [jupyterhub-idle-culler](https://github.com/jupyterhub/jupyterhub-idle-culler) to manage this for us.**
Below follows a short tutorial on how to add a cull-idle service in the RBAC system.
1. Install the cull-idle server script with `pip install jupyterhub-idle-culler`.

View File

@@ -31,8 +31,7 @@ popular services:
- Okpy
- OpenShift
A generic implementation, which you can use for OAuth authentication
with any provider, is also available.
A [generic implementation](https://github.com/jupyterhub/oauthenticator/blob/master/oauthenticator/generic.py), which you can use for OAuth authentication with any provider, is also available.
## The Dummy Authenticator
@@ -165,7 +164,7 @@ setup(
```
If you have added this metadata to your package,
users can select your authenticator with the configuration:
admins can select your authenticator with the configuration:
```python
c.JupyterHub.authenticator_class = 'myservice'
@@ -247,6 +246,23 @@ class MyAuthenticator(Authenticator):
spawner.environment['UPSTREAM_TOKEN'] = auth_state['upstream_token']
```
Note that environment variable names and values are always strings, so passing multiple values means setting multiple environment variables or serializing more complex data into a single variable, e.g. as a JSON string.
auth state can also be used to configure the spawner via _config_ without subclassing
by setting `c.Spawner.auth_state_hook`. This function will be called with `(spawner, auth_state)`,
only when auth_state is defined.
For example:
(for KubeSpawner)
```python
def auth_state_hook(spawner, auth_state):
spawner.volumes = auth_state['user_volumes']
spawner.mounts = auth_state['user_mounts']
c.Spawner.auth_state_hook = auth_state_hook
```
(authenticator-groups)=
## Authenticator-managed group membership
@@ -281,7 +297,7 @@ all group-management via the API is disabled.
## pre_spawn_start and post_spawn_stop hooks
Authenticators uses two hooks, {meth}`.Authenticator.pre_spawn_start` and
Authenticators use two hooks, {meth}`.Authenticator.pre_spawn_start` and
{meth}`.Authenticator.post_spawn_stop(user, spawner)` to add pass additional state information
between the authenticator and a spawner. These hooks are typically used auth-related
startup, i.e. opening a PAM session, and auth-related cleanup, i.e. closing a

View File

@@ -5,15 +5,15 @@ deployment with the following assumptions:
- Running JupyterHub on a single cloud server
- Using SSL on the standard HTTPS port 443
- Using GitHub OAuth (using oauthenticator) for login
- Using GitHub OAuth (using [OAuthenticator](https://oauthenticator.readthedocs.io/en/latest)) for login
- Using the default spawner (to configure other spawners, uncomment and edit
`spawner_class` as well as follow the instructions for your desired spawner)
- Users exist locally on the server
- Users' notebooks to be served from `~/assignments` to allow users to browse
for notebooks within other users' home directories
- You want the landing page for each user to be a `Welcome.ipynb` notebook in
their assignments directory.
- All runtime files are put into `/srv/jupyterhub` and log files in `/var/log`.
their assignments directory
- All runtime files are put into `/srv/jupyterhub` and log files in `/var/log`
The `jupyterhub_config.py` file would have these settings:
@@ -69,7 +69,7 @@ c.Spawner.args = ['--NotebookApp.default_url=/notebooks/Welcome.ipynb']
```
Using the GitHub Authenticator requires a few additional
environment variable to be set prior to launching JupyterHub:
environment variables to be set prior to launching JupyterHub:
```bash
export GITHUB_CLIENT_ID=github_id
@@ -79,3 +79,5 @@ export CONFIGPROXY_AUTH_TOKEN=super-secret
# append log output to log file /var/log/jupyterhub.log
jupyterhub -f /etc/jupyterhub/jupyterhub_config.py &>> /var/log/jupyterhub.log
```
Visit the [Github OAuthenticator reference](https://oauthenticator.readthedocs.io/en/latest/api/gen/oauthenticator.github.html) to see the full list of options for configuring Github OAuth with JupyterHub.

View File

@@ -14,7 +14,7 @@ satisfy the following:
- After testing, the server in question should be able to score at least an A on the
Qualys SSL Labs [SSL Server Test](https://www.ssllabs.com/ssltest/)
Let's start out with needed JupyterHub configuration in `jupyterhub_config.py`:
Let's start out with the needed JupyterHub configuration in `jupyterhub_config.py`:
```python
# Force the proxy to only listen to connections to 127.0.0.1 (on port 8000)
@@ -30,15 +30,15 @@ This can take a few minutes:
openssl dhparam -out /etc/ssl/certs/dhparam.pem 4096
```
## nginx
## Nginx
This **`nginx` config file** is fairly standard fare except for the two
`location` blocks within the main section for HUB.DOMAIN.tld.
To create a new site for jupyterhub in your nginx config, make a new file
To create a new site for jupyterhub in your Nginx config, make a new file
in `sites.enabled`, e.g. `/etc/nginx/sites.enabled/jupyterhub.conf`:
```bash
# top-level http config for websocket headers
# Top-level HTTP config for WebSocket headers
# If Upgrade is defined, Connection = upgrade
# If Upgrade is empty, Connection = close
map $http_upgrade $connection_upgrade {
@@ -51,7 +51,7 @@ server {
listen 80;
server_name HUB.DOMAIN.TLD;
# Tell all requests to port 80 to be 302 redirected to HTTPS
# Redirect the request to HTTPS
return 302 https://$host$request_uri;
}
@@ -75,7 +75,7 @@ server {
ssl_stapling_verify on;
add_header Strict-Transport-Security max-age=15768000;
# Managing literal requests to the JupyterHub front end
# Managing literal requests to the JupyterHub frontend
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header X-Real-IP $remote_addr;
@@ -101,10 +101,10 @@ server {
If `nginx` is not running on port 443, substitute `$http_host` for `$host` on
the lines setting the `Host` header.
`nginx` will now be the front facing element of JupyterHub on `443` which means
`nginx` will now be the front-facing element of JupyterHub on `443` which means
it is also free to bind other servers, like `NO_HUB.DOMAIN.TLD` to the same port
on the same machine and network interface. In fact, one can simply use the same
server blocks as above for `NO_HUB` and simply add line for the root directory
server blocks as above for `NO_HUB` and simply add a line for the root directory
of the site as well as the applicable location call:
```bash
@@ -112,7 +112,7 @@ server {
listen 80;
server_name NO_HUB.DOMAIN.TLD;
# Tell all requests to port 80 to be 302 redirected to HTTPS
# Redirect the request to HTTPS
return 302 https://$host$request_uri;
}
@@ -143,12 +143,12 @@ Now restart `nginx`, restart the JupyterHub, and enjoy accessing
`https://HUB.DOMAIN.TLD` while serving other content securely on
`https://NO_HUB.DOMAIN.TLD`.
### SELinux permissions for nginx
### SELinux permissions for Nginx
On distributions with SELinux enabled (e.g. Fedora), one may encounter permission errors
when the nginx service is started.
when the Nginx service is started.
We need to allow nginx to perform network relay and connect to the jupyterhub port. The
We need to allow Nginx to perform network relay and connect to the JupyterHub port. The
following commands do that:
```bash
@@ -157,26 +157,26 @@ setsebool -P httpd_can_network_relay 1
setsebool -P httpd_can_network_connect 1
```
Replace 8000 with the port the jupyterhub server is running from.
Replace 8000 with the port the JupyterHub server is running from.
## Apache
As with nginx above, you can use [Apache](https://httpd.apache.org) as the reverse proxy.
First, we will need to enable the apache modules that we are going to need:
As with Nginx above, you can use [Apache](https://httpd.apache.org) as the reverse proxy.
First, we will need to enable the Apache modules that we are going to need:
```bash
a2enmod ssl rewrite proxy headers proxy_http proxy_wstunnel
```
Our Apache configuration is equivalent to the nginx configuration above:
Our Apache configuration is equivalent to the Nginx configuration above:
- Redirect HTTP to HTTPS
- Good SSL Configuration
- Support for websockets on any proxied URL
- Support for WebSocket on any proxied URL
- JupyterHub is running locally at http://127.0.0.1:8000
```bash
# redirect HTTP to HTTPS
# Redirect HTTP to HTTPS
Listen 80
<VirtualHost HUB.DOMAIN.TLD:80>
ServerName HUB.DOMAIN.TLD
@@ -188,26 +188,26 @@ Listen 443
ServerName HUB.DOMAIN.TLD
# enable HTTP/2, if available
# Enable HTTP/2, if available
Protocols h2 http/1.1
# HTTP Strict Transport Security (mod_headers is required) (63072000 seconds)
Header always set Strict-Transport-Security "max-age=63072000"
# configure SSL
# Configure SSL
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/HUB.DOMAIN.TLD/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/HUB.DOMAIN.TLD/privkey.pem
SSLOpenSSLConfCmd DHParameters /etc/ssl/certs/dhparam.pem
# intermediate configuration from ssl-config.mozilla.org (2022-03-03)
# Please note, that this configuration might be out-dated - please update it accordingly using https://ssl-config.mozilla.org/
# Intermediate configuration from SSL-config.mozilla.org (2022-03-03)
# Please note, that this configuration might be outdated - please update it accordingly using https://ssl-config.mozilla.org/
SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
SSLHonorCipherOrder off
SSLSessionTickets off
# Use RewriteEngine to handle websocket connection upgrades
# Use RewriteEngine to handle WebSocket connection upgrades
RewriteEngine On
RewriteCond %{HTTP:Connection} Upgrade [NC]
RewriteCond %{HTTP:Upgrade} websocket [NC]
@@ -224,7 +224,7 @@ Listen 443
</VirtualHost>
```
In case of the need to run the jupyterhub under /jhub/ or other location please use the below configurations:
In case of the need to run JupyterHub under /jhub/ or another location please use the below configurations:
- JupyterHub running locally at http://127.0.0.1:8000/jhub/ or other location
@@ -240,8 +240,8 @@ httpd.conf amendments:
jupyterhub_config.py amendments:
```bash
--The public facing URL of the whole JupyterHub application.
--This is the address on which the proxy will bind. Sets protocol, ip, base_url
c.JupyterHub.bind_url = 'http://127.0.0.1:8000/jhub/'
```python
# The public facing URL of the whole JupyterHub application.
# This is the address on which the proxy will bind. Sets protocol, IP, base_url
c.JupyterHub.bind_url = 'http://127.0.0.1:8000/jhub/'
```

View File

@@ -6,10 +6,10 @@ Only do this if you are very sure you must.
## Overview
There are many Authenticators and Spawners available for JupyterHub. Some, such
as DockerSpawner or OAuthenticator, do not need any elevated permissions. This
There are many [Authenticators](../getting-started/authenticators-users-basics) and [Spawners](../getting-started/spawners-basics) available for JupyterHub. Some, such
as [DockerSpawner](https://github.com/jupyterhub/dockerspawner) or [OAuthenticator](https://github.com/jupyterhub/oauthenticator), do not need any elevated permissions. This
document describes how to get the full default behavior of JupyterHub while
running notebook servers as real system users on a shared system without
running notebook servers as real system users on a shared system, without
running the Hub itself as root.
Since JupyterHub needs to spawn processes as other users, the simplest way
@@ -69,7 +69,8 @@ Cmnd_Alias JUPYTER_CMD = /usr/local/bin/sudospawner
rhea ALL=(JUPYTER_USERS) NOPASSWD:JUPYTER_CMD
```
It might be useful to modify `secure_path` to add commands in path.
It might be useful to modify `secure_path` to add commands in path. (Search for
`secure_path` in the [sudo docs](https://www.sudo.ws/man/1.8.14/sudoers.man.html)
As an alternative to adding every user to the `/etc/sudoers` file, you can
use a group in the last line above, instead of `JUPYTER_USERS`:
@@ -90,7 +91,7 @@ $ adduser -G jupyterhub newuser
Test that the new user doesn't need to enter a password to run the sudospawner
command.
This should prompt for your password to switch to rhea, but _not_ prompt for
This should prompt for your password to switch to `rhea`, but _not_ prompt for
any password for the second switch. It should show some help output about
logging options:
@@ -119,7 +120,7 @@ the shadow password database.
### Shadow group (Linux)
**Note:** On Fedora based distributions there is no clear way to configure
**Note:** On [Fedora based distributions](https://fedoraproject.org/wiki/List_of_Fedora_remixes) there is no clear way to configure
the PAM database to allow sufficient access for authenticating with the target user's password
from JupyterHub. As a workaround we recommend use an
[alternative authentication method](https://github.com/jupyterhub/jupyterhub/wiki/Authenticators).
@@ -150,7 +151,7 @@ We want our new user to be able to read the shadow passwords, so add it to the s
$ sudo usermod -a -G shadow rhea
```
If you want jupyterhub to serve pages on a restricted port (such as port 80 for http),
If you want jupyterhub to serve pages on a restricted port (such as port 80 for HTTP),
then you will need to give `node` permission to do so:
```bash
@@ -158,6 +159,7 @@ sudo setcap 'cap_net_bind_service=+ep' /usr/bin/node
```
However, you may want to further understand the consequences of this.
([Further reading](http://man7.org/linux/man-pages/man7/capabilities.7.html))
You may also be interested in limiting the amount of CPU any process can use
on your server. `cpulimit` is a useful tool that is available for many Linux
@@ -167,7 +169,8 @@ instructions](http://ubuntuforums.org/showthread.php?t=992706).
### Shadow group (FreeBSD)
**NOTE:** This has not been tested and may not work as expected.
**NOTE:** This has not been tested on FreeBSD and may not work as expected on
the FreeBSD platform. _Do not use in production without verifying that it works properly!_
```bash
$ ls -l /etc/spwd.db /etc/master.passwd
@@ -226,7 +229,7 @@ And try logging in.
## Troubleshooting: SELinux
If you still get a generic `Permission denied` `PermissionError`, it's possible SELinux is blocking you.
Here's how you can make a module to allow this.
Here's how you can make a module to resolve this.
First, put this in a file named `sudo_exec_selinux.te`:
```bash
@@ -253,6 +256,6 @@ $ semodule -i sudo_exec_selinux.pp
## Troubleshooting: PAM session errors
If the PAM authentication doesn't work and you see errors for
`login:session-auth`, or similar, considering updating to a more recent version
`login:session-auth`, or similar, consider updating to a more recent version
of jupyterhub and disabling the opening of PAM sessions with
`c.PAMAuthenticator.open_sessions=False`.

View File

@@ -1,49 +1,47 @@
# Configuring user environments
Deploying JupyterHub means you are providing Jupyter notebook environments for
To deploy JupyterHub means you are providing Jupyter notebook environments for
multiple users. Often, this includes a desire to configure the user
environment in some way.
environment in a custom way.
Since the `jupyterhub-singleuser` server extends the standard Jupyter notebook
server, most configuration and documentation that applies to Jupyter Notebook
applies to the single-user environments. Configuration of user environments
typically does not occur through JupyterHub itself, but rather through system-
wide configuration of Jupyter, which is inherited by `jupyterhub-singleuser`.
typically does not occur through JupyterHub itself, but rather through system-wide
configuration of Jupyter, which is inherited by `jupyterhub-singleuser`.
**Tip:** When searching for configuration tips for JupyterHub user
environments, try removing JupyterHub from your search because there are a lot
more people out there configuring Jupyter than JupyterHub and the
configuration is the same.
**Tip:** When searching for configuration tips for JupyterHub user environments, you might want to remove JupyterHub from your search because there are a lot more people out there configuring Jupyter than JupyterHub and the configuration is the same.
This section will focus on user environments, including:
This section will focus on user environments, which includes the following:
- Installing packages
- Configuring Jupyter and IPython
- Installing kernelspecs
- Using containers vs. multi-user hosts
- [Installing packages](#installing-packages)
- [Configuring Jupyter and IPython](#configuring-jupyter-and-ipython)
- [Installing kernelspecs](#installing-kernelspecs)
- [Using containers vs. multi-user hosts](#multi-user-hosts-vs-containers)
## Installing packages
To make packages available to users, you generally will install packages
system-wide or in a shared environment.
To make packages available to users, you will typically install packages system-wide or in a shared environment.
This installation location should always be in the same environment that
This installation location should always be in the same environment where
`jupyterhub-singleuser` itself is installed in, and must be _readable and
executable_ by your users. If you want users to be able to install additional
packages, it must also be _writable_ by your users.
executable_ by your users. If you want your users to be able to install additional
packages, the installation location must also be _writable_ by your users.
If you are using a standard system Python install, you would use:
If you are using a standard Python installation on your system, use the following command:
```bash
sudo python3 -m pip install numpy
```
to install the numpy package in the default system Python 3 environment
to install the numpy package in the default Python 3 environment on your system
(typically `/usr/local`).
You may also use conda to install packages. If you do, you should make sure
that the conda environment has appropriate permissions for users to be able to
run Python code in the env.
run Python code in the env. The env must be _readable and executable_ by all
users. Additionally it must be _writeable_ if you want users to install
additional packages.
## Configuring Jupyter and IPython
@@ -51,15 +49,9 @@ run Python code in the env.
and [IPython](https://ipython.readthedocs.io/en/stable/development/config.html)
have their own configuration systems.
As a JupyterHub administrator, you will typically want to install and configure
environments for all JupyterHub users. For example, you wish for each student in
a class to have the same user environment configuration.
Jupyter and IPython support **"system-wide"** locations for configuration, which
is the logical place to put global configuration that you want to affect all
users. It's generally more efficient to configure user environments "system-wide",
and it's a good idea to avoid creating files in users' home directories.
As a JupyterHub administrator, you will typically want to install and configure environments for all JupyterHub users. For example, let's say you wish for each student in a class to have the same user environment configuration.
Jupyter and IPython support **"system-wide"** locations for configuration, which is the logical place to put global configuration that you want to affect all users. It's generally more efficient to configure user environments "system-wide", and it's a good practice to avoid creating files in the users' home directories.
The typical locations for these config files are:
- **system-wide** in `/etc/{jupyter|ipython}`
@@ -67,8 +59,7 @@ The typical locations for these config files are:
### Example: Enable an extension system-wide
For example, to enable the `cython` IPython extension for all of your users,
create the file `/etc/ipython/ipython_config.py`:
For example, to enable the `cython` IPython extension for all of your users, create the file `/etc/ipython/ipython_config.py`:
```python
c.InteractiveShellApp.extensions.append("cython")
@@ -77,21 +68,18 @@ c.InteractiveShellApp.extensions.append("cython")
### Example: Enable a Jupyter notebook configuration setting for all users
:::{note}
These examples configure the Jupyter ServerApp,
which is used by JupyterLab, the default in JupyterHub 2.0.
These examples configure the Jupyter ServerApp, which is used by JupyterLab, the default in JupyterHub 2.0.
If you are using the classing Jupyter Notebook server,
the same things should work,
with the following substitutions:
- Where you see `jupyter_server_config`, use `jupyter_notebook_config`
- Where you see `NotebookApp`, use `ServerApp`
- Search for `jupyter_server_config`, and replace with `jupyter_notebook_config`
- Search for `NotebookApp`, and replace with `ServerApp`
:::
To enable Jupyter notebook's internal idle-shutdown behavior (requires
notebook ≥ 5.4), set the following in the `/etc/jupyter/jupyter_server_config.py`
file:
To enable Jupyter notebook's internal idle-shutdown behavior (requires notebook ≥ 5.4), set the following in the `/etc/jupyter/jupyter_server_config.py` file:
```python
# shutdown the server after no activity for an hour
@@ -104,16 +92,14 @@ c.MappingKernelManager.cull_interval = 2 * 60
## Installing kernelspecs
You may have multiple Jupyter kernels installed and want to make sure that
they are available to all of your users. This means installing kernelspecs
either system-wide (e.g. in /usr/local/) or in the `sys.prefix` of JupyterHub
You may have multiple Jupyter kernels installed and want to make sure that they are available to all of your users. This means installing kernelspecs either system-wide (e.g. in /usr/local/) or in the `sys.prefix` of JupyterHub
itself.
Jupyter kernelspec installation is system wide by default, but some kernels
Jupyter kernelspec installation is system-wide by default, but some kernels
may default to installing kernelspecs in your home directory. These will need
to be moved system-wide to ensure that they are accessible.
You can see where your kernelspecs are with:
To see where your kernelspecs are, you can use the following command:
```bash
jupyter kernelspec list
@@ -121,8 +107,7 @@ jupyter kernelspec list
### Example: Installing kernels system-wide
Assuming I have a Python 2 and Python 3 environment that I want to make
sure are available, I can install their specs system-wide (in /usr/local) with:
Let's assume that I have a Python 2 and Python 3 environment that I want to make sure are available, I can install their specs **system-wide** (in /usr/local) using the following command:
```bash
/path/to/python3 -m ipykernel install --prefix=/usr/local
@@ -141,31 +126,25 @@ How you configure user environments for each category can differ a bit
depending on what Spawner you are using.
The first category is a **shared system (multi-user host)** where
each user has a JupyterHub account and a home directory as well as being
each user has a JupyterHub account, a home directory as well as being
a real system user. In this example, shared configuration and installation
must be in a 'system-wide' location, such as `/etc/` or `/usr/local`
must be in a 'system-wide' location, such as `/etc/`, or `/usr/local`
or a custom prefix such as `/opt/conda`.
When JupyterHub uses **container-based** Spawners (e.g. KubeSpawner or
DockerSpawner), the 'system-wide' environment is really the container image
which you are using for users.
DockerSpawner), the 'system-wide' environment is really the container image used for users.
In both cases, you want to _avoid putting configuration in user home
directories_ because users can change those configuration settings. Also,
home directories typically persist once they are created, so they are
difficult for admins to update later.
directories_ because users can change those configuration settings. Also, home directories typically persist once they are created, thereby making it difficult for admins to update later.
## Named servers
By default, in a JupyterHub deployment each user has exactly one server.
By default, in a JupyterHub deployment, each user has one server only.
JupyterHub can, however, have multiple servers per user.
This is most useful in deployments where users can configure the environment
in which their server will start (e.g. resource requests on an HPC cluster),
so that a given user can have multiple configurations running at the same time,
without having to stop and restart their one server.
This is mostly useful in deployments where users can configure the environment in which their server will start (e.g. resource requests on an HPC cluster), so that a given user can have multiple configurations running at the same time, without having to stop and restart their own server.
To allow named servers:
To allow named servers, include this code snippet in your config file:
```python
c.JupyterHub.allow_named_servers = True
@@ -181,22 +160,39 @@ as well as the admin page:
![named servers on the admin page](../images/named-servers-admin.png)
Named servers can be accessed, created, started, stopped, and deleted
from these pages. Activity tracking is now per-server as well.
from these pages. Activity tracking is now per server as well.
The number of named servers per user can be limited by setting
To limit the number of **named server** per user by setting a constant value, include this code snippet in your config file:
```python
c.JupyterHub.named_server_limit_per_user = 5
```
Alternatively, to use a callable/awaitable based on the handler object, include this code snippet in your config file:
```python
def named_server_limit_per_user_fn(handler):
user = handler.current_user
if user and user.admin:
return 0
return 5
c.JupyterHub.named_server_limit_per_user = named_server_limit_per_user_fn
```
This can be useful for quota service implementations. The example above limits the number of named servers for non-admin users only.
If `named_server_limit_per_user` is set to `0`, no limit is enforced.
(classic-notebook-ui)=
## Switching back to classic notebook
## Switching back to the classic notebook
By default the single-user server launches JupyterLab,
By default, the single-user server launches JupyterLab,
which is based on [Jupyter Server][].
This is the default server when running JupyterHub ≥ 2.0.
You can switch to using the legacy Jupyter Notebook server by setting the `JUPYTERHUB_SINGLEUSER_APP` environment variable
To switch to using the legacy Jupyter Notebook server, you can set the `JUPYTERHUB_SINGLEUSER_APP` environment variable
(in the single-user environment) to:
```bash
@@ -207,19 +203,20 @@ export JUPYTERHUB_SINGLEUSER_APP='notebook.notebookapp.NotebookApp'
[jupyter notebook]: https://jupyter-notebook.readthedocs.io
:::{versionchanged} 2.0
JupyterLab is now the default singleuser UI, if available,
JupyterLab is now the default single-user UI, if available,
which is based on the [Jupyter Server][],
no longer the legacy [Jupyter Notebook][] server.
JupyterHub prior to 2.0 launched the legacy notebook server (`jupyter notebook`),
and Jupyter server could be selected by specifying
and the Jupyter server could be selected by specifying the following:
```python
# jupyterhub_config.py
c.Spawner.cmd = ["jupyter-labhub"]
```
or for an otherwise customized Jupyter Server app,
set the environment variable:
Alternatively, for an otherwise customized Jupyter Server app,
set the environment variable using the following command:
```bash
export JUPYTERHUB_SINGLEUSER_APP='jupyter_server.serverapp.ServerApp'

View File

@@ -1,26 +1,26 @@
# JupyterHub and OAuth
JupyterHub uses OAuth 2 internally as a mechanism for authenticating users.
JupyterHub uses [OAuth 2](https://oauth.net/2/) as an internal mechanism for authenticating users.
As such, JupyterHub itself always functions as an OAuth **provider**.
More on what that means [below](oauth-terms).
You can find out more about what that means [below](oauth-terms).
Additionally, JupyterHub is _often_ deployed with [oauthenticator](https://oauthenticator.readthedocs.io),
Additionally, JupyterHub is _often_ deployed with [OAuthenticator](https://oauthenticator.readthedocs.io),
where an external identity provider, such as GitHub or KeyCloak, is used to authenticate users.
When this is the case, there are _two_ nested oauth flows:
an _internal_ oauth flow where JupyterHub is the **provider**,
and and _external_ oauth flow, where JupyterHub is a **client**.
When this is the case, there are _two_ nested OAuth flows:
an _internal_ OAuth flow where JupyterHub is the **provider**,
and an _external_ OAuth flow, where JupyterHub is the **client**.
This means that when you are using JupyterHub, there is always _at least one_ and often two layers of OAuth involved in a user logging in and accessing their server.
Some relevant points:
The following points are noteworthy:
- Single-user servers _never_ need to communicate with or be aware of the upstream provider configured in your Authenticator.
As far as they are concerned, only JupyterHub is an OAuth provider,
As far as the servers are concerned, only JupyterHub is an OAuth provider,
and how users authenticate with the Hub itself is irrelevant.
- When talking to a single-user server,
- When interacting with a single-user server,
there are ~always two tokens:
a token issued to the server itself to communicate with the Hub API,
and a second per-user token in the browser to represent the completed login process and authorized permissions.
first, a token issued to the server itself to communicate with the Hub API,
and second, a per-user token in the browser to represent the completed login process and authorized permissions.
More on this [later](two-tokens).
(oauth-terms)=
@@ -28,66 +28,66 @@ Some relevant points:
## Key OAuth terms
Here are some key definitions to keep in mind when we are talking about OAuth.
You can also read more detail [here](https://www.oauth.com/oauth2-servers/definitions/).
You can also read more in detail [here](https://www.oauth.com/oauth2-servers/definitions/).
- **provider** the entity responsible for managing identity and authorization,
- **provider**: The entity responsible for managing identity and authorization;
always a web server.
JupyterHub is _always_ an oauth provider for JupyterHub's components.
When OAuthenticator is used, an external service, such as GitHub or KeyCloak, is also an oauth provider.
- **client** An entity that requests OAuth **tokens** on a user's behalf,
JupyterHub is _always_ an OAuth provider for JupyterHub's components.
When OAuthenticator is used, an external service, such as GitHub or KeyCloak, is also an OAuth provider.
- **client**: An entity that requests OAuth **tokens** on a user's behalf;
generally a web server of some kind.
OAuth **clients** are services that _delegate_ authentication and/or authorization
to an OAuth **provider**.
JupyterHub _services_ or single-user _servers_ are OAuth **clients** of the JupyterHub **provider**.
When OAuthenticator is used, JupyterHub is itself _also_ an OAuth **client** for the external oauth **provider**, e.g. GitHub.
- **browser** A user's web browser, which makes requests and stores things like cookies
- **token** The secret value used to represent a user's authorization. This is the final product of the OAuth process.
- **code** A short-lived temporary secret that the **client** exchanges
for a **token** at the conclusion of oauth,
in what's generally called the "oauth callback handler."
When OAuthenticator is used, JupyterHub is itself _also_ an OAuth **client** for the external OAuth **provider**, e.g. GitHub.
- **browser**: A user's web browser, which makes requests and stores things like cookies.
- **token**: The secret value used to represent a user's authorization. This is the final product of the OAuth process.
- **code**: A short-lived temporary secret that the **client** exchanges
for a **token** at the conclusion of OAuth,
in what's generally called the "OAuth callback handler."
## One oauth flow
OAuth **flow** is what we call the sequence of HTTP requests involved in authenticating a user and issuing a token, ultimately used for authorized access to a service or single-user server.
OAuth **flow** is what we call the sequence of HTTP requests involved in authenticating a user and issuing a token, ultimately used for authorizing access to a service or single-user server.
A single oauth flow generally goes like this:
A single OAuth flow typically goes like this:
### OAuth request and redirect
1. A **browser** makes an HTTP request to an oauth **client**.
2. There are no credentials, so the client _redirects_ the browser to an "authorize" page on the oauth **provider** with some extra information:
- the oauth **client id** of the client itself
- the **redirect uri** to be redirected back to after completion
1. A **browser** makes an HTTP request to an OAuth **client**.
2. There are no credentials, so the client _redirects_ the browser to an "authorize" page on the OAuth **provider** with some extra information:
- the OAuth **client ID** of the client itself.
- the **redirect URI** to be redirected back to after completion.
- the **scopes** requested, which the user should be presented with to confirm.
This is the "X would like to be able to Y on your behalf. Allow this?" page you see on all the "Login with ..." pages around the Internet.
3. During this authorize step,
the browser must be _authenticated_ with the provider.
This is often already stored in a cookie,
but if not the provider webapp must begin its _own_ authentication process before serving the authorization page.
This _may_ even begin another oauth flow!
This _may_ even begin another OAuth flow!
4. After the user tells the provider that they want to proceed with the authorization,
the provider records this authorization in a short-lived record called an **oauth code**.
5. Finally, the oauth provider redirects the browser _back_ to the oauth client's "redirect uri"
(or "oauth callback uri"),
with the oauth code in a url parameter.
the provider records this authorization in a short-lived record called an **OAuth code**.
5. Finally, the oauth provider redirects the browser _back_ to the oauth client's "redirect URI"
(or "OAuth callback URI"),
with the OAuth code in a URL parameter.
That's the end of the requests made between the **browser** and the **provider**.
That marks the end of the requests made between the **browser** and the **provider**.
### State after redirect
At this point:
- The browser is authenticated with the _provider_
- The user's authorized permissions are recorded in an _oauth code_
- The _provider_ knows that the given oauth client's requested permissions have been granted, but the client doesn't know this yet.
- All requests so far have been made directly by the browser.
No requests have originated at the client or provider.
- The browser is authenticated with the _provider_.
- The user's authorized permissions are recorded in an _OAuth code_.
- The _provider_ knows that the permissions requested by the OAuth client have been granted, but the client doesn't know this yet.
- All the requests so far have been made directly by the browser.
No requests have originated from the client or provider.
### OAuth Client Handles Callback Request
Now we get to finish the OAuth process.
Let's dig into what the oauth client does when it handles
the oauth callback request with the
At this stage, we get to finish the OAuth process.
Let's dig into what the OAuth client does when it handles
the OAuth callback request.
- The OAuth client receives the _code_ and makes an API request to the _provider_ to exchange the code for a real _token_.
This is the first direct request between the OAuth _client_ and the _provider_.
@@ -95,12 +95,12 @@ the oauth callback request with the
makes a second API request to the _provider_
to retrieve information about the owner of the token (the user).
This is the step where behavior diverges for different OAuth providers.
Up to this point, all oauth providers are the same, following the oauth specification.
However, oauth does not define a standard for exchanging tokens for information about their owner or permissions ([OpenID Connect](https://openid.net/connect/) does that),
Up to this point, all OAuth providers are the same, following the OAuth specification.
However, OAuth does not define a standard for issuing tokens in exchange for information about their owner or permissions ([OpenID Connect](https://openid.net/connect/) does that),
so this step may be different for each OAuth provider.
- Finally, the oauth client stores its own record that the user is authorized in a cookie.
- Finally, the OAuth client stores its own record that the user is authorized in a cookie.
This could be the token itself, or any other appropriate representation of successful authentication.
- Last of all, now that credentials have been established,
- Now that credentials have been established,
the browser can be redirected to the _original_ URL where it started,
to try the request again.
If the client wasn't able to keep track of the original URL all this time
@@ -113,24 +113,24 @@ So that's _one_ OAuth process.
## Full sequence of OAuth in JupyterHub
Let's go through the above oauth process in JupyterHub,
with specific examples of each HTTP request and what information is contained.
For bonus points, we are using the double-oauth example of JupyterHub configured with GitHubOAuthenticator.
Let's go through the above OAuth process in JupyterHub,
with specific examples of each HTTP request and what information it contains.
For bonus points, we are using the double-OAuth example of JupyterHub configured with GitHubOAuthenticator.
To disambiguate, we will call the OAuth process where JupyterHub is the **provider** "internal oauth,"
and the one with JupyterHub as a **client** "external oauth."
To disambiguate, we will call the OAuth process where JupyterHub is the **provider** "internal OAuth,"
and the one with JupyterHub as a **client** "external OAuth."
Our starting point:
- a user's single-user server is running. Let's call them `danez`
- jupyterhub is running with GitHub as an oauth provider (this means two full instances of oauth),
- Danez has a fresh browser session with no cookies yet
- Jupyterhub is running with GitHub as an OAuth provider (this means two full instances of OAuth),
- Danez has a fresh browser session with no cookies yet.
First request:
- browser->single-user server running JupyterLab or Jupyter Classic
- `GET /user/danez/notebooks/mynotebook.ipynb`
- no credentials, so single-user server (as an oauth **client**) starts internal oauth process with JupyterHub (the **provider**)
- no credentials, so single-user server (as an OAuth **client**) starts internal OAuth process with JupyterHub (the **provider**)
- response: 302 redirect -> `/hub/api/oauth2/authorize`
with:
- client-id=`jupyterhub-user-danez`
@@ -138,9 +138,9 @@ First request:
Second request, following redirect:
- browser->jupyterhub
- browser->JupyterHub
- `GET /hub/api/oauth2/authorize`
- no credentials, so jupyterhub starts external oauth process _with GitHub_
- no credentials, so JupyterHub starts external OAuth process _with GitHub_
- response: 302 redirect -> `https://github.com/login/oauth/authorize`
with:
- client-id=`jupyterhub-client-uuid`
@@ -154,8 +154,8 @@ c.JupyterHub.authenticator_class = 'github'
```
That means authenticating a request to the Hub itself starts
a _second_, external oauth process with GitHub as a provider.
This external oauth process is optional, though.
a _second_, external OAuth process with GitHub as a provider.
This external OAuth process is optional, though.
If you were using the default username+password PAMAuthenticator,
this redirect would have been to `/hub/login` instead, to present the user
with a login form.
@@ -171,7 +171,7 @@ Here, GitHub prompts for login and asks for confirmation of authorization
After successful authorization
(either by looking up a pre-existing authorization,
or recording it via form submission)
GitHub issues an **oauth code** and redirects to `/hub/oauth_callback?code=github-code`
GitHub issues an **OAuth code** and redirects to `/hub/oauth_callback?code=github-code`
Next request:
@@ -184,7 +184,7 @@ The first:
- JupyterHub->GitHub
- `POST https://github.com/login/oauth/access_token`
- request made with oauth **code** from url parameter
- request made with OAuth **code** from URL parameter
- response includes an access **token**
The second:
@@ -194,9 +194,9 @@ The second:
- request made with access **token** in the `Authorization` header
- response is the user model, including username, email, etc.
Now the external oauth callback request completes with:
Now the external OAuth callback request completes with:
- set cookie on `/hub/` path, recording jupyterhub authentication so we don't need to do external oauth with GitHub again for a while
- set cookie on `/hub/` path, recording jupyterhub authentication so we don't need to do external OAuth with GitHub again for a while
- redirect -> `/hub/api/oauth2/authorize`
🎉 At this point, we have completed our first OAuth flow! 🎉
@@ -211,14 +211,14 @@ Now, we get our first repeated request:
2. automatically accepts authorization (shortcut taken when a user is visiting their own server)
- redirect -> `/user/danez/oauth_callback?code=jupyterhub-code`
Here, we start the same oauth callback process as before, but at Danez's single-user server for the _internal_ oauth
Here, we start the same OAuth callback process as before, but at Danez's single-user server for the _internal_ OAuth.
- browser->single-user server
- `GET /user/danez/oauth_callback`
(in handler)
Inside the internal oauth callback handler,
Inside the internal OAuth callback handler,
Danez's server makes two API requests to JupyterHub:
The first:
@@ -271,15 +271,15 @@ To handle this, OAuth tokens and the various places they are stored can _expire_
which should have the same effect as no credentials,
and trigger the authorization process again.
In JupyterHub's internal oauth, we have these layers of information that can go stale:
In JupyterHub's internal OAuth, we have these layers of information that can go stale:
- The oauth client has a **cache** of Hub responses for tokens,
- The OAuth client has a **cache** of Hub responses for tokens,
so it doesn't need to make API requests to the Hub for every request it receives.
This cache has an expiry of five minutes by default,
and is governed by the configuration `HubAuth.cache_max_age` in the single-user server.
- The internal oauth token is stored in a cookie, which has its own expiry (default: 14 days),
- The internal OAuth token is stored in a cookie, which has its own expiry (default: 14 days),
governed by `JupyterHub.cookie_max_age_days`.
- The internal oauth token can also itself expire,
- The internal OAuth token itself can also expire,
which is by default the same as the cookie expiry,
since it makes sense for the token itself and the place it is stored to expire at the same time.
This is governed by `JupyterHub.cookie_max_age_days` first,
@@ -317,9 +317,9 @@ triggering the external login process anew before letting a user proceed.
- If the token has expired, but is still in the cookie:
when the token response cache expires,
the next time the server asks the hub about the token,
no user will be identified and the internal oauth process begins again.
no user will be identified and the internal OAuth process begins again.
- If the token _cookie_ expires, the next browser request will be made with no credentials,
and the internal oauth process will begin again.
and the internal OAuth process will begin again.
This will usually have the form of a transparent redirect browsers won't notice.
However, if this occurs on an API request in a long-lived page visit
such as a JupyterLab session, the API request may fail and require
@@ -352,7 +352,7 @@ Logging out of JupyterHub means clearing and revoking many of these credentials:
### A tale of two tokens
**TODO**: discuss API token issued to server at startup ($JUPYTERHUB_API_TOKEN)
and oauth-issued token in the cookie,
and OAuth-issued token in the cookie,
and some details of how JupyterLab currently deals with that.
They are different, and JupyterLab should be making requests using the token from the cookie,
not the token from the server,

View File

@@ -7,9 +7,12 @@ Hub manages by default as a subprocess (it can be run externally, as well, and
typically is in production deployments).
The upside to CHP, and why we use it by default, is that it's easy to install
and run (if you have nodejs, you are set!). The downsides are that it's a
single process and does not support any persistence of the routing table. So
if the proxy process dies, your whole JupyterHub instance is inaccessible
and run (if you have nodejs, you are set!). The downsides are that
- it's a single process and
- does not support any persistence of the routing table.
So if the proxy process dies, your whole JupyterHub instance is inaccessible
until the Hub notices, restarts the proxy, and restores the routing table. For
deployments that want to avoid such a single point of failure, or leverage
existing proxy infrastructure in their chosen deployment (such as Kubernetes
@@ -138,7 +141,7 @@ async def delete_route(self, routespec):
For retrieval, you only _need_ to implement a single method that retrieves all
routes. The return value for this function should be a dictionary, keyed by
`routespect`, of dicts whose keys are the same three arguments passed to
`routespec`, of dicts whose keys are the same three arguments passed to
`add_route` (`routespec`, `target`, `data`)
```python
@@ -204,7 +207,7 @@ setup(
```
If you have added this metadata to your package,
users can select your proxy with the configuration:
admins can select your authenticator with the configuration:
```python
c.JupyterHub.proxy_class = 'mything'
@@ -216,7 +219,7 @@ instead of the full
c.JupyterHub.proxy_class = 'mypackage:MyProxy'
```
previously required.
as previously required.
Additionally, configurable attributes for your proxy will
appear in jupyterhub help output and auto-generated configuration files
via `jupyterhub --generate-config`.

View File

@@ -4,33 +4,36 @@
This section will give you information on:
- what you can do with the API
- create an API token
- add API tokens to the config files
- make an API request programmatically using the requests library
- learn more about JupyterHub's API
- What you can do with the API
- How to create an API token
- Assigning permissions to a token
- Updating to admin services
- Making an API request programmatically using the requests library
- Paginating API requests
- Enabling users to spawn multiple named-servers via the API
- Learn more about JupyterHub's API
Before we discuss about JupyterHub's REST API, you can learn about [REST APIs here](https://en.wikipedia.org/wiki/Representational_state_transfer). A REST
API provides a standard way for users to get and send information to the
Hub.
## What you can do with the API
Using the [JupyterHub REST API][], you can perform actions on the Hub,
such as:
- checking which users are active
- adding or removing users
- stopping or starting single user notebook servers
- authenticating services
- communicating with an individual Jupyter server's REST API
A [REST](https://en.wikipedia.org/wiki/Representational_state_transfer)
API provides a standard way for users to get and send information to the
Hub.
- Checking which users are active
- Adding or removing users
- Stopping or starting single user notebook servers
- Authenticating services
- Communicating with an individual Jupyter server's REST API
## Create an API token
To send requests using JupyterHub API, you must pass an API token with
To send requests using the JupyterHub API, you must pass an API token with
the request.
The preferred way of generating an API token is:
The preferred way of generating an API token is by running:
```bash
openssl rand -hex 32
@@ -40,8 +43,12 @@ This `openssl` command generates a potential token that can then be
added to JupyterHub using `.api_tokens` configuration setting in
`jupyterhub_config.py`.
Alternatively, use the `jupyterhub token` command to generate a token
for a specific hub user by passing the 'username':
```{note}
The api_tokens configuration has been softly deprecated since the introduction of services.
```
Alternatively, you can use the `jupyterhub token` command to generate a token
for a specific hub user by passing the **username**:
```bash
jupyterhub token <username>
@@ -53,9 +60,19 @@ it for the given user with the Hub's database.
In [version 0.8.0](../changelog.md), a token request page for
generating an API token is available from the JupyterHub user interface:
![Request API token page](../images/token-request.png)
:::{figure-md}
![API token success page](../images/token-request-success.png)
![token request page](../images/token-request.png)
JupyterHub's API token page
:::
:::{figure-md}
![token-request-success](../images/token-request-success.png)
JupyterHub's token page after successfully requesting a token.
:::
## Assigning permissions to a token
@@ -67,25 +84,26 @@ Prior to JupyterHub 2.0, there were two levels of permissions:
where a token would always have full permissions to do whatever its owner could do.
In JupyterHub 2.0,
specific permissions are now defined as 'scopes',
specific permissions are now defined as '**scopes**',
and can be assigned both at the user/service level,
and at the individual token level.
This allows e.g. a user with full admin permissions to request a token with limited permissions.
### Updating to admin services
## Updating to admin services
```{note}
The `api_tokens` configuration has been softly deprecated since the introduction of services.
We have no plans to remove it,
but deployments are encouraged to use service configuration instead.
```
If you have been using `api_tokens` to create an admin user
and a token for that user to perform some automations,
the services mechanism may be a better fit.
If you have the following configuration:
and the token for that user to perform some automations, then
the services' mechanism may be a better fit if you have the following configuration:
```python
c.JupyterHub.admin_users = {"service-admin",}
c.JupyterHub.admin_users = {"service-admin"}
c.JupyterHub.api_tokens = {
"secret-token": "service-admin",
}
@@ -103,9 +121,8 @@ c.JupyterHub.services = [
},
]
# roles are new in JupyterHub 2.0
# prior to 2.0, only 'admin': True or False
# was available
# roles were introduced in JupyterHub 2.0
# prior to 2.0, only "admin": True or False was available
c.JupyterHub.load_roles = [
{
@@ -125,7 +142,7 @@ c.JupyterHub.load_roles = [
The token will have the permissions listed in the role
(see [scopes][] for a list of available permissions),
but there will no longer be a user account created to house it.
The main noticeable difference is that there will be no notebook server associated with the account
The main noticeable difference between a user and a service is that there will be no notebook server associated with the account
and the service will not show up in the various user list pages and APIs.
## Make an API request
@@ -136,9 +153,8 @@ Authorization header.
### Use requests
Using the popular Python [requests](https://docs.python-requests.org)
library, here's example code to make an API request for the users of a JupyterHub
deployment. An API GET request is made, and the request sends an API token for
authorization. The response contains information about the users:
library, an API GET request is made, and the request sends an API token for
authorization. The response contains information about the users, here's example code to make an API request for the users of a JupyterHub deployment
```python
import requests
@@ -176,7 +192,8 @@ r.json()
```
The same API token can also authorize access to the [Jupyter Notebook REST API][]
provided by notebook servers managed by JupyterHub if it has the necessary `access:users:servers` scope:
provided by notebook servers managed by JupyterHub if it has the necessary `access:servers` scope.
(api-pagination)=
@@ -245,7 +262,7 @@ with your request, in which case a response will look like:
where the list results (same as pre-2.0) will be in `items`,
and pagination info will be in `_pagination`.
The `next` field will include the offset, limit, and URL for requesting the next page.
The `next` field will include the `offset`, `limit`, and `url` for requesting the next page.
`next` will be `null` if there is no next page.
Pagination is governed by two configuration options:
@@ -259,7 +276,7 @@ Pagination is enabled on the `GET /users`, `GET /groups`, and `GET /proxy` REST
## Enabling users to spawn multiple named-servers via the API
With JupyterHub version 0.8, support for multiple servers per user has landed.
Support for multiple servers per user was introduced in JupyterHub [version 0.8.](../changelog.md)
Prior to that, each user could only launch a single default server via the API
like this:
@@ -275,7 +292,7 @@ First you must enable named-servers by including the following setting in the `j
`c.JupyterHub.allow_named_servers = True`
If using the [zero-to-jupyterhub-k8s](https://github.com/jupyterhub/zero-to-jupyterhub-k8s) set-up to run JupyterHub,
If you are using the [zero-to-jupyterhub-k8s](https://github.com/jupyterhub/zero-to-jupyterhub-k8s) set-up to run JupyterHub,
then instead of editing the `jupyterhub_config.py` file directly, you could pass
the following as part of the `config.yaml` file, as per the [tutorial](https://zero-to-jupyterhub.readthedocs.io/en/latest/):
@@ -303,8 +320,9 @@ or kubernetes pods.
## Learn more about the API
You can see the full [JupyterHub REST API][] for details.
You can see the full [JupyterHub REST API][] for more details.
[openapi initiative]: https://www.openapis.org/
[jupyterhub rest api]: ./rest-api
[scopes]: ../rbac/scopes.md
[jupyter notebook rest api]: https://petstore3.swagger.io/?url=https://raw.githubusercontent.com/jupyter/notebook/HEAD/notebook/services/api/api.yaml

View File

@@ -2,7 +2,7 @@
## Background
The thing which users directly connect to is the proxy, by default
The thing which users directly connect to is the proxy, which by default is
`configurable-http-proxy`. The proxy either redirects users to the
hub (for login and managing servers), or to their own single-user
servers. Thus, as long as the proxy stays running, access to existing
@@ -10,16 +10,15 @@ servers continues, even if the hub itself restarts or goes down.
When you first configure the hub, you may not even realize this
because the proxy is automatically managed by the hub. This is great
for getting started and even most use, but everytime you restart the
hub, all user connections also get restarted. But it's also simple to
for getting started and even most use-cases, although, everytime you restart the
hub, all user connections are also restarted. However, it is also simple to
run the proxy as a service separate from the hub, so that you are free
to reconfigure the hub while only interrupting users who are currently
actively starting the hub.
to reconfigure the hub while only interrupting users who are waiting for their notebook server to start.
starting their notebook server.
The default JupyterHub proxy is
[configurable-http-proxy](https://github.com/jupyterhub/configurable-http-proxy),
and that page has some docs. If you are using a different proxy, such
as Traefik, these instructions are probably not relevant to you.
[configurable-http-proxy](https://github.com/jupyterhub/configurable-http-proxy). If you are using a different proxy, such
as [Traefik](https://github.com/traefik/traefik), these instructions are probably not relevant to you.
## Configuration options
@@ -40,9 +39,14 @@ set to the URL which the hub uses to connect _to the proxy's API_.
## Proxy configuration
You need to configure a service to start the proxy. An example
command line for this is `configurable-http-proxy --ip=127.0.0.1 --port=8000 --api-ip=127.0.0.1 --api-port=8001 --default-target=http://localhost:8081 --error-target=http://localhost:8081/hub/error`. (Details for how to
do this is out of scope for this tutorial - for example it might be a
systemd service on within another docker cotainer). The proxy has no
command line argument for this is:
```bash
$ configurable-http-proxy --ip=127.0.0.1 --port=8000 --api-ip=127.0.0.1 --api-port=8001 --default-target=http://localhost:8081 --error-target=http://localhost:8081/hub/error
```
(Details on how to do this is out of the scope of this tutorial. For example, it might be a
systemd service configured within another docker container). The proxy has no
configuration files, all configuration is via the command line and
environment variables.
@@ -57,9 +61,9 @@ match the token given to `c.ConfigurableHTTPProxy.auth_token`.
You should check the [configurable-http-proxy
options](https://github.com/jupyterhub/configurable-http-proxy) to see
what other options are needed, for example SSL options. Note that
these are configured in the hub if the hub is starting the proxy - you
need to move the options to here.
what other options are needed, for example, SSL options. Note that
these options are configured in the hub if the hub is starting the proxy, so you
need to configure the options there.
## Docker image

View File

@@ -1,37 +1,32 @@
# Starting servers with the JupyterHub API
JupyterHub's [REST API][] allows launching servers on behalf of users
without ever interacting with the JupyterHub UI.
This allows you to build services launching Jupyter-based services for users
without relying on the JupyterHub UI at all,
enabling a variety of user/launch/lifecycle patterns not natively supported by JupyterHub,
without needing to develop all the server management features of JupyterHub Spawners and/or Authenticators.
[BinderHub][] is an example of such an application.
Sometimes, when working with applications such as [BinderHub](https://binderhub.readthedocs.io), it may be necessary to launch Jupyter-based services on behalf of your users.
Doing so can be achieved through JupyterHub's [REST API](../reference/rest.md), which allows one to launch and manage servers on behalf of users through API calls instead of the JupyterHub UI.
This way, you can take advantage of other user/launch/lifecycle patterns that are not natively supported by the JupyterHub UI, all without the need to develop the server management features of JupyterHub Spawners and/or Authenticators.
[binderhub]: https://binderhub.readthedocs.io
[rest api]: ../reference/rest.md
This tutorial goes through working with the JupyterHub API to manage servers for users.
In particular, it covers how to:
This document provides an example of working with the JupyterHub API to
manage servers for users.
In particular, we will cover how to:
1. [Check the status of servers](checking)
2. [Start servers](starting)
3. [Wait for servers to be ready](waiting)
4. [Communicate with servers](communicating)
5. [Stop servers](stopping)
1. [check status of servers](checking)
2. [start servers](starting)
3. [wait for servers to be ready](waiting)
4. [communicate with servers](communicating)
5. [stop servers](stopping)
At the end, we also provide sample Python code that can be used to implement these steps.
(checking)=
## Checking server status
Requesting information about a user includes a `servers` field,
which is a dictionary.
First, request information about a particular user using a GET request:
```
GET /hub/api/users/:username
```
The response you get will include a `servers` field, which is a dictionary, as shown in this JSON-formatted response:
**Required scope: `read:servers`**
```json
@@ -49,13 +44,9 @@ GET /hub/api/users/:username
}
```
If the `servers` dict is empty, the user has no running servers.
The keys of the `servers` dict are server names as strings.
Many JupyterHub deployments only use the 'default' server,
which has the empty string `''` for a name.
In this case, the servers dict will always have either zero or one elements.
Many JupyterHub deployments only use a 'default' server, represented as an empty string `''` for a name. An investigation of the `servers` field can yield one of two results. First, it can be empty as in the sample JSON response above. In such a case, the user has no running servers.
This is the servers dict when the user's default server is fully running and ready:
However, should the user have running servers, then the returned dict should contain various information, as shown in this response:
```json
"servers": {
@@ -75,34 +66,28 @@ This is the servers dict when the user's default server is fully running and rea
Key properties of a server:
name
: the server's name. Always the same as the key in `servers`
: the server's name. Always the same as the key in `servers`.
ready
: boolean. If true, the server can be expected to respond to requests at `url`.
pending
: `null` or a string indicating a transitional state (such as `start` or `stop`).
Will always be `null` if `ready` is true,
and will always be a string if `ready` is false.
Will always be `null` if `ready` is true or a string if false.
url
: The server's url (just the path, e.g. `/users/:name/:servername/`)
where the server can be accessed if `ready` is true.
: The server's url path (e.g. `/users/:name/:servername/`) where the server can be accessed if `ready` is true.
progress_url
: The API url path (starting with `/hub/api`)
where the progress API can be used to wait for the server to be ready.
See below for more details on the progress API.
: The API URL path (starting with `/hub/api`) where the progress API can be used to wait for the server to be ready.
last_activity
: ISO8601 timestamp indicating when activity was last observed on the server
: ISO8601 timestamp indicating when activity was last observed on the server.
started
: ISO801 timestamp indicating when the server was last started
: ISO801 timestamp indicating when the server was last started.
We've seen the `servers` model with no servers and with one `ready` server.
Here is what it looks like immediately after requesting a server launch,
while the server is not ready yet:
The two responses above are from a user with no servers and another with one `ready` server. The sample below is a response likely to be received when one requests a server launch while the server is not yet ready:
```json
"servers": {
@@ -119,11 +104,7 @@ while the server is not ready yet:
}
```
Note that `ready` is false and `pending` is `spawn`.
This means that the server is not ready
(attempting to access it may not work)
because it isn't finished spawning yet.
We'll get more into that below in [waiting for a server][].
Note that `ready` is `false` and `pending` has the value `spawn`, meaning that the server is not ready and attempting to access it may not work as it is still in the process of spawning. We'll get more into this below in [waiting for a server][].
[waiting for a server]: waiting
@@ -131,7 +112,7 @@ We'll get more into that below in [waiting for a server][].
## Starting servers
To start a server, make the request
To start a server, make this API request:
```
POST /hub/api/users/:username/servers/[:servername]
@@ -139,47 +120,35 @@ POST /hub/api/users/:username/servers/[:servername]
**Required scope: `servers`**
(omit servername for the default server)
Assuming the request was valid,
there are two possible responses:
Assuming the request was valid, there are two possible responses:
201 Created
: This status code means the launch completed and the server is ready.
It should be available at the server's URL immediately.
: This status code means the launch completed and the server is ready and is available at the server's URL immediately.
202 Accepted
: This is the more likely response,
and means that the server has begun launching,
but isn't immediately ready.
The server has `pending: 'spawn'` at this point.
_Aside: how quickly JupyterHub responds with `202 Accepted` is governed by the `slow_spawn_timeout` tornado setting._
: This is the more likely response, and means that the server has begun launching,
but is not immediately ready. As a result, the server shows `pending: 'spawn'` at this point and you should wait for it to start.
(waiting)=
## Waiting for a server
## Waiting for a server to start
If you are starting a server via the API,
there's a good change you want to know when it's ready.
There are two ways to do with:
After receiving a `202 Accepted` response, you have to wait for the server to start.
Two approaches can be applied to establish when the server is ready:
1. {ref}`Polling the server model <polling>`
2. the {ref}`progress API <progress>`
2. {ref}`Using the progress API <progress>`
(polling)=
### Polling the server model
The simplest way to check if a server is ready
is to request the user model.
The simplest way to check if a server is ready is to programmatically query the server model until two conditions are true:
If:
1. The server name is contained in the `servers` response, and
2. `servers['servername']['ready']` is true.
1. the server name is in the user's `servers` model, and
2. `servers['servername']['ready']` is true
A Python example, checking if a server is ready:
The Python code snippet below can be used to check if a server is ready:
```python
def server_ready(hub_url, user, server_name="", token):
@@ -206,14 +175,12 @@ You can keep making this check until `ready` is true.
(progress)=
### Progress API
### Using the progress API
The most _efficient_ way to wait for a server to start is the progress API.
The most _efficient_ way to wait for a server to start is by using the progress API.
The progress URL is available in the server model under `progress_url` and has the form `/hub/api/users/:user/servers/:servername/progress`.
The progress URL is available in the server model under `progress_url`,
and has the form `/hub/api/users/:user/servers/:servername/progress`.
_the default server progress can be accessed at `:user/servers//progress` or `:user/server/progress`_
The default server progress can be accessed at `:user/servers//progress` or `:user/server/progress` as demonstrated in the following GET request:
```
GET /hub/api/users/:user/servers/:servername/progress
@@ -221,8 +188,8 @@ GET /hub/api/users/:user/servers/:servername/progress
**Required scope: `read:servers`**
This is an [EventStream][] API.
In an event stream, messages are _streamed_ and delivered on lines of the form:
The progress API is an example of an [EventStream][] API.
Messages are _streamed_ and delivered in the form:
```
data: {"progress": 10, "message": "...", ...}
@@ -233,7 +200,7 @@ Lines that do not start with `data:` should be ignored.
[eventstream]: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#examples
progress events have the form:
Progress events have the form:
```python
{
@@ -254,11 +221,10 @@ ready
: present and true only for the last event when the server is ready
url
: only present if `ready` is true; will be the server's url
: only present if `ready` is true; will be the server's URL
the progress API can be used even with fully ready servers.
If the server is ready,
there will only be one event that looks like:
The progress API can be used even with fully ready servers.
If the server is ready, there will only be one event, which will look like:
```json
{
@@ -270,9 +236,10 @@ there will only be one event that looks like:
}
```
where `ready` and `url` are the same as in the server model (`ready` will always be true).
where `ready` and `url` are the same as in the server model, and `ready` will always be true.
A typical complete stream from the event-stream API:
A significant advantage of the progress API is that it shows the status of the server through a stream of messages.
Below is an example of a typical complete stream from the API:
```
@@ -302,21 +269,21 @@ DELETE /hub/api/users/:user/servers/[:servername]
**Required scope: `servers`**
Like start, delete may not complete immediately.
The DELETE request has two possible response codes:
Similar to when starting a server, issuing the DELETE request above might not stop the server immediately.
Instead, the DELETE request has two possible response codes:
204 Deleted
: This status code means the delete completed and the server is fully stopped.
It will now be absent from the user `servers` model.
202 Accepted
: Like start, `202` means your request was accepted,
but is not yet complete.
: This code means your request was accepted but is not yet completely processed.
The server has `pending: 'stop'` at this point.
Unlike start, there is no progress API for stop.
To wait for stop to finish, you must poll the user model
and wait for the server to disappear from the user `servers` model.
There is no progress API for checking when a server actually stops.
The only way to wait for a server to stop is to poll it and wait for the server to disappear from the user `servers` model.
This Python code snippet can be used to stop a server and the wait for the process to complete:
```{literalinclude} ../../../examples/server-api/start-stop-server.py
:language: python
@@ -327,9 +294,8 @@ and wait for the server to disappear from the user `servers` model.
## Communicating with servers
JupyterHub tokens with the the `access:servers` scope
can be used to communicate with servers themselves.
This can be the same token you used to launch your service.
JupyterHub tokens with the `access:servers` scope can be used to communicate with servers themselves.
The tokens can be the same as those you used to launch your service.
```{note}
Access scopes are new in JupyterHub 2.0.
@@ -338,29 +304,26 @@ a token must be owned by the same user as the server,
*or* be an admin token if admin_access is enabled.
```
The URL returned from a server model is the url path suffix,
The URL returned from a server model is the URL path suffix,
e.g. `/user/:name/` to append to the jupyterhub base URL.
For instance, `{hub_url}{server_url}`,
where `hub_url` would be e.g. `http://127.0.0.1:8000` by default,
and `server_url` `/user/myname`,
for a full url of `http://127.0.0.1:8000/user/myname`.
The returned URL is of the form `{hub_url}{server_url}`,
where `hub_url` would be `http://127.0.0.1:8000` by default and `server_url` is `/user/myname`.
When combined, the two give a full URL of `http://127.0.0.1:8000/user/myname`.
## Python example
The JupyterHub repo includes a complete example in {file}`examples/server-api`
tying all this together.
that ties all theses steps together.
To summarize the steps:
In summary, the processes involved in managing servers on behalf of users are:
1. get user info from `/user/:name`
2. the server model includes a `ready` state to tell you if it's ready
3. if it's not ready, you can follow up with `progress_url` to wait for it
4. if it is ready, you can use the `url` field to link directly to the running server
1. Get user information from `/user/:name`.
2. The server model includes a `ready` state to tell you if it's ready.
3. If it's not ready, you can follow up with `progress_url` to wait for it.
4. If it is ready, you can use the `url` field to link directly to the running server.
The example demonstrates starting and stopping servers via the JupyterHub API,
including waiting for them to start via the progress API,
as well as waiting for them to stop via polling the user model.
The example below demonstrates starting and stopping servers via the JupyterHub API,
including waiting for them to start via the progress API and waiting for them to stop by polling the user model.
```{literalinclude} ../../../examples/server-api/start-stop-server.py
:language: python

View File

@@ -38,6 +38,15 @@ A Service may have the following properties:
- `display: bool (default - True)` - When set to true, display a link to the
service's URL under the 'Services' dropdown in user's hub home page.
- `oauth_no_confirm: bool (default - False)` - When set to true,
skip the OAuth confirmation page when users access this service.
By default, when users authenticate with a service using JupyterHub,
they are prompted to confirm that they want to grant that service
access to their credentials.
Skipping the confirmation page is useful for admin-managed services that are considered part of the Hub
and shouldn't need extra prompts for login.
If a service is also to be managed by the Hub, it has a few extra options:
- `command: (str/Popen list)` - Command for JupyterHub to spawn the service. - Only use this if the service should be a subprocess. - If command is not specified, the Service is assumed to be managed
@@ -52,7 +61,7 @@ If a service is also to be managed by the Hub, it has a few extra options:
A **Hub-Managed Service** is started by the Hub, and the Hub is responsible
for the Service's actions. A Hub-Managed Service can only be a local
subprocess of the Hub. The Hub will take care of starting the process and
restarts it if it stops.
restart the service if the service stops.
While Hub-Managed Services share some similarities with notebook Spawners,
there are no plans for Hub-Managed Services to support the same spawning
@@ -177,7 +186,7 @@ information to the Service via the environment variables described above. A
flexible Service, whether managed by the Hub or not, can make use of these
same environment variables.
When you run a service that has a url, it will be accessible under a
When you run a service that has a URL, it will be accessible under a
`/services/` prefix, such as `https://myhub.horse/services/my-service/`. For
your service to route proxied requests properly, it must take
`JUPYTERHUB_SERVICE_PREFIX` into account when routing requests. For example, a
@@ -225,8 +234,17 @@ There are two levels of authentication with the Hub:
- {class}`.HubOAuth` - For services that should use oauth to authenticate with the Hub.
This should be used for any service that serves pages that should be visited with a browser.
To use HubAuth, you must set the `.api_token`, either programmatically when constructing the class,
or via the `JUPYTERHUB_API_TOKEN` environment variable.
To use HubAuth, you must set the `.api_token` instance variable. This can be
done either programmatically when constructing the class, or via the
`JUPYTERHUB_API_TOKEN` environment variable. A number of the examples in the
root of the jupyterhub git repository set the `JUPYTERHUB_API_TOKEN` variable
so consider having a look at those for futher reading
([cull-idle](https://github.com/jupyterhub/jupyterhub/tree/master/examples/cull-idle),
[external-oauth](https://github.com/jupyterhub/jupyterhub/tree/master/examples/external-oauth),
[service-notebook](https://github.com/jupyterhub/jupyterhub/tree/master/examples/service-notebook)
and [service-whoiami](https://github.com/jupyterhub/jupyterhub/tree/master/examples/service-whoami))
(TODO: Where is this API TOKen set?)
Most of the logic for authentication implementation is found in the
{meth}`.HubAuth.user_for_token` methods,
@@ -240,7 +258,7 @@ which makes a request of the Hub, and returns:
"name": "username",
"groups": ["list", "of", "groups"],
"scopes": [
"access:users:servers!server=username/",
"access:servers!server=username/",
],
}
```
@@ -259,7 +277,7 @@ you can access the token authenticating the current request with {meth}`.HubAuth
:::{versionchanged} 2.2
{meth}`.HubAuth.get_token` adds support for retrieving
tokens stored in tornado cookies after completion of OAuth.
tokens stored in tornado cookies after the completion of OAuth.
Previously, it only retrieved tokens from URL parameters or the Authorization header.
Passing `get_token(handler, in_cookie=False)` preserves this behavior.
:::
@@ -382,7 +400,7 @@ in which case the `scopes` field in this model should be checked on each access.
The default required scopes for access are available from `hub_auth.oauth_scopes` or `$JUPYTERHUB_OAUTH_ACCESS_SCOPES`.
An example of using an Externally-Managed Service and authentication is
in [nbviewer README][nbviewer example] section on securing the notebook viewer,
in the [nbviewer README][nbviewer example] section on securing the notebook viewer,
and an example of its configuration is found [here](https://github.com/jupyter/nbviewer/blob/ed942b10a52b6259099e2dd687930871dc8aac22/nbviewer/providers/base.py#L95).
nbviewer can also be run as a Hub-Managed Service as described [nbviewer README][nbviewer example]
section on securing the notebook viewer.

View File

@@ -4,9 +4,9 @@ A [Spawner][] starts each single-user notebook server.
The Spawner represents an abstract interface to a process,
and a custom Spawner needs to be able to take three actions:
- start the process
- poll whether the process is still running
- stop the process
- start a process
- poll whether a process is still running
- stop a process
## Examples
@@ -15,9 +15,9 @@ Some examples include:
- [DockerSpawner](https://github.com/jupyterhub/dockerspawner) for spawning user servers in Docker containers
- `dockerspawner.DockerSpawner` for spawning identical Docker containers for
each users
each user
- `dockerspawner.SystemUserSpawner` for spawning Docker containers with an
environment and home directory for each users
environment and home directory for each user
- both `DockerSpawner` and `SystemUserSpawner` also work with Docker Swarm for
launching containers on remote machines
- [SudoSpawner](https://github.com/jupyterhub/sudospawner) enables JupyterHub to
@@ -28,12 +28,13 @@ Some examples include:
servers in YARN containers on a Hadoop cluster
- [SSHSpawner](https://github.com/NERSC/sshspawner) to spawn notebooks
on a remote server using SSH
- [KubeSpawner](https://github.com/jupyterhub/kubespawner) to spawn notebook servers on kubernetes cluster.
## Spawner control methods
### Spawner.start
`Spawner.start` should start the single-user server for a single user.
`Spawner.start` should start a single-user server for a single user.
Information about the user can be retrieved from `self.user`,
an object encapsulating the user's name, authentication, and server info.
@@ -68,13 +69,13 @@ via relaxing the `Spawner.start_timeout` config value.
#### Note on IPs and ports
`Spawner.ip` and `Spawner.port` attributes set the _bind_ url,
`Spawner.ip` and `Spawner.port` attributes set the _bind_ URL,
which the single-user server should listen on
(passed to the single-user process via the `JUPYTERHUB_SERVICE_URL` environment variable).
The _return_ value is the ip and port (or full url) the Hub should _connect to_.
The _return_ value is the IP and port (or full URL) the Hub should _connect to_.
These are not necessarily the same, and usually won't be in any Spawner that works with remote resources or containers.
The default for Spawner.ip, and Spawner.port is `127.0.0.1:{random}`,
The default for `Spawner.ip`, and `Spawner.port` is `127.0.0.1:{random}`,
which is appropriate for Spawners that launch local processes,
where everything is on localhost and each server needs its own port.
For remote or container Spawners, it will often make sense to use a different value,
@@ -110,7 +111,7 @@ class MySpawner(Spawner):
#### Exception handling
When `Spawner.start` raises an Exception, a message can be passed on to the user via the exception via a `.jupyterhub_html_message` or `.jupyterhub_message` attribute.
When `Spawner.start` raises an Exception, a message can be passed on to the user via the exception using a `.jupyterhub_html_message` or `.jupyterhub_message` attribute.
When the Exception has a `.jupyterhub_html_message` attribute, it will be rendered as HTML to the user.
@@ -120,11 +121,11 @@ If both attributes are not present, the Exception will be shown to the user as u
### Spawner.poll
`Spawner.poll` should check if the spawner is still running.
`Spawner.poll` checks if the spawner is still running.
It should return `None` if it is still running,
and an integer exit status, otherwise.
For the local process case, `Spawner.poll` uses `os.kill(PID, 0)`
In the case of local processes, `Spawner.poll` uses `os.kill(PID, 0)`
to check if the local process is still running. On Windows, it uses `psutil.pid_exists`.
### Spawner.stop
@@ -140,7 +141,7 @@ A JSON-able dictionary of state can be used to store persisted information.
Unlike start, stop, and poll methods, the state methods must not be coroutines.
For the single-process case, the Spawner state is only the process ID of the server:
In the case of single processes, the Spawner state is only the process ID of the server:
```python
def get_state(self):
@@ -266,8 +267,8 @@ Spawners mainly do one thing: launch a command in an environment.
The command-line is constructed from user configuration:
- Spawner.cmd (default: `['jupterhub-singleuser']`)
- Spawner.args (cli args to pass to the cmd, default: empty)
- Spawner.cmd (default: `['jupyterhub-singleuser']`)
- Spawner.args (CLI args to pass to the cmd, default: empty)
where the configuration:
@@ -282,7 +283,7 @@ would result in spawning the command:
my-singleuser-wrapper --debug --flag
```
The `Spawner.get_args()` method is how Spawner.args is accessed,
The `Spawner.get_args()` method is how `Spawner.args` is accessed,
and can be used by Spawners to customize/extend user-provided arguments.
Prior to 2.0, JupyterHub unconditionally added certain options _if specified_ to the command-line,
@@ -296,36 +297,36 @@ Additional variables can be specified via the `Spawner.environment` configuratio
The process environment is returned by `Spawner.get_env`, which specifies the following environment variables:
- JUPYTERHUB*SERVICE_URL - the \_bind* url where the server should launch its http server (`http://127.0.0.1:12345`).
This includes Spawner.ip and Spawner.port; _new in 2.0, prior to 2.0 ip,port were on the command-line and only if specified_
- JUPYTERHUB*SERVICE_URL - the \_bind* URL where the server should launch its HTTP server (`http://127.0.0.1:12345`).
This includes `Spawner.ip` and `Spawner.port`; _new in 2.0, prior to 2.0 IP, port were on the command-line and only if specified_
- JUPYTERHUB_SERVICE_PREFIX - the URL prefix the service will run on (e.g. `/user/name/`)
- JUPYTERHUB_USER - the JupyterHub user's username
- JUPYTERHUB_SERVER_NAME - the server's name, if using named servers (default server has an empty name)
- JUPYTERHUB_API_URL - the full url for the JupyterHub API (http://17.0.0.1:8001/hub/api)
- JUPYTERHUB_BASE_URL - the base url of the whole jupyterhub deployment, i.e. the bit before `hub/` or `user/`,
as set by c.JupyterHub.base_url (default: `/`)
- JUPYTERHUB_API_URL - the full URL for the JupyterHub API (http://17.0.0.1:8001/hub/api)
- JUPYTERHUB_BASE_URL - the base URL of the whole jupyterhub deployment, i.e. the bit before `hub/` or `user/`,
as set by `c.JupyterHub.base_url` (default: `/`)
- JUPYTERHUB_API_TOKEN - the API token the server can use to make requests to the Hub.
This is also the OAuth client secret.
- JUPYTERHUB_CLIENT_ID - the OAuth client ID for authenticating visitors.
- JUPYTERHUB_OAUTH_CALLBACK_URL - the callback URL to use in oauth, typically `/user/:name/oauth_callback`
- JUPYTERHUB_OAUTH_CALLBACK_URL - the callback URL to use in OAuth, typically `/user/:name/oauth_callback`
- JUPYTERHUB_OAUTH_ACCESS_SCOPES - the scopes required to access the server (called JUPYTERHUB_OAUTH_SCOPES prior to 3.0)
- JUPYTERHUB_OAUTH_CLIENT_ALLOWED_SCOPES - the scopes the service is allowed to request.
If no scopes are requested explicitly, these scopes will be requested.
Optional environment variables, depending on configuration:
- JUPYTERHUB*SSL*[KEYFILE|CERTFILE|CLIENT_CI] - SSL configuration, when internal_ssl is enabled
- JUPYTERHUB_ROOT_DIR - the root directory of the server (notebook directory), when Spawner.notebook_dir is defined (new in 2.0)
- JUPYTERHUB_DEFAULT_URL - the default URL for the server (for redirects from /user/:name/),
if Spawner.default_url is defined
(new in 2.0, previously passed via cli)
- JUPYTERHUB_DEBUG=1 - generic debug flag, sets maximum log level when Spawner.debug is True
(new in 2.0, previously passed via cli)
- JUPYTERHUB*SSL*[KEYFILE|CERTFILE|CLIENT_CI] - SSL configuration, when `internal_ssl` is enabled
- JUPYTERHUB_ROOT_DIR - the root directory of the server (notebook directory), when `Spawner.notebook_dir` is defined (new in 2.0)
- JUPYTERHUB_DEFAULT_URL - the default URL for the server (for redirects from `/user/:name/`),
if `Spawner.default_url` is defined
(new in 2.0, previously passed via CLI)
- JUPYTERHUB_DEBUG=1 - generic debug flag, sets maximum log level when `Spawner.debug` is True
(new in 2.0, previously passed via CLI)
- JUPYTERHUB_DISABLE_USER_CONFIG=1 - disable loading user config,
sets maximum log level when Spawner.debug is True (new in 2.0,
previously passed via cli)
sets maximum log level when `Spawner.debug` is True (new in 2.0,
previously passed via CLI)
- JUPYTERHUB*[MEM|CPU]*[LIMIT_GUARANTEE] - the values of cpu and memory limits and guarantees.
- JUPYTERHUB*[MEM|CPU]*[LIMIT_GUARANTEE] - the values of CPU and memory limits and guarantees.
These are not expected to be enforced by the process,
but are made available as a hint,
e.g. for resource monitoring extensions.
@@ -337,9 +338,10 @@ guarantees on resources, such as CPU and memory. To provide a consistent
experience for sysadmins and users, we provide a standard way to set and
discover these resource limits and guarantees, such as for memory and CPU.
For the limits and guarantees to be useful, **the spawner must implement
support for them**. For example, LocalProcessSpawner, the default
support for them**. For example, `LocalProcessSpawner`, the default
spawner, does not support limits and guarantees. One of the spawners
that supports limits and guarantees is the `systemdspawner`.
that supports limits and guarantees is the
[`systemdspawner`](https://github.com/jupyterhub/systemdspawner).
### Memory Limits & Guarantees
@@ -366,7 +368,7 @@ limits or guarantees are provided, and no environment values are set.
`c.Spawner.cpu_limit`: In supported spawners, you can set
`c.Spawner.cpu_limit` to limit the total number of cpu-cores that a
single-user notebook server can use. These can be fractional - `0.5` means 50%
of one CPU core, `4.0` is 4 cpu-cores, etc. This value is also set in the
of one CPU core, `4.0` is 4 CPU-cores, etc. This value is also set in the
single-user notebook server's environment variable `CPU_LIMIT`. The limit does
not claim that you will be able to use all the CPU up to your limit as other
higher priority applications might be taking up CPU.
@@ -399,9 +401,10 @@ container `ip` prior to starting and pass that to `.create_certs` (TODO: edit).
In general though, this method will not need to be changed and the default
`ip`/`dns` (localhost) info will suffice.
When `.create_certs` is run, it will `.create_certs` in a default, central
location specified by `c.JupyterHub.internal_certs_location`. For `Spawners`
that need access to these certs elsewhere (i.e. on another host altogether),
the `.move_certs` method can be overridden to move the certs appropriately.
Again, using `DockerSpawner` as an example, this would entail moving certs
to a directory that will get mounted into the container this spawner starts.
When `.create_certs` is run, it will create the certificates in a default,
central location specified by `c.JupyterHub.internal_certs_location`. For
`Spawners` that need access to these certs elsewhere (i.e. on another host
altogether), the `.move_certs` method can be overridden to move the certs
appropriately. Again, using `DockerSpawner` as an example, this would entail
moving certs to a directory that will get mounted into the container this
spawner starts.

View File

@@ -2,7 +2,7 @@
The **Technical Overview** section gives you a high-level view of:
- JupyterHub's Subsystems: Hub, Proxy, Single-User Notebook Server
- JupyterHub's major Subsystems: Hub, Proxy, Single-User Notebook Server
- how the subsystems interact
- the process from JupyterHub access to user login
- JupyterHub's default behavior
@@ -11,16 +11,16 @@ The **Technical Overview** section gives you a high-level view of:
The goal of this section is to share a deeper technical understanding of
JupyterHub and how it works.
## The Subsystems: Hub, Proxy, Single-User Notebook Server
## The Major Subsystems: Hub, Proxy, Single-User Notebook Server
JupyterHub is a set of processes that together provide a single user Jupyter
Notebook server for each person in a group. Three major subsystems are started
JupyterHub is a set of processes that together, provide a single-user Jupyter
Notebook server for each person in a group. Three subsystems are started
by the `jupyterhub` command line program:
- **Hub** (Python/Tornado): manages user accounts, authentication, and
coordinates Single User Notebook Servers using a Spawner.
coordinates Single User Notebook Servers using a [Spawner](./spawners.md).
- **Proxy**: the public facing part of JupyterHub that uses a dynamic proxy
- **Proxy**: the public-facing part of JupyterHub that uses a dynamic proxy
to route HTTP requests to the Hub and Single User Notebook Servers.
[configurable http proxy](https://github.com/jupyterhub/configurable-http-proxy)
(node-http-proxy) is the default proxy.
@@ -28,7 +28,7 @@ by the `jupyterhub` command line program:
- **Single-User Notebook Server** (Python/Tornado): a dedicated,
single-user, Jupyter Notebook server is started for each user on the system
when the user logs in. The object that starts the single-user notebook
servers is called a **Spawner**.
servers is called a **[Spawner](./spawners.md)**.
![JupyterHub subsystems](../images/jhub-parts.png)
@@ -41,8 +41,8 @@ The basic principles of operation are:
- The Hub spawns the proxy (in the default JupyterHub configuration)
- The proxy forwards all requests to the Hub by default
- The Hub handles login, and spawns single-user notebook servers on demand
- The Hub configures the proxy to forward url prefixes to single-user notebook
- The Hub handles login and spawns single-user notebook servers on demand
- The Hub configures the proxy to forward URL prefixes to single-user notebook
servers
The proxy is the only process that listens on a public interface. The Hub sits
@@ -50,17 +50,16 @@ behind the proxy at `/hub`. Single-user servers sit behind the proxy at
`/user/[username]`.
Different **[authenticators](./authenticators.md)** control access
to JupyterHub. The default one (PAM) uses the user accounts on the server where
to JupyterHub. The default one [(PAM)](https://en.wikipedia.org/wiki/Pluggable_authentication_module) uses the user accounts on the server where
JupyterHub is running. If you use this, you will need to create a user account
on the system for each user on your team. Using other authenticators, you can
on the system for each user on your team. However, using other authenticators you can
allow users to sign in with e.g. a GitHub account, or with any single-sign-on
system your organization has.
Next, **[spawners](./spawners.md)** control how JupyterHub starts
the individual notebook server for each user. The default spawner will
start a notebook server on the same machine running under their system username.
The other main option is to start each server in a separate container, often
using Docker.
The other main option is to start each server in a separate container, often using [Docker](https://jupyterhub-dockerspawner.readthedocs.io/en/latest/).
## The Process from JupyterHub Access to User Login
@@ -72,20 +71,20 @@ When a user accesses JupyterHub, the following events take place:
- A single-user notebook server instance is [spawned](./spawners.md) for the
logged-in user
- When the single-user notebook server starts, the proxy is notified to forward
requests to `/user/[username]/*` to the single-user notebook server.
- A cookie is set on `/hub/`, containing an encrypted token. (Prior to version
requests made to `/user/[username]/*`, to the single-user notebook server.
- A [cookie](https://en.wikipedia.org/wiki/HTTP_cookie) is set on `/hub/`, containing an encrypted token. (Prior to version
0.8, a cookie for `/user/[username]` was used too.)
- The browser is redirected to `/user/[username]`, and the request is handled by
the single-user notebook server.
The single-user server identifies the user with the Hub via OAuth:
How does the single-user server identify the user with the Hub via OAuth?
- on request, the single-user server checks a cookie
- if no cookie is set, redirect to the Hub for verification via OAuth
- after verification at the Hub, the browser is redirected back to the
- On request, the single-user server checks a cookie
- If no cookie is set, the single-user server redirects to the Hub for verification via OAuth
- After verification at the Hub, the browser is redirected back to the
single-user server
- the token is verified and stored in a cookie
- if no user is identified, the browser is redirected back to `/hub/login`
- The token is verified and stored in a cookie
- If no user is identified, the browser is redirected back to `/hub/login`
## Default Behavior
@@ -111,7 +110,7 @@ working directory:
This file needs to persist so that a **Hub** server restart will avoid
invalidating cookies. Conversely, deleting this file and restarting the server
effectively invalidates all login cookies. The cookie secret file is discussed
in the [Cookie Secret section of the Security Settings document](../getting-started/security-basics.md).
in the [Cookie Secret section of the Security Settings document](../getting-started/security-basics.rst).
The location of these files can be specified via configuration settings. It is
recommended that these files be stored in standard UNIX filesystem locations,

View File

@@ -1,28 +1,29 @@
# Working with templates and UI
The pages of the JupyterHub application are generated from
[Jinja](http://jinja.pocoo.org/) templates. These allow the header, for
[Jinja](https://jinja.palletsprojects.com) templates. These allow the header, for
example, to be defined once and incorporated into all pages. By providing
your own templates, you can have complete control over JupyterHub's
your own template(s), you can have complete control over JupyterHub's
appearance.
## Custom Templates
JupyterHub will look for custom templates in all of the paths in the
`JupyterHub.template_paths` configuration option, falling back on the
JupyterHub will look for custom templates in all paths included in the
`JupyterHub.template_paths` configuration option, falling back on these
[default templates](https://github.com/jupyterhub/jupyterhub/tree/HEAD/share/jupyterhub/templates)
if no custom template with that name is found. This fallback
behavior is new in version 0.9; previous versions searched only those paths
if no custom template(s) with specified name(s) are found. This fallback
behavior is new in version 0.9; previous versions searched only the paths
explicitly included in `template_paths`. You may override as many
or as few templates as you desire.
## Extending Templates
Jinja provides a mechanism to [extend templates](http://jinja.pocoo.org/docs/2.10/templates/#template-inheritance).
A base template can define a `block`, and child templates can replace or
supplement the material in the block. The
[JupyterHub templates](https://github.com/jupyterhub/jupyterhub/tree/HEAD/share/jupyterhub/templates)
make extensive use of blocks, which allows you to customize parts of the
Jinja provides a mechanism to [extend templates](https://jinja.palletsprojects.com/en/3.0.x/templates/#template-inheritance).
A base template can define `block`(s) within itself that child templates can fill up or
supply content to. The
[JupyterHub default templates](https://github.com/jupyterhub/jupyterhub/tree/HEAD/share/jupyterhub/templates)
make extensive use of blocks, thus allowing you to customize parts of the
interface easily.
In general, a child template can extend a base template, `page.html`, by beginning with:
@@ -40,15 +41,15 @@ file with this block:
{% extends "templates/page.html" %}
```
By defining `block`s with same name as in the base template, child templates
By defining `block`s with the same name as in the base template, child templates
can replace those sections with custom content. The content from the base
template can be included with the `{{ super() }}` directive.
template can be included in the child template with the `{{ super() }}` directive.
### Example
To add an additional message to the spawn-pending page, below the existing
text about the server starting up, place this content in a file named
`spawn_pending.html` in a directory included in the
text about the server starting up, place the content below in a file named
`spawn_pending.html`. This directory must also be included in the
`JupyterHub.template_paths` configuration option.
```html
@@ -61,7 +62,7 @@ text about the server starting up, place this content in a file named
To add announcements to be displayed on a page, you have two options:
- Extend the page templates as described above
- [Extend the page templates as described above](#extending-templates)
- Use configuration variables
### Announcement Configuration Variables
@@ -71,10 +72,10 @@ the top of all pages. The more specific variables
`announcement_login`, `announcement_spawn`, `announcement_home`, and
`announcement_logout` are more specific and only show on their
respective pages (overriding the global `announcement` variable).
Note that changing these variables require a restart, unlike direct
Note that changing these variables requires a restart, unlike direct
template extension.
You can get the same effect by extending templates, which allows you
Alternatively, you can get the same effect by extending templates, which allows you
to update the messages without restarting. Set
`c.JupyterHub.template_paths` as mentioned above, and then create a
template (for example, `login.html`) with:
@@ -84,5 +85,5 @@ template (for example, `login.html`) with:
```
Extending `page.html` puts the message on all pages, but note that
extending `page.html` take precedence over an extension of a specific
extending `page.html` takes precedence over an extension of a specific
page (unlike the variable-based approach above).

View File

@@ -2,13 +2,13 @@
This document describes how JupyterHub routes requests.
This does not include the [REST API](./rest.md) urls.
This does not include the [REST API](./rest.md) URLs.
In general, all URLs can be prefixed with `c.JupyterHub.base_url` to
run the whole JupyterHub application on a prefix.
All authenticated handlers redirect to `/hub/login` to login users
prior to being redirected back to the originating page.
All authenticated handlers redirect to `/hub/login` to log-in users
before being redirected back to the originating page.
The returned request should preserve all query parameters.
## `/`
@@ -25,12 +25,12 @@ This is an authenticated URL.
This handler redirects users to the default URL of the application,
which defaults to the user's default server.
That is, it redirects to `/hub/spawn` if the user's server is not running,
or the server itself (`/user/:name`) if the server is running.
That is, the handler redirects to `/hub/spawn` if the user's server is not running,
or to the server itself (`/user/:name`) if the server is running.
This default url behavior can be customized in two ways:
This default URL behavior can be customized in two ways:
To redirect users to the JupyterHub home page (`/hub/home`)
First, to redirect users to the JupyterHub home page (`/hub/home`)
instead of spawning their server,
set `redirect_to_server` to False:
@@ -40,7 +40,7 @@ c.JupyterHub.redirect_to_server = False
This might be useful if you have a Hub where you expect
users to be managing multiple server configurations
and automatic spawning is not desirable.
but automatic spawning is not desirable.
Second, you can customise the landing page to any page you like,
such as a custom service you have deployed e.g. with course information:
@@ -57,7 +57,7 @@ By default, the Hub home page has just one or two buttons
for starting and stopping the user's server.
If named servers are enabled, there will be some additional
tools for management of named servers.
tools for management of the named servers.
_Version added: 1.0_ named server UI is new in 1.0.
@@ -65,34 +65,34 @@ _Version added: 1.0_ named server UI is new in 1.0.
This is the JupyterHub login page.
If you have a form-based username+password login,
such as the default PAMAuthenticator,
such as the default [PAMAuthenticator](https://en.wikipedia.org/wiki/Pluggable_authentication_module),
this page will render the login form.
![A login form](../images/login-form.png)
If login is handled by an external service,
e.g. with OAuth, this page will have a button,
declaring "Login with ..." which users can click
to login with the chosen service.
declaring "Log in with ..." which users can click
to log in with the chosen service.
![A login redirect button](../images/login-button.png)
If you want to skip the user-interaction to initiate logging in
via the button, you can set
If you want to skip the user interaction and initiate login
via the button, you can set:
```python
c.Authenticator.auto_login = True
```
This can be useful when the user is "already logged in" via some mechanism,
but a handshake via redirects is necessary to complete the authentication with JupyterHub.
This can be useful when the user is "already logged in" via some mechanism.
However, a handshake via `redirects` is necessary to complete the authentication with JupyterHub.
## `/hub/logout`
Visiting `/hub/logout` clears cookies from the current browser.
Visiting `/hub/logout` clears [cookies](https://en.wikipedia.org/wiki/HTTP_cookie) from the current browser.
Note that **logging out does not stop a user's server(s)** by default.
If you would like to shutdown user servers on logout,
If you would like to shut down user servers on logout,
you can enable this behavior with:
```python
@@ -105,8 +105,8 @@ does not mean the user is no longer actively using their server from another mac
## `/user/:username[/:servername]`
If a user's server is running, this URL is handled by the user's given server,
not the Hub.
The username is the first part and, if using named servers,
not by the Hub.
The username is the first part, and if using named servers,
the server name is the second part.
If the user's server is _not_ running, this will be redirected to `/hub/user/:username/...`
@@ -117,14 +117,15 @@ This URL indicates a request for a user server that is not running
(because `/user/...` would have been handled by the notebook server
if the specified server were running).
Handling this URL is the most complicated condition in JupyterHub,
because there can be many states:
Handling this URL depends on two conditions: whether a requested user is found
as a match and the state of the requested user's notebook server,
for example:
1. server is not active
1. the server is not active
a. user matches
b. user doesn't match
2. server is ready
3. server is pending, but not ready
2. the server is ready
3. the server is pending, but not ready
If the server is pending spawn,
the browser will be redirected to `/hub/spawn-pending/:username/:servername`
@@ -140,39 +141,37 @@ Some checks are performed and a delay is added before redirecting back to `/user
If something is really wrong, this can result in a redirect loop.
Visiting this page will never result in triggering the spawn of servers
without additional user action (i.e. clicking the link on the page)
without additional user action (i.e. clicking the link on the page).
![Visiting a URL for a server that's not running](../images/not-running.png)
_Version changed: 1.0_
Prior to 1.0, this URL itself was responsible for spawning servers,
and served the progress page if it was pending,
redirected to running servers, and
This was useful because it made sure that requested servers were restarted after they stopped,
but could also be harmful because unused servers would continuously be restarted if e.g.
an idle JupyterLab frontend were open pointed at it,
which constantly makes polling requests.
Prior to 1.0, this URL itself was responsible for spawning servers.
If the progress page was pending, the URL redirected it to running servers.
This was useful because it made sure that the requested servers were restarted after they stopped.
However, it could also be harmful because unused servers would continuously be restarted if e.g.
an idle JupyterLab frontend that constantly makes polling requests was openly pointed at it.
### Special handling of API requests
Requests to `/user/:username[/:servername]/api/...` are assumed to be
from applications connected to stopped servers.
These are failed with 503 and an informative JSON error message
indicating how to spawn the server.
This is meant to help applications such as JupyterLab
These requests fail with a `503` status code and an informative JSON error message
that indicates how to spawn the server.
This is meant to help applications such as JupyterLab,
that are connected to a server that has stopped.
_Version changed: 1.0_
JupyterHub 0.9 failed these API requests with status 404,
but 1.0 uses 503.
JupyterHub version 0.9 failed these API requests with status `404`,
but version 1.0 uses 503.
## `/user-redirect/...`
This URL is for sharing a URL that will redirect a user
The `/user-redirect/...` URL is for sharing a URL that will redirect a user
to a path on their own default server.
This is useful when users have the same file at the same URL on their servers,
This is useful when different users have the same file at the same URL on their servers,
and you want a single link to give to any user that will open that file on their server.
e.g. a link to `/user-redirect/notebooks/Index.ipynb`
@@ -194,7 +193,7 @@ that is intended to make it possible.
### `/hub/spawn[/:username[/:servername]]`
Requesting `/hub/spawn` will spawn the default server for the current user.
If `username` and optionally `servername` are specified,
If the `username` and optionally `servername` are specified,
then the specified server for the specified user will be spawned.
Once spawn has been requested,
the browser is redirected to `/hub/spawn-pending/...`.
@@ -207,7 +206,7 @@ and a POST request will trigger the actual spawn and redirect.
_Version added: 1.0_
1.0 adds the ability to specify username and servername.
1.0 adds the ability to specify `username` and `servername`.
Prior to 1.0, only `/hub/spawn` was recognized for the default server.
_Version changed: 1.0_
@@ -247,7 +246,7 @@ against the [JupyterHub REST API](./rest.md).
Administrators can take various administrative actions from this page:
1. add/remove users
2. grant admin privileges
3. start/stop user servers
4. shutdown JupyterHub itself
- add/remove users
- grant admin privileges
- start/stop user servers
- shutdown JupyterHub itself

View File

@@ -5,7 +5,7 @@ The **Security Overview** section helps you learn about:
- the design of JupyterHub with respect to web security
- the semi-trusted user
- the available mitigations to protect untrusted users from each other
- the value of periodic security audits.
- the value of periodic security audits
This overview also helps you obtain a deeper understanding of how JupyterHub
works.
@@ -13,12 +13,12 @@ works.
## Semi-trusted and untrusted users
JupyterHub is designed to be a _simple multi-user server for modestly sized
groups_ of **semi-trusted** users. While the design reflects serving semi-trusted
users, JupyterHub is not necessarily unsuitable for serving **untrusted** users.
groups_ of **semi-trusted** users. While the design reflects serving
semi-trusted users, JupyterHub can also be suitable for serving **untrusted** users.
Using JupyterHub with **untrusted** users does mean more work by the
administrator. Much care is required to secure a Hub, with extra caution on
protecting users from each other as the Hub is serving untrusted users.
As a result, using JupyterHub with **untrusted** users means more work by the
administrator, since much care is required to secure a Hub, with extra caution on
protecting users from each other.
One aspect of JupyterHub's _design simplicity_ for **semi-trusted** users is that
the Hub and single-user servers are placed in a _single domain_, behind a
@@ -31,9 +31,8 @@ servers) as a single website (i.e. single domain).
## Protect users from each other
To protect users from each other, a user must **never** be able to write arbitrary
HTML and serve it to another user on the Hub's domain. JupyterHub's
authentication setup prevents a user writing arbitrary HTML and serving it to
another user because only the owner of a given single-user notebook server is
HTML and serve it to another user on the Hub's domain. This is prevented by JupyterHub's
authentication setup because only the owner of a given single-user notebook server is
allowed to view user-authored pages served by the given single-user notebook
server.
@@ -42,15 +41,15 @@ ensure that:
- A user **does not have permission** to modify their single-user notebook server,
including:
- A user **may not** install new packages in the Python environment that runs
their single-user server.
- If the `PATH` is used to resolve the single-user executable (instead of
using an absolute path), a user **may not** create new files in any `PATH`
directory that precedes the directory containing `jupyterhub-singleuser`.
- A user may not modify environment variables (e.g. PATH, PYTHONPATH) for
their single-user server.
- A user **may not** modify the configuration of the notebook server
(the `~/.jupyter` or `JUPYTER_CONFIG_DIR` directory).
- the installation of new packages in the Python environment that runs
their single-user server;
- the creation of new files in any `PATH` directory that precedes the
directory containing `jupyterhub-singleuser` (if the `PATH` is used
to resolve the single-user executable instead of using an absolute path);
- the modification of environment variables (e.g. PATH, PYTHONPATH) for
their single-user server;
- the modification of the configuration of the notebook server
(the `~/.jupyter` or `JUPYTER_CONFIG_DIR` directory).
If any additional services are run on the same domain as the Hub, the services
**must never** display user-authored HTML that is neither _sanitized_ nor _sandboxed_
@@ -58,7 +57,7 @@ If any additional services are run on the same domain as the Hub, the services
## Mitigate security issues
Several approaches to mitigating these issues with configuration
The several approaches to mitigating security issues with configuration
options provided by JupyterHub include:
### Enable subdomains
@@ -69,24 +68,23 @@ desired effect, and user servers and the Hub are protected from each other. A
user's single-user server will be at `username.jupyter.mydomain.com`. This also
requires all user subdomains to point to the same address, which is most easily
accomplished with wildcard DNS. Since this spreads the service across multiple
domains, you will need wildcard SSL, as well. Unfortunately, for many
domains, you will need wildcard SSL as well. Unfortunately, for many
institutional domains, wildcard DNS and SSL are not available. **If you do plan
to serve untrusted users, enabling subdomains is highly encouraged**, as it
resolves the cross-site issues.
### Disable user config
If subdomains are not available or not desirable, JupyterHub provides a
If subdomains are unavailable or undesirable, JupyterHub provides a
configuration option `Spawner.disable_user_config`, which can be set to prevent
the user-owned configuration files from being loaded. After implementing this
option, PATHs and package installation and PATHs are the other things that the
option, `PATH`s and package installation are the other things that the
admin must enforce.
### Prevent spawners from evaluating shell configuration files
For most Spawners, `PATH` is not something users can influence, but care should
be taken to ensure that the Spawner does _not_ evaluate shell configuration
files prior to launching the server.
For most Spawners, `PATH` is not something users can influence, but it's important that
the Spawner should _not_ evaluate shell configuration files prior to launching the server.
### Isolate packages using virtualenv
@@ -101,14 +99,14 @@ pose additional risk to the web application's security.
### Encrypt internal connections with SSL/TLS
By default, all communication on the server, between the proxy, hub, and single
-user notebooks is performed unencrypted. Setting the `internal_ssl` flag in
By default, all communications on the server, between the proxy, hub, and single
-user notebooks are performed unencrypted. Setting the `internal_ssl` flag in
`jupyterhub_config.py` secures the aforementioned routes. Turning this
feature on does require that the enabled `Spawner` can use the certificates
generated by the `Hub` (the default `LocalProcessSpawner` can, for instance).
It is also important to note that this encryption **does not** (yet) cover the
`zmq tcp` sockets between the Notebook client and kernel. While users cannot
It is also important to note that this encryption **does not** cover the
`zmq tcp` sockets between the Notebook client and kernel yet. While users cannot
submit arbitrary commands to another user's kernel, they can bind to these
sockets and listen. When serving untrusted users, this eavesdropping can be
mitigated by setting `KernelManager.transport` to `ipc`. This applies standard
@@ -119,8 +117,8 @@ extend to securing the `tcp` sockets as well.
## Security audits
We recommend that you do periodic reviews of your deployment's security. It's
good practice to keep JupyterHub, configurable-http-proxy, and nodejs
versions up to date.
good practice to keep [JupyterHub](https://readthedocs.org/projects/jupyterhub/), [configurable-http-proxy][], and [nodejs
versions](https://github.com/nodejs/Release) up to date.
A handy website for testing your deployment is
[Qualsys' SSL analyzer tool](https://www.ssllabs.com/ssltest/analyze.html).
@@ -129,7 +127,7 @@ A handy website for testing your deployment is
## Vulnerability reporting
If you believe youve found a security vulnerability in JupyterHub, or any
If you believe you have found a security vulnerability in JupyterHub, or any
Jupyter project, please report it to
[security@ipython.org](mailto:security@ipython.org). If you prefer to encrypt
your security reports, you can use [this PGP public

View File

@@ -1,35 +1,9 @@
# Troubleshooting
When troubleshooting, you may see unexpected behaviors or receive an error
message. This section provide links for identifying the cause of the
message. This section provides links for identifying the cause of the
problem and how to resolve it.
[_Behavior_](#behavior)
- JupyterHub proxy fails to start
- sudospawner fails to run
- What is the default behavior when none of the lists (admin, allowed,
allowed groups) are set?
- JupyterHub Docker container not accessible at localhost
[_Errors_](#errors)
- 500 error after spawning my single-user server
[_How do I...?_](#how-do-i)
- Use a chained SSL certificate
- Install JupyterHub without a network connection
- I want access to the whole filesystem, but still default users to their home directory
- How do I increase the number of pySpark executors on YARN?
- How do I use JupyterLab's prerelease version with JupyterHub?
- How do I set up JupyterHub for a workshop (when users are not known ahead of time)?
- How do I set up rotating daily logs?
- Toree integration with HDFS rack awareness script
- Where do I find Docker images and Dockerfiles related to JupyterHub?
[_Troubleshooting commands_](#troubleshooting-commands)
## Behavior
### JupyterHub proxy fails to start
@@ -40,9 +14,9 @@ If you have tried to start the JupyterHub proxy and it fails to start:
`c.JupyterHub.ip = '*'`; if it is, try `c.JupyterHub.ip = ''`
- Try starting with `jupyterhub --ip=0.0.0.0`
**Note**: If this occurs on Ubuntu/Debian, check that the you are using a
recent version of node. Some versions of Ubuntu/Debian come with a version
of node that is very old, and it is necessary to update node.
**Note**: If this occurs on Ubuntu/Debian, check that you are using a
recent version of [Node](https://nodejs.org). Some versions of Ubuntu/Debian come with a very old version
of Node and it is necessary to update Node.
### sudospawner fails to run
@@ -61,24 +35,24 @@ to the config file, `jupyterhub_config.py`.
### What is the default behavior when none of the lists (admin, allowed, allowed groups) are set?
When nothing is given for these lists, there will be no admins, and all users
who can authenticate on the system (i.e. all the unix users on the server with
who can authenticate on the system (i.e. all the Unix users on the server with
a password) will be allowed to start a server. The allowed username set lets you limit
this to a particular set of users, and admin_users lets you specify who
among them may use the admin interface (not necessary, unless you need to do
things like inspect other users' servers, or modify the user list at runtime).
things like inspect other users' servers or modify the user list at runtime).
### JupyterHub Docker container not accessible at localhost
### JupyterHub Docker container is not accessible at localhost
Even though the command to start your Docker container exposes port 8000
(`docker run -p 8000:8000 -d --name jupyterhub jupyterhub/jupyterhub jupyterhub`),
it is possible that the IP address itself is not accessible/visible. As a result
it is possible that the IP address itself is not accessible/visible. As a result,
when you try http://localhost:8000 in your browser, you are unable to connect
even though the container is running properly. One workaround is to explicitly
tell Jupyterhub to start at `0.0.0.0` which is visible to everyone. Try this
command:
`docker run -p 8000:8000 -d --name jupyterhub jupyterhub/jupyterhub jupyterhub --ip 0.0.0.0 --port 8000`
### How can I kill ports from JupyterHub managed services that have been orphaned?
### How can I kill ports from JupyterHub-managed services that have been orphaned?
I started JupyterHub + nbgrader on the same host without containers. When I try to restart JupyterHub + nbgrader with this configuration, errors appear that the service accounts cannot start because the ports are being used.
@@ -92,12 +66,12 @@ Where `<service_port>` is the port used by the nbgrader course service. This con
### Why am I getting a Spawn failed error message?
After successfully logging in to JupyterHub with a compatible authenticators, I get a 'Spawn failed' error message in the browser. The JupyterHub logs have `jupyterhub KeyError: "getpwnam(): name not found: <my_user_name>`.
After successfully logging in to JupyterHub with a compatible authenticator, I get a 'Spawn failed' error message in the browser. The JupyterHub logs have `jupyterhub KeyError: "getpwnam(): name not found: <my_user_name>`.
This issue occurs when the authenticator requires a local system user to exist. In these cases, you need to use a spawner
that does not require an existing system user account, such as `DockerSpawner` or `KubeSpawner`.
### How can I run JupyterHub with sudo but use my current env vars and virtualenv location?
### How can I run JupyterHub with sudo but use my current environment variables and virtualenv location?
When launching JupyterHub with `sudo jupyterhub` I get import errors and my environment variables don't work.
@@ -109,25 +83,11 @@ sudo MY_ENV=abc123 \
/srv/jupyterhub/jupyterhub
```
### How can I view the logs for JupyterHub or the user's Notebook servers when using the DockerSpawner?
Use `docker logs <container>` where `<container>` is the container name defined within `docker-compose.yml`. For example, to view the logs of the JupyterHub container use:
docker logs hub
By default, the user's notebook server is named `jupyter-<username>` where `username` is the user's username within JupyterHub's db. So if you wanted to see the logs for user `foo` you would use:
docker logs jupyter-foo
You can also tail logs to view them in real time using the `-f` option:
docker logs -f hub
## Errors
### 500 error after spawning my single-user server
### Error 500 after spawning my single-user server
You receive a 500 error when accessing the URL `/user/<your_name>/...`.
You receive a 500 error while accessing the URL `/user/<your_name>/...`.
This is often seen when your single-user server cannot verify your user cookie
with the Hub.
@@ -153,9 +113,9 @@ If everything is working, the response logged will be similar to this:
You should see a similar 200 message, as above, in the Hub log when you first
visit your single-user notebook server. If you don't see this message in the log, it
may mean that your single-user notebook server isn't connecting to your Hub.
may mean that your single-user notebook server is not connecting to your Hub.
If you see 403 (forbidden) like this, it's likely a token problem:
If you see 403 (forbidden) like this, it is likely a token problem:
```
403 GET /hub/api/authorizations/cookie/jupyterhub-token-name/[secret] (@10.0.1.4) 4.14ms
@@ -185,10 +145,10 @@ If you receive a 403 error, the API token for the single-user server is likely
invalid. Commonly, the 403 error is caused by resetting the JupyterHub
database (either removing jupyterhub.sqlite or some other action) while
leaving single-user servers running. This happens most frequently when using
DockerSpawner, because Docker's default behavior is to stop/start containers
which resets the JupyterHub database, rather than destroying and recreating
DockerSpawner because Docker's default behavior is to stop/start containers
that reset the JupyterHub database, rather than destroying and recreating
the container every time. This means that the same API token is used by the
server for its whole life, until the container is rebuilt.
server for its whole life until the container is rebuilt.
The fix for this Docker case is to remove any Docker containers seeing this
issue (typically all containers created before a certain point in time):
@@ -201,28 +161,28 @@ your server again.
##### Proxy settings (403 GET)
When your whole JupyterHub sits behind a organization proxy (_not_ a reverse proxy like NGINX as part of your setup and _not_ the configurable-http-proxy) the environment variables `HTTP_PROXY`, `HTTPS_PROXY`, `http_proxy` and `https_proxy` might be set. This confuses the jupyterhub-singleuser servers: When connecting to the Hub for authorization they connect via the proxy instead of directly connecting to the Hub on localhost. The proxy might deny the request (403 GET). This results in the singleuser server thinking it has a wrong auth token. To circumvent this you should add `<hub_url>,<hub_ip>,localhost,127.0.0.1` to the environment variables `NO_PROXY` and `no_proxy`.
When your whole JupyterHub sits behind an organization proxy (_not_ a reverse proxy like NGINX as part of your setup and _not_ the configurable-http-proxy) the environment variables `HTTP_PROXY`, `HTTPS_PROXY`, `http_proxy`, and `https_proxy` might be set. This confuses the JupyterHub single-user servers: When connecting to the Hub for authorization they connect via the proxy instead of directly connecting to the Hub on localhost. The proxy might deny the request (403 GET). This results in the single-user server thinking it has the wrong auth token. To circumvent this you should add `<hub_url>,<hub_ip>,localhost,127.0.0.1` to the environment variables `NO_PROXY` and `no_proxy`.
### Launching Jupyter Notebooks to run as an externally managed JupyterHub service with the `jupyterhub-singleuser` command returns a `JUPYTERHUB_API_TOKEN` error
[JupyterHub services](https://jupyterhub.readthedocs.io/en/stable/reference/services.html) allow processes to interact with JupyterHub's REST API. Example use-cases include:
- **Secure Testing**: provide a canonical Jupyter Notebook for testing production data to reduce the number of entry points into production systems.
- **Grading Assignments**: provide access to shared Jupyter Notebooks that may be used for management tasks such grading assignments.
- **Grading Assignments**: provide access to shared Jupyter Notebooks that may be used for management tasks such as grading assignments.
- **Private Dashboards**: share dashboards with certain group members.
If possible, try to run the Jupyter Notebook as an externally managed service with one of the provided [jupyter/docker-stacks](https://github.com/jupyter/docker-stacks).
Standard JupyterHub installations include a [jupyterhub-singleuser](https://github.com/jupyterhub/jupyterhub/blob/9fdab027daa32c9017845572ad9d5ba1722dbc53/setup.py#L116) command which is built from the `jupyterhub.singleuser:main` method. The `jupyterhub-singleuser` command is the default command when JupyterHub launches single-user Jupyter Notebooks. One of the goals of this command is to make sure the version of JupyterHub installed within the Jupyter Notebook coincides with the version of the JupyterHub server itself.
If you launch a Jupyter Notebook with the `jupyterhub-singleuser` command directly from the command line the Jupyter Notebook won't have access to the `JUPYTERHUB_API_TOKEN` and will return:
If you launch a Jupyter Notebook with the `jupyterhub-singleuser` command directly from the command line, the Jupyter Notebook won't have access to the `JUPYTERHUB_API_TOKEN` and will return:
```
JUPYTERHUB_API_TOKEN env is required to run jupyterhub-singleuser.
Did you launch it manually?
```
If you plan on testing `jupyterhub-singleuser` independently from JupyterHub, then you can set the api token environment variable. For example, if were to run the single-user Jupyter Notebook on the host, then:
If you plan on testing `jupyterhub-singleuser` independently from JupyterHub, then you can set the API token environment variable. For example, if you were to run the single-user Jupyter Notebook on the host, then:
export JUPYTERHUB_API_TOKEN=my_secret_token
jupyterhub-singleuser
@@ -243,7 +203,7 @@ With a docker container, pass in the environment variable with the run command:
Some certificate providers, i.e. Entrust, may provide you with a chained
certificate that contains multiple files. If you are using a chained
certificate you will need to concatenate the individual files by appending the
chain cert and root cert to your host cert:
chained cert and root cert to your host cert:
cat your_host.crt chain.crt root.crt > your_host-chained.crt
@@ -256,7 +216,7 @@ You would then set in your `jupyterhub_config.py` file the `ssl_key` and
#### Example
Your certificate provider gives you the following files: `example_host.crt`,
`Entrust_L1Kroot.txt` and `Entrust_Root.txt`.
`Entrust_L1Kroot.txt`, and `Entrust_Root.txt`.
Concatenate the files appending the chain cert and root cert to your host cert:
@@ -289,7 +249,7 @@ with npmbox:
python3 -m pip wheel jupyterhub
npmbox configurable-http-proxy
### I want access to the whole filesystem, but still default users to their home directory
### I want access to the whole filesystem and still default users to their home directory
Setting the following in `jupyterhub_config.py` will configure access to
the entire filesystem and set the default to the user's home directory.
@@ -308,7 +268,7 @@ similar to this one:
provides additional information. The [pySpark configuration documentation](https://spark.apache.org/docs/0.9.0/configuration.html)
is also helpful for programmatic configuration examples.
### How do I use JupyterLab's prerelease version with JupyterHub?
### How do I use JupyterLab's pre-release version with JupyterHub?
While JupyterLab is still under active development, we have had users
ask about how to try out JupyterLab with JupyterHub.
@@ -321,7 +281,7 @@ For instance:
python3 -m pip install jupyterlab
jupyter serverextension enable --py jupyterlab --sys-prefix
The important thing is that jupyterlab is installed and enabled in the
The important thing is that JupyterLab is installed and enabled in the
single-user notebook server environment. For system users, this means
system-wide, as indicated above. For Docker containers, it means inside
the single-user docker image, etc.
@@ -334,14 +294,14 @@ notebook servers to default to JupyterLab:
### How do I set up JupyterHub for a workshop (when users are not known ahead of time)?
1. Set up JupyterHub using OAuthenticator for GitHub authentication
2. Configure admin list to have workshop leaders be listed with administrator privileges.
2. Configure the admin list to have workshop leaders listed with administrator privileges.
Users will need a GitHub account to login and be authenticated by the Hub.
Users will need a GitHub account to log in and be authenticated by the Hub.
### How do I set up rotating daily logs?
You can do this with [logrotate](https://linux.die.net/man/8/logrotate),
or pipe to `logger` to use syslog instead of directly to a file.
or pipe to `logger` to use Syslog instead of directly to a file.
For example, with this logrotate config file:
@@ -362,6 +322,52 @@ Or use syslog:
jupyterhub | logger -t jupyterhub
### Toree integration with HDFS rack awareness script
The Apache Toree kernel will have an issue when running with JupyterHub if the standard HDFS rack awareness script is used. This will materialize in the logs as a repeated WARN:
```bash
16/11/29 16:24:20 WARN ScriptBasedMapping: Exception running /etc/hadoop/conf/topology_script.py some.ip.address
ExitCodeException exitCode=1: File "/etc/hadoop/conf/topology_script.py", line 63
print rack
^
SyntaxError: Missing parentheses in call to 'print'
at `org.apache.hadoop.util.Shell.runCommand(Shell.java:576)`
```
In order to resolve this issue, there are two potential options.
1. Update HDFS core-site.xml, so the parameter "net.topology.script.file.name" points to a custom
script (e.g. /etc/hadoop/conf/custom_topology_script.py). Copy the original script and change the first line point
to a python two installation (e.g. /usr/bin/python).
2. In spark-env.sh add a Python 2 installation to your path (e.g. export PATH=/opt/anaconda2/bin:$PATH).
### Where do I find Docker images and Dockerfiles related to JupyterHub?
Docker images can be found at the [JupyterHub organization on DockerHub](https://hub.docker.com/u/jupyterhub/).
The Docker image [jupyterhub/singleuser](https://hub.docker.com/r/jupyterhub/singleuser/)
provides an example single-user notebook server for use with DockerSpawner.
Additional single-user notebook server images can be found at the [Jupyter
organization on DockerHub](https://hub.docker.com/r/jupyter/) and information
about each image at the [jupyter/docker-stacks repo](https://github.com/jupyter/docker-stacks).
### How can I view the logs for JupyterHub or the user's Notebook servers when using the DockerSpawner?
Use `docker logs <container>` where `<container>` is the container name defined within `docker-compose.yml`. For example, to view the logs of the JupyterHub container use:
docker logs hub
By default, the user's notebook server is named `jupyter-<username>` where `username` is the user's username within JupyterHub's database.
So if you wanted to see the logs for user `foo` you would use:
docker logs jupyter-foo
You can also tail logs to view them in real-time using the `-f` option:
docker logs -f hub
## Troubleshooting commands
The following commands provide additional detail about installed packages,
@@ -385,35 +391,3 @@ jupyter kernelspec list
```bash
jupyterhub --debug
```
### Toree integration with HDFS rack awareness script
The Apache Toree kernel will an issue, when running with JupyterHub, if the standard HDFS
rack awareness script is used. This will materialize in the logs as a repeated WARN:
```bash
16/11/29 16:24:20 WARN ScriptBasedMapping: Exception running /etc/hadoop/conf/topology_script.py some.ip.address
ExitCodeException exitCode=1: File "/etc/hadoop/conf/topology_script.py", line 63
print rack
^
SyntaxError: Missing parentheses in call to 'print'
at `org.apache.hadoop.util.Shell.runCommand(Shell.java:576)`
```
In order to resolve this issue, there are two potential options.
1. Update HDFS core-site.xml, so the parameter "net.topology.script.file.name" points to a custom
script (e.g. /etc/hadoop/conf/custom_topology_script.py). Copy the original script and change the first line point
to a python two installation (e.g. /usr/bin/python).
2. In spark-env.sh add a Python 2 installation to your path (e.g. export PATH=/opt/anaconda2/bin:$PATH).
### Where do I find Docker images and Dockerfiles related to JupyterHub?
Docker images can be found at the [JupyterHub organization on DockerHub](https://hub.docker.com/u/jupyterhub/).
The Docker image [jupyterhub/singleuser](https://hub.docker.com/r/jupyterhub/singleuser/)
provides an example single user notebook server for use with DockerSpawner.
Additional single user notebook server images can be found at the [Jupyter
organization on DockerHub](https://hub.docker.com/r/jupyter/) and information
about each image at the [jupyter/docker-stacks repo](https://github.com/jupyter/docker-stacks).

View File

@@ -9,7 +9,7 @@ _Providing writeable storage for LDAP users_
Your Jupyterhub is configured to use the LDAPAuthenticator and DockerSpawer.
- The user has no file directory on the host since your are using LDAP.
- The user has no file directory on the host since you are using LDAP.
- When a user has no directory and DockerSpawner wants to mount a volume,
the spawner will use docker to create a directory.
Since the docker daemon is running as root, the generated directory for the volume
@@ -23,7 +23,7 @@ Another use would be to copy initial content, such as tutorial files or referenc
material, into the user's space when a notebook server is newly spawned.
You can define your own bootstrap process by implementing a `pre_spawn_hook` on any spawner.
The Spawner itself is passed as parameter to your hook and you can easily get the contextual information out of the spawning process.
The Spawner itself is passed as a parameter to your hook and you can easily get the contextual information out of the spawning process.
Similarly, there may be cases where you would like to clean up after a spawner stops.
You may implement a `post_stop_hook` that is always executed after the spawner stops.

View File

@@ -6,12 +6,28 @@ that appear when JupyterHub renders pages.
To run the service as a hub-managed service simply include in your JupyterHub
configuration file something like:
:notebook:**Info**: You can run the announcement service example from the `examples`
directory, using one of the several services provided by JupyterHub.
```python
import sys
from pathlib import Path
# absolute path to announcement.py
announcement_py = str(Path(__file__).parent.joinpath("announcement.py").resolve())
#ensure get_config() is added in
c = get_config()
...
..
c.JupyterHub.services = [
{
'name': 'announcement',
'url': 'http://127.0.0.1:8888',
'command': [sys.executable, "-m", "announcement", "--port", "8888"],
'command': [sys.executable, announcement_py, "--port", "8888"],
}
]
```

View File

@@ -1,5 +1,7 @@
import sys
c = get_config()
# To run the announcement service managed by the hub, add this.
port = 9999

View File

@@ -1 +1,3 @@
from .app import app
__all__ = ["app"]

View File

@@ -51,7 +51,7 @@ async def me(user: User = Depends(get_current_user)):
@router.get("/debug")
async def index(request: Request, user: User = Depends(get_current_user)):
async def debug(request: Request, user: User = Depends(get_current_user)):
"""
Authenticated function that returns a few pieces of debug
* Environ of the service process

View File

@@ -23,7 +23,7 @@ This app is written in JSX, and then transpiled into an ES5 bundle with Babel an
#### Centralized state and data management with Redux:
The app use Redux throughout the components via the `useSelector` and `useDispatch` hooks to store and update user and group data from the API. With Redux, this data is available to any connected component. This means that if one component recieves new data, they all do.
The app uses Redux throughout the components via the `useSelector` and `useDispatch` hooks to store and update user and group data from the API. With Redux, this data is available to any connected component. This means that if one component receives new data, they all do.
#### API functions
@@ -31,7 +31,7 @@ All API functions used by the front end are packaged as a library of props withi
#### Pagination
Indicies of paginated user and group data is stored in a `page` variable in the query string, as well as the `user_page` / `group_page` state variables in Redux. This allows the app to maintain two sources of truth, as well as protect the admin user's place in the collection on page reload. Limit is constant at this point and is held in the Redux state.
Indicies of paginated user and group data are stored in a `page` variable in the query string, as well as the `user_page` / `group_page` state variables in Redux. This allows the app to maintain two sources of truth, as well as protect the admin user's place in the collection on page reload. The limit is constant at this point and is held in the Redux state.
On updates to the paginated data, the app can respond in one of two ways. If a user/group record is either added or deleted, the pagination will reset and data will be pulled back with no offset. Alternatively, if a record is modified, the offset will remain and the change will be shown.
@@ -55,7 +55,7 @@ startServer().then(() => {
.then((data) => dispatchPageChange(data, page));
});
// Alternatively, a new user was added, user data is being refreshed from offset 0.
// Alternatively, a new user was added, and user data is being refreshed from offset 0.
addUser().then(() => {
updateUsers(0, limit)
// After data is fetched, the Redux store is updated with the data and asserts page 0.

View File

@@ -1,10 +1,9 @@
import React, { useEffect } from "react";
import React from "react";
import ReactDOM from "react-dom";
import { Provider } from "react-redux";
import { createStore } from "redux";
import { compose } from "recompose";
import { initialState, reducers } from "./Store";
import { jhapiRequest } from "./util/jhapiUtil";
import withAPI from "./util/withAPI";
import { HashRouter, Switch, Route } from "react-router-dom";
@@ -20,24 +19,6 @@ import "./style/root.css";
const store = createStore(reducers, initialState);
const App = () => {
useEffect(() => {
let { limit, user_page, groups_page } = initialState;
let api = withAPI()().props;
api
.updateUsers(user_page * limit, limit)
.then((data) =>
store.dispatch({ type: "USER_PAGE", value: { data: data, page: 0 } })
)
.catch((err) => console.log(err));
api
.updateGroups(groups_page * limit, limit)
.then((data) =>
store.dispatch({ type: "GROUPS_PAGE", value: { data: data, page: 0 } })
)
.catch((err) => console.log(err));
});
return (
<div className="resets">
<Provider store={store}>

View File

@@ -1,23 +1,48 @@
export const initialState = {
user_data: undefined,
user_page: 0,
user_page: { offset: 0, limit: window.api_page_limit || 100 },
name_filter: "",
groups_data: undefined,
groups_page: 0,
limit: window.api_page_limit,
groups_page: { offset: 0, limit: window.api_page_limit || 100 },
limit: window.api_page_limit || 100,
};
export const reducers = (state = initialState, action) => {
switch (action.type) {
// Updates the client user model data and stores the page
case "USER_OFFSET":
return Object.assign({}, state, {
user_page: Object.assign({}, state.user_page, {
offset: action.value.offset,
}),
});
case "USER_NAME_FILTER":
// set offset to 0 if name filter changed,
// otherwise leave it alone
const newOffset =
action.value.name_filter !== state.name_filter ? 0 : state.name_filter;
return Object.assign({}, state, {
user_page: Object.assign({}, state.user_page, {
offset: newOffset,
}),
name_filter: action.value.name_filter,
});
case "USER_PAGE":
return Object.assign({}, state, {
user_page: action.value.page,
user_data: action.value.data,
name_filter: action.value.name_filter || "",
});
// Updates the client group model data and stores the page
// Updates the client group user model data and stores the page
case "GROUPS_OFFSET":
return Object.assign({}, state, {
groups_page: Object.assign({}, state.groups_page, {
offset: action.value.offset,
}),
});
case "GROUPS_PAGE":
return Object.assign({}, state, {
groups_page: action.value.page,

View File

@@ -21,7 +21,7 @@ const AddUser = (props) => {
});
};
var { addUsers, failRegexEvent, updateUsers, history } = props;
var { addUsers, updateUsers, history } = props;
return (
<>
@@ -98,13 +98,13 @@ const AddUser = (props) => {
.then((data) => dispatchPageChange(data, 0))
.then(() => history.push("/"))
.catch(() =>
setErrorAlert(`Failed to update users.`)
setErrorAlert(`Failed to update users.`),
)
: setErrorAlert(
`Failed to create user. ${
data.status == 409 ? "User already exists." : ""
}`
)
}`,
),
)
.catch(() => setErrorAlert(`Failed to create user.`));
}}
@@ -122,7 +122,6 @@ const AddUser = (props) => {
AddUser.propTypes = {
addUsers: PropTypes.func,
failRegexEvent: PropTypes.func,
updateUsers: PropTypes.func,
history: PropTypes.shape({
push: PropTypes.func,

View File

@@ -28,7 +28,6 @@ var addUserJsx = (spy, spy2, spy3) => (
<HashRouter>
<AddUser
addUsers={spy}
failRegexEvent={spy2 || spy}
updateUsers={spy3 || spy2 || spy}
history={{ push: () => {} }}
/>
@@ -131,7 +130,7 @@ test("Shows a more specific UI error dialogue when user creation returns an impr
});
let errorDialog = screen.getByText(
"Failed to create user. User already exists."
"Failed to create user. User already exists.",
);
expect(errorDialog).toBeVisible();

View File

@@ -81,14 +81,14 @@ const CreateGroup = (props) => {
.then((data) => dispatchPageUpdate(data, 0))
.then(() => history.push("/groups"))
.catch(() =>
setErrorAlert(`Could not update groups list.`)
setErrorAlert(`Could not update groups list.`),
)
: setErrorAlert(
`Failed to create group. ${
data.status == 409
? "Group already exists."
: ""
}`
}`,
);
})
.catch(() => setErrorAlert(`Failed to create group.`));
@@ -108,7 +108,6 @@ const CreateGroup = (props) => {
CreateGroup.propTypes = {
createGroup: PropTypes.func,
updateGroups: PropTypes.func,
failRegexEvent: PropTypes.func,
history: PropTypes.shape({
push: PropTypes.func,
}),

View File

@@ -107,7 +107,7 @@ test("Shows a more specific UI error dialogue when user creation returns an impr
});
let errorDialog = screen.getByText(
"Failed to create group. Group already exists."
"Failed to create group. Group already exists.",
);
expect(errorDialog).toBeVisible();

View File

@@ -96,8 +96,8 @@ const EditUser = (props) => {
.then(() => history.push("/"))
.catch(() =>
setErrorAlert(
`Could not update users list.`
)
`Could not update users list.`,
),
)
: setErrorAlert(`Failed to edit user.`);
})
@@ -125,45 +125,19 @@ const EditUser = (props) => {
if (updatedUsername == "" && admin == has_admin) {
noChangeEvent();
return;
} else if (updatedUsername != "") {
if (
updatedUsername.length > 2 &&
/[!@#$%^&*(),.?":{}|<>]/g.test(updatedUsername) == false
) {
editUser(
username,
updatedUsername != "" ? updatedUsername : username,
admin
)
.then((data) => {
data.status < 300
? updateUsers(0, limit)
.then((data) => dispatchPageChange(data, 0))
.then(() => history.push("/"))
.catch(() =>
setErrorAlert(
`Could not update users list.`
)
)
: setErrorAlert(`Failed to edit user.`);
})
.catch(() => {
setErrorAlert(`Failed to edit user.`);
});
} else {
setErrorAlert(
`Failed to edit user. Make sure the username does not contain special characters.`
);
}
} else {
editUser(username, username, admin)
editUser(
username,
updatedUsername != "" ? updatedUsername : username,
admin,
)
.then((data) => {
data.status < 300
? updateUsers(0, limit)
.then((data) => dispatchPageChange(data, 0))
.then(() => history.push("/"))
.catch(() =>
setErrorAlert(`Could not update users list.`)
setErrorAlert(`Could not update users list.`),
)
: setErrorAlert(`Failed to edit user.`);
})
@@ -196,7 +170,6 @@ EditUser.propTypes = {
}),
editUser: PropTypes.func,
deleteUser: PropTypes.func,
failRegexEvent: PropTypes.func,
noChangeEvent: PropTypes.func,
updateUsers: PropTypes.func,
};

View File

@@ -31,7 +31,6 @@ var editUserJsx = (callbackSpy, empty) => (
editUser={callbackSpy}
updateUsers={callbackSpy}
history={{ push: () => {} }}
failRegexEvent={callbackSpy}
noChangeEvent={callbackSpy}
/>
</HashRouter>

View File

@@ -94,10 +94,10 @@ const GroupEdit = (props) => {
}
let new_users = selected.filter(
(e) => !group_data.users.includes(e)
(e) => !group_data.users.includes(e),
);
let removed_users = group_data.users.filter(
(e) => !selected.includes(e)
(e) => !selected.includes(e),
);
let promiseQueue = [];
@@ -105,7 +105,7 @@ const GroupEdit = (props) => {
promiseQueue.push(addToGroup(new_users, group_data.name));
if (removed_users.length > 0)
promiseQueue.push(
removeFromGroup(removed_users, group_data.name)
removeFromGroup(removed_users, group_data.name),
);
Promise.all(promiseQueue)
@@ -122,7 +122,6 @@ const GroupEdit = (props) => {
: setErrorAlert(`Failed to edit group.`);
})
.catch(() => {
console.log("outer");
setErrorAlert(`Failed to edit group.`);
});
}}

View File

@@ -90,7 +90,7 @@ const GroupSelect = (props) => {
>
{e}
</div>
)
),
)}
</div>
</div>

View File

@@ -1,4 +1,4 @@
import React from "react";
import React, { useEffect } from "react";
import { useSelector, useDispatch } from "react-redux";
import PropTypes from "prop-types";
@@ -6,23 +6,26 @@ import { Link } from "react-router-dom";
import PaginationFooter from "../PaginationFooter/PaginationFooter";
const Groups = (props) => {
var user_data = useSelector((state) => state.user_data),
groups_data = useSelector((state) => state.groups_data),
var groups_data = useSelector((state) => state.groups_data),
groups_page = useSelector((state) => state.groups_page),
limit = useSelector((state) => state.limit),
dispatch = useDispatch(),
page = parseInt(new URLSearchParams(props.location.search).get("page"));
dispatch = useDispatch();
page = isNaN(page) ? 0 : page;
var slice = [page * limit, limit];
var offset = groups_page ? groups_page.offset : 0;
const setOffset = (offset) => {
dispatch({
type: "GROUPS_OFFSET",
value: {
offset: offset,
},
});
};
var limit = groups_page ? groups_page.limit : window.api_page_limit;
var total = groups_page ? groups_page.total : undefined;
var { updateGroups, history } = props;
if (!groups_data || !user_data) {
return <div data-testid="no-show"></div>;
}
const dispatchPageChange = (data, page) => {
const dispatchPageUpdate = (data, page) => {
dispatch({
type: "GROUPS_PAGE",
value: {
@@ -32,10 +35,14 @@ const Groups = (props) => {
});
};
if (groups_page != page) {
updateGroups(...slice).then((data) => {
dispatchPageChange(data, page);
});
useEffect(() => {
updateGroups(offset, limit).then((data) =>
dispatchPageUpdate(data.items, data._pagination),
);
}, [offset, limit]);
if (!groups_data || !groups_page) {
return <div data-testid="no-show"></div>;
}
return (
@@ -59,7 +66,6 @@ const Groups = (props) => {
pathname: "/group-edit",
state: {
group_data: e,
user_data: user_data,
},
}}
>
@@ -74,11 +80,12 @@ const Groups = (props) => {
)}
</ul>
<PaginationFooter
endpoint="/groups"
page={page}
offset={offset}
limit={limit}
numOffset={slice[0]}
numElements={groups_data.length}
visible={groups_data.length}
total={total}
next={() => setOffset(offset + limit)}
prev={() => setOffset(offset >= limit ? offset - limit : 0)}
/>
</div>
<div className="panel-footer">
@@ -102,8 +109,6 @@ const Groups = (props) => {
};
Groups.propTypes = {
user_data: PropTypes.array,
groups_data: PropTypes.array,
updateUsers: PropTypes.func,
updateGroups: PropTypes.func,
history: PropTypes.shape({

View File

@@ -1,53 +1,72 @@
import React from "react";
import "@testing-library/jest-dom";
import { act } from "react-dom/test-utils";
import { render, screen } from "@testing-library/react";
import { render, screen, fireEvent } from "@testing-library/react";
import { Provider, useDispatch, useSelector } from "react-redux";
import { createStore } from "redux";
import { HashRouter } from "react-router-dom";
// eslint-disable-next-line
import regeneratorRuntime from "regenerator-runtime";
import { initialState, reducers } from "../../Store";
import Groups from "./Groups";
jest.mock("react-redux", () => ({
...jest.requireActual("react-redux"),
useSelector: jest.fn(),
useDispatch: jest.fn(),
}));
var mockAsync = () =>
jest.fn().mockImplementation(() => Promise.resolve({ key: "value" }));
var groupsJsx = (callbackSpy) => (
<Provider store={createStore(() => {}, {})}>
<Provider store={createStore(mockReducers, mockAppState())}>
<HashRouter>
<Groups location={{ search: "0" }} updateGroups={callbackSpy} />
</HashRouter>
</Provider>
);
var mockAppState = () => ({
user_data: JSON.parse(
'[{"kind":"user","name":"foo","admin":true,"groups":[],"server":"/user/foo/","pending":null,"created":"2020-12-07T18:46:27.112695Z","last_activity":"2020-12-07T21:00:33.336354Z","servers":{"":{"name":"","last_activity":"2020-12-07T20:58:02.437408Z","started":"2020-12-07T20:58:01.508266Z","pending":null,"ready":true,"state":{"pid":28085},"url":"/user/foo/","user_options":{},"progress_url":"/hub/api/users/foo/server/progress"}}},{"kind":"user","name":"bar","admin":false,"groups":[],"server":null,"pending":null,"created":"2020-12-07T18:46:27.115528Z","last_activity":"2020-12-07T20:43:51.013613Z","servers":{}}]'
),
groups_data: JSON.parse(
'[{"kind":"group","name":"testgroup","users":[]}, {"kind":"group","name":"testgroup2","users":["foo", "bar"]}]'
),
limit: 10,
var mockReducers = jest.fn((state, action) => {
if (action.type === "GROUPS_PAGE" && !action.value.data) {
// no-op from mock, don't update state
return state;
}
state = reducers(state, action);
// mocked useSelector seems to cause a problem
// this should get the right state back?
// not sure
// useSelector.mockImplementation((callback) => callback(state);
return state;
});
var mockAppState = () =>
Object.assign({}, initialState, {
groups_data: [
{ kind: "group", name: "testgroup", users: [] },
{ kind: "group", name: "testgroup2", users: ["foo", "bar"] },
],
groups_page: {
offset: 0,
limit: 2,
total: 4,
next: {
offset: 2,
limit: 2,
url: "http://localhost:8000/hub/api/groups?offset=2&limit=2",
},
},
});
beforeEach(() => {
useSelector.mockImplementation((callback) => {
return callback(mockAppState());
});
useDispatch.mockImplementation(() => {
return () => {};
});
});
afterEach(() => {
useSelector.mockClear();
mockReducers.mockClear();
});
test("Renders", async () => {
@@ -88,3 +107,30 @@ test("Renders nothing if required data is not available", async () => {
let noShow = screen.getByTestId("no-show");
expect(noShow).toBeVisible();
});
test("Interacting with PaginationFooter causes state update and refresh via useEffect call", async () => {
let callbackSpy = mockAsync();
await act(async () => {
render(groupsJsx(callbackSpy));
});
expect(callbackSpy).toBeCalledWith(0, 2);
var lastState =
mockReducers.mock.results[mockReducers.mock.results.length - 1].value;
expect(lastState.groups_page.offset).toEqual(0);
expect(lastState.groups_page.limit).toEqual(2);
let next = screen.getByTestId("paginate-next");
fireEvent.click(next);
lastState =
mockReducers.mock.results[mockReducers.mock.results.length - 1].value;
expect(lastState.groups_page.offset).toEqual(2);
expect(lastState.groups_page.limit).toEqual(2);
// FIXME: mocked useSelector, state seem to prevent updateGroups from being called
// making the test environment not representative
// expect(callbackSpy).toHaveBeenCalledWith(2, 2);
});

View File

@@ -1,33 +1,40 @@
import React from "react";
import { Link } from "react-router-dom";
import PropTypes from "prop-types";
import "./pagination-footer.css";
const PaginationFooter = (props) => {
let { endpoint, page, limit, numOffset, numElements } = props;
let { offset, limit, visible, total, next, prev } = props;
return (
<div className="pagination-footer">
<p>
Displaying {numOffset}-{numOffset + numElements}
Displaying {offset}-{offset + visible}
<br></br>
<br></br>
{page >= 1 ? (
{offset >= 1 ? (
<button className="btn btn-sm btn-light spaced">
<Link to={`${endpoint}?page=${page - 1}`}>
<span className="active-pagination">Previous</span>
</Link>
<span
className="active-pagination"
data-testid="paginate-prev"
onClick={prev}
>
Previous
</span>
</button>
) : (
<button className="btn btn-sm btn-light spaced">
<span className="inactive-pagination">Previous</span>
</button>
)}
{numElements >= limit ? (
{offset + visible < total ? (
<button className="btn btn-sm btn-light spaced">
<Link to={`${endpoint}?page=${page + 1}`}>
<span className="active-pagination">Next</span>
</Link>
<span
className="active-pagination"
data-testid="paginate-next"
onClick={next}
>
Next
</span>
</button>
) : (
<button className="btn btn-sm btn-light spaced">

View File

@@ -1,6 +1,6 @@
import React, { useState } from "react";
import regeneratorRuntime from "regenerator-runtime";
import React, { useEffect, useState } from "react";
import { useSelector, useDispatch } from "react-redux";
import { debounce } from "lodash";
import PropTypes from "prop-types";
import {
@@ -38,11 +38,11 @@ const ServerDashboard = (props) => {
adminAsc = (e) => e.sort((a) => (a.admin ? 1 : -1)),
dateDesc = (e) =>
e.sort((a, b) =>
new Date(a.last_activity) - new Date(b.last_activity) > 0 ? -1 : 1
new Date(a.last_activity) - new Date(b.last_activity) > 0 ? -1 : 1,
),
dateAsc = (e) =>
e.sort((a, b) =>
new Date(a.last_activity) - new Date(b.last_activity) > 0 ? 1 : -1
new Date(a.last_activity) - new Date(b.last_activity) > 0 ? 1 : -1,
),
runningAsc = (e) => e.sort((a) => (a.server == null ? -1 : 1)),
runningDesc = (e) => e.sort((a) => (a.server == null ? 1 : -1));
@@ -50,16 +50,15 @@ const ServerDashboard = (props) => {
var [errorAlert, setErrorAlert] = useState(null);
var [sortMethod, setSortMethod] = useState(null);
var [disabledButtons, setDisabledButtons] = useState({});
const [collapseStates, setCollapseStates] = useState({});
var [collapseStates, setCollapseStates] = useState({});
var user_data = useSelector((state) => state.user_data),
user_page = useSelector((state) => state.user_page),
limit = useSelector((state) => state.limit),
name_filter = useSelector((state) => state.name_filter),
page = parseInt(new URLSearchParams(props.location.search).get("page"));
name_filter = useSelector((state) => state.name_filter);
page = isNaN(page) ? 0 : page;
var slice = [page * limit, limit, name_filter];
var offset = user_page ? user_page.offset : 0;
var limit = user_page ? user_page.limit : window.api_page_limit;
var total = user_page ? user_page.total : undefined;
const dispatch = useDispatch();
@@ -73,33 +72,48 @@ const ServerDashboard = (props) => {
history,
} = props;
var dispatchPageUpdate = (data, page, name_filter) => {
const dispatchPageUpdate = (data, page) => {
dispatch({
type: "USER_PAGE",
value: {
data: data,
page: page,
},
});
};
const setOffset = (newOffset) => {
dispatch({
type: "USER_OFFSET",
value: {
offset: newOffset,
},
});
};
const setNameFilter = (name_filter) => {
dispatch({
type: "USER_NAME_FILTER",
value: {
name_filter: name_filter,
},
});
};
if (!user_data) {
useEffect(() => {
updateUsers(offset, limit, name_filter)
.then((data) => dispatchPageUpdate(data.items, data._pagination))
.catch((err) => setErrorAlert("Failed to update user list."));
}, [offset, limit, name_filter]);
if (!user_data || !user_page) {
return <div data-testid="no-show"></div>;
}
if (page != user_page) {
updateUsers(...slice).then((data) =>
dispatchPageUpdate(data, page, name_filter)
);
}
var slice = [offset, limit, name_filter];
var debounce = require("lodash.debounce");
const handleSearch = debounce(async (event) => {
// setNameFilter(event.target.value);
updateUsers(page * limit, limit, event.target.value).then((data) =>
dispatchPageUpdate(data, page, name_filter)
);
setNameFilter(event.target.value);
}, 300);
if (sortMethod != null) {
@@ -119,7 +133,11 @@ const ServerDashboard = (props) => {
if (res.status < 300) {
updateUsers(...slice)
.then((data) => {
dispatchPageUpdate(data, page, name_filter);
dispatchPageUpdate(
data.items,
data._pagination,
name_filter,
);
})
.catch(() => {
setIsDisabled(false);
@@ -155,7 +173,11 @@ const ServerDashboard = (props) => {
if (res.status < 300) {
updateUsers(...slice)
.then((data) => {
dispatchPageUpdate(data, page, name_filter);
dispatchPageUpdate(
data.items,
data._pagination,
name_filter,
);
})
.catch(() => {
setErrorAlert(`Failed to update users list.`);
@@ -449,7 +471,7 @@ const ServerDashboard = (props) => {
failedServers.length > 1 ? "servers" : "server"
}. ${
failedServers.length > 1 ? "Are they " : "Is it "
} already running?`
} already running?`,
);
}
return res;
@@ -457,10 +479,14 @@ const ServerDashboard = (props) => {
.then((res) => {
updateUsers(...slice)
.then((data) => {
dispatchPageUpdate(data, page, name_filter);
dispatchPageUpdate(
data.items,
data._pagination,
name_filter,
);
})
.catch(() =>
setErrorAlert(`Failed to update users list.`)
setErrorAlert(`Failed to update users list.`),
);
return res;
})
@@ -485,7 +511,7 @@ const ServerDashboard = (props) => {
failedServers.length > 1 ? "servers" : "server"
}. ${
failedServers.length > 1 ? "Are they " : "Is it "
} already stopped?`
} already stopped?`,
);
}
return res;
@@ -493,10 +519,14 @@ const ServerDashboard = (props) => {
.then((res) => {
updateUsers(...slice)
.then((data) => {
dispatchPageUpdate(data, page, name_filter);
dispatchPageUpdate(
data.items,
data._pagination,
name_filter,
);
})
.catch(() =>
setErrorAlert(`Failed to update users list.`)
setErrorAlert(`Failed to update users list.`),
);
return res;
})
@@ -521,11 +551,12 @@ const ServerDashboard = (props) => {
</tbody>
</table>
<PaginationFooter
endpoint="/"
page={page}
offset={offset}
limit={limit}
numOffset={slice[0]}
numElements={user_data.length}
visible={user_data.length}
total={total}
next={() => setOffset(offset + limit)}
prev={() => setOffset(offset - limit)}
/>
<br></br>
</div>

View File

@@ -10,6 +10,7 @@ import { createStore } from "redux";
import regeneratorRuntime from "regenerator-runtime";
import ServerDashboard from "./ServerDashboard";
import { initialState, reducers } from "../../Store";
import * as sinon from "sinon";
let clock;
@@ -20,7 +21,7 @@ jest.mock("react-redux", () => ({
}));
var serverDashboardJsx = (spy) => (
<Provider store={createStore(() => {}, {})}>
<Provider store={createStore(mockReducers, mockAppState())}>
<HashRouter>
<Switch>
<ServerDashboard
@@ -42,10 +43,67 @@ var mockAsync = (data) =>
var mockAsyncRejection = () =>
jest.fn().mockImplementation(() => Promise.reject());
var mockAppState = () => ({
user_data: JSON.parse(
'[{"kind":"user","name":"foo","admin":true,"groups":[],"server":"/user/foo/","pending":null,"created":"2020-12-07T18:46:27.112695Z","last_activity":"2020-12-07T21:00:33.336354Z","servers":{"":{"name":"","last_activity":"2020-12-07T20:58:02.437408Z","started":"2020-12-07T20:58:01.508266Z","pending":null,"ready":true,"state":{"pid":28085},"url":"/user/foo/","user_options":{},"progress_url":"/hub/api/users/foo/server/progress"}}},{"kind":"user","name":"bar","admin":false,"groups":[],"server":null,"pending":null,"created":"2020-12-07T18:46:27.115528Z","last_activity":"2020-12-07T20:43:51.013613Z","servers":{}}]'
),
var mockAppState = () =>
Object.assign({}, initialState, {
user_data: [
{
kind: "user",
name: "foo",
admin: true,
groups: [],
server: "/user/foo/",
pending: null,
created: "2020-12-07T18:46:27.112695Z",
last_activity: "2020-12-07T21:00:33.336354Z",
servers: {
"": {
name: "",
last_activity: "2020-12-07T20:58:02.437408Z",
started: "2020-12-07T20:58:01.508266Z",
pending: null,
ready: true,
state: { pid: 28085 },
url: "/user/foo/",
user_options: {},
progress_url: "/hub/api/users/foo/server/progress",
},
},
},
{
kind: "user",
name: "bar",
admin: false,
groups: [],
server: null,
pending: null,
created: "2020-12-07T18:46:27.115528Z",
last_activity: "2020-12-07T20:43:51.013613Z",
servers: {},
},
],
user_page: {
offset: 0,
limit: 2,
total: 4,
next: {
offset: 2,
limit: 2,
url: "http://localhost:8000/hub/api/groups?offset=2&limit=2",
},
},
});
var mockReducers = jest.fn((state, action) => {
if (action.type === "USER_PAGE" && !action.value.data) {
// no-op from mock, don't update state
return state;
}
state = reducers(state, action);
// mocked useSelector seems to cause a problem
// this should get the right state back?
// not sure
// useSelector.mockImplementation((callback) => callback(state);
return state;
});
beforeEach(() => {
@@ -57,6 +115,7 @@ beforeEach(() => {
afterEach(() => {
useSelector.mockClear();
mockReducers.mockClear();
clock.restore();
});
@@ -310,7 +369,7 @@ test("Shows a UI error dialogue when start all servers fails", async () => {
/>
</Switch>
</HashRouter>
</Provider>
</Provider>,
);
});
@@ -344,7 +403,7 @@ test("Shows a UI error dialogue when stop all servers fails", async () => {
/>
</Switch>
</HashRouter>
</Provider>
</Provider>,
);
});
@@ -378,7 +437,7 @@ test("Shows a UI error dialogue when start user server fails", async () => {
/>
</Switch>
</HashRouter>
</Provider>
</Provider>,
);
});
@@ -412,7 +471,7 @@ test("Shows a UI error dialogue when start user server returns an improper statu
/>
</Switch>
</HashRouter>
</Provider>
</Provider>,
);
});
@@ -446,7 +505,7 @@ test("Shows a UI error dialogue when stop user servers fails", async () => {
/>
</Switch>
</HashRouter>
</Provider>
</Provider>,
);
});
@@ -480,7 +539,7 @@ test("Shows a UI error dialogue when stop user server returns an improper status
/>
</Switch>
</HashRouter>
</Provider>
</Provider>,
);
});
@@ -498,11 +557,22 @@ test("Shows a UI error dialogue when stop user server returns an improper status
test("Search for user calls updateUsers with name filter", async () => {
let spy = mockAsync();
let mockUpdateUsers = jest.fn((offset, limit, name_filter) => {
return Promise.resolve([]);
return Promise.resolve({
items: [],
_pagination: {
offset: offset,
limit: limit,
total: offset + limit * 2,
next: {
offset: offset + limit,
limit: limit,
},
},
});
});
await act(async () => {
render(
<Provider store={createStore(() => {}, {})}>
<Provider store={createStore(mockReducers, mockAppState())}>
<HashRouter>
<Switch>
<ServerDashboard
@@ -515,21 +585,62 @@ test("Search for user calls updateUsers with name filter", async () => {
/>
</Switch>
</HashRouter>
</Provider>
</Provider>,
);
});
let search = screen.getByLabelText("user-search");
expect(mockUpdateUsers.mock.calls).toHaveLength(1);
userEvent.type(search, "a");
expect(search.value).toEqual("a");
clock.tick(400);
expect(mockUpdateUsers.mock.calls[1][2]).toEqual("a");
expect(mockUpdateUsers.mock.calls).toHaveLength(2);
expect(mockReducers.mock.calls).toHaveLength(3);
var lastState =
mockReducers.mock.results[mockReducers.mock.results.length - 1].value;
expect(lastState.name_filter).toEqual("a");
// TODO: this should
expect(mockUpdateUsers.mock.calls).toHaveLength(1);
userEvent.type(search, "b");
expect(search.value).toEqual("ab");
clock.tick(400);
expect(mockUpdateUsers.mock.calls[2][2]).toEqual("ab");
expect(mockUpdateUsers.mock.calls).toHaveLength(3);
expect(mockReducers.mock.calls).toHaveLength(4);
lastState =
mockReducers.mock.results[mockReducers.mock.results.length - 1].value;
expect(lastState.name_filter).toEqual("ab");
expect(lastState.user_page.offset).toEqual(0);
});
test("Interacting with PaginationFooter causes state update and refresh via useEffect call", async () => {
let callbackSpy = mockAsync();
await act(async () => {
render(serverDashboardJsx(callbackSpy));
});
expect(callbackSpy).toBeCalledWith(0, 2, "");
expect(mockReducers.mock.results).toHaveLength(2);
lastState =
mockReducers.mock.results[mockReducers.mock.results.length - 1].value;
console.log(lastState);
expect(lastState.user_page.offset).toEqual(0);
expect(lastState.user_page.limit).toEqual(2);
let next = screen.getByTestId("paginate-next");
fireEvent.click(next);
clock.tick(400);
expect(mockReducers.mock.results).toHaveLength(3);
var lastState =
mockReducers.mock.results[mockReducers.mock.results.length - 1].value;
expect(lastState.user_page.offset).toEqual(2);
expect(lastState.user_page.limit).toEqual(2);
// FIXME: should call updateUsers, does in reality.
// tests don't reflect reality due to mocked state/useSelector
// unclear how to fix this.
// expect(callbackSpy.mock.calls).toHaveLength(2);
// expect(callbackSpy).toHaveBeenCalledWith(2, 2, "");
});

View File

@@ -6,6 +6,7 @@ export const jhapiRequest = (endpoint, method, data) => {
json: true,
headers: {
"Content-Type": "application/json",
Accept: "application/jupyterhub-pagination+json",
},
body: data ? JSON.stringify(data) : null,
});

View File

@@ -7,11 +7,11 @@ const withAPI = withProps(() => ({
`/users?include_stopped_servers&offset=${offset}&limit=${limit}&name_filter=${
name_filter || ""
}`,
"GET"
"GET",
).then((data) => data.json()),
updateGroups: (offset, limit) =>
jhapiRequest(`/groups?offset=${offset}&limit=${limit}`, "GET").then(
(data) => data.json()
(data) => data.json(),
),
shutdownHub: () => jhapiRequest("/shutdown", "POST"),
startServer: (name, serverName = "") =>
@@ -41,10 +41,7 @@ const withAPI = withProps(() => ({
jhapiRequest("/users/" + username, "GET")
.then((data) => data.status)
.then((data) => (data > 200 ? false : true)),
// Temporarily Unused
failRegexEvent: () => {
return null;
},
noChangeEvent: () => {
return null;
},

View File

@@ -41,10 +41,10 @@ module.exports = {
const app = devServer.app;
var user_data = JSON.parse(
'[{"kind":"user","name":"foo","admin":true,"groups":[],"server":"/user/foo/","pending":null,"created":"2020-12-07T18:46:27.112695Z","last_activity":"2020-12-07T21:00:33.336354Z","servers":{"":{"name":"","last_activity":"2020-12-07T20:58:02.437408Z","started":"2020-12-07T20:58:01.508266Z","pending":null,"ready":true,"state":{"pid":28085},"url":"/user/foo/","user_options":{},"progress_url":"/hub/api/users/foo/server/progress"}}},{"kind":"user","name":"bar","admin":false,"groups":[],"server":null,"pending":null,"created":"2020-12-07T18:46:27.115528Z","last_activity":"2020-12-07T20:43:51.013613Z","servers":{}}]'
'[{"kind":"user","name":"foo","admin":true,"groups":[],"server":"/user/foo/","pending":null,"created":"2020-12-07T18:46:27.112695Z","last_activity":"2020-12-07T21:00:33.336354Z","servers":{"":{"name":"","last_activity":"2020-12-07T20:58:02.437408Z","started":"2020-12-07T20:58:01.508266Z","pending":null,"ready":true,"state":{"pid":28085},"url":"/user/foo/","user_options":{},"progress_url":"/hub/api/users/foo/server/progress"}}},{"kind":"user","name":"bar","admin":false,"groups":[],"server":null,"pending":null,"created":"2020-12-07T18:46:27.115528Z","last_activity":"2020-12-07T20:43:51.013613Z","servers":{}}]',
);
var group_data = JSON.parse(
'[{"kind":"group","name":"testgroup","users":[]}, {"kind":"group","name":"testgroup2","users":["foo", "bar"]}]'
'[{"kind":"group","name":"testgroup","users":[]}, {"kind":"group","name":"testgroup2","users":["foo", "bar"]}]',
);
// get user_data

View File

@@ -5046,9 +5046,9 @@ loader-runner@^4.2.0:
integrity sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==
loader-utils@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.2.tgz#d6e3b4fb81870721ae4e0868ab11dd638368c129"
integrity sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==
version "2.0.4"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.4.tgz#8b5cb38b5c34a9a018ee1fc0e6a066d1dfcc528c"
integrity sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==
dependencies:
big.js "^5.2.2"
emojis-list "^3.0.0"

View File

@@ -1 +1,3 @@
from ._version import __version__, version_info
__all__ = ["__version__", "version_info"]

View File

@@ -2,7 +2,7 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
# version_info updated by running `tbump`
version_info = (3, 0, 0, "b1", "")
version_info = (3, 1, 1, "", "")
# pep 440 version: no dot before beta/rc, but before .dev
# 0.1.0rc1

View File

@@ -11,9 +11,6 @@ down_revision = None
branch_labels = None
depends_on = None
import sqlalchemy as sa
from alembic import op
def upgrade():
pass

View File

@@ -1,5 +1,5 @@
from . import auth, groups, hub, proxy, services, users
from .base import *
from .base import * # noqa
default_handlers = []
for mod in (auth, hub, proxy, users, groups, services):

View File

@@ -3,6 +3,7 @@
# Distributed under the terms of the Modified BSD License.
import json
from datetime import datetime
from unittest import mock
from urllib.parse import parse_qsl, quote, urlencode, urlparse, urlunparse
from oauthlib import oauth2
@@ -241,12 +242,18 @@ class OAuthAuthorizeHandler(OAuthHandler, BaseHandler):
uri, http_method, body, headers = self.extract_oauth_params()
try:
(
requested_scopes,
credentials,
) = self.oauth_provider.validate_authorization_request(
uri, http_method, body, headers
)
with mock.patch.object(
self.oauth_provider.request_validator,
"_current_user",
self.current_user,
create=True,
):
(
requested_scopes,
credentials,
) = self.oauth_provider.validate_authorization_request(
uri, http_method, body, headers
)
credentials = self.add_credentials(credentials)
client = self.oauth_provider.fetch_by_client_id(credentials['client_id'])
allowed = False
@@ -289,12 +296,15 @@ class OAuthAuthorizeHandler(OAuthHandler, BaseHandler):
required_scopes = {*scopes.identify_scopes(), *scopes.access_scopes(client)}
user_scopes |= {"inherit", *required_scopes}
allowed_scopes = requested_scopes.intersection(user_scopes)
excluded_scopes = requested_scopes.difference(user_scopes)
# TODO: compute lower-level intersection of remaining _expanded_ scopes
# (e.g. user has admin:users, requesting read:users!group=x)
allowed_scopes, disallowed_scopes = scopes._resolve_requested_scopes(
requested_scopes,
user_scopes,
user=user.orm_user,
client=client,
db=self.db,
)
if excluded_scopes:
if disallowed_scopes:
self.log.warning(
f"Service {client.description} requested scopes {','.join(requested_scopes)}"
f" for user {self.current_user.name},"

View File

@@ -94,8 +94,9 @@ class GroupListAPIHandler(_GroupAPIHandler):
# create the group
self.log.info("Creating new group %s with %i users", name, len(users))
self.log.debug("Users: %s", usernames)
group = orm.Group(name=name, users=users)
group = orm.Group(name=name)
self.db.add(group)
group.users = users
self.db.commit()
created.append(group)
self.write(json.dumps([self.group_model(group) for group in created]))
@@ -131,8 +132,9 @@ class GroupAPIHandler(_GroupAPIHandler):
# create the group
self.log.info("Creating new group %s with %i users", group_name, len(users))
self.log.debug("Users: %s", usernames)
group = orm.Group(name=group_name, users=users)
group = orm.Group(name=group_name)
self.db.add(group)
group.users = users
self.db.commit()
self.write(json.dumps(self.group_model(group)))
self.set_status(201)

Some files were not shown because too many files have changed in this diff Show More