Compare commits
20 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a3c93088a8 | ||
![]() |
834229622d | ||
![]() |
44a1ea42de | ||
![]() |
3879a96b67 | ||
![]() |
d40627d397 | ||
![]() |
057cdbc9e9 | ||
![]() |
75390d2e46 | ||
![]() |
f5e4846cfa | ||
![]() |
3dc115a829 | ||
![]() |
af4ddbfc58 | ||
![]() |
50a4d1e34d | ||
![]() |
86a238334c | ||
![]() |
dacb9d1668 | ||
![]() |
95cc170383 | ||
![]() |
437a9d150f | ||
![]() |
c9616d6f11 | ||
![]() |
61aed70c4d | ||
![]() |
9abb573d47 | ||
![]() |
b074304834 | ||
![]() |
201e7ca3d8 |
@@ -5,5 +5,6 @@ jupyterhub.sqlite
|
|||||||
jupyterhub_config.py
|
jupyterhub_config.py
|
||||||
node_modules
|
node_modules
|
||||||
docs
|
docs
|
||||||
|
.git
|
||||||
dist
|
dist
|
||||||
build
|
build
|
||||||
|
9
.flake8
@@ -3,9 +3,14 @@
|
|||||||
# E: style errors
|
# E: style errors
|
||||||
# W: style warnings
|
# W: style warnings
|
||||||
# C: complexity
|
# C: complexity
|
||||||
# D: docstring warnings (unused pydocstyle extension)
|
# F401: module imported but unused
|
||||||
|
# F403: import *
|
||||||
|
# F811: redefinition of unused `name` from line `N`
|
||||||
# F841: local variable assigned but never used
|
# F841: local variable assigned but never used
|
||||||
ignore = E, C, W, D, F841
|
# 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
|
||||||
builtins = c, get_config
|
builtins = c, get_config
|
||||||
exclude =
|
exclude =
|
||||||
.cache,
|
.cache,
|
||||||
|
64
.github/dependabot.yaml
vendored
@@ -1,64 +0,0 @@
|
|||||||
# dependabot.yaml reference: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
|
||||||
#
|
|
||||||
# Notes:
|
|
||||||
# - Status and logs from dependabot are provided at
|
|
||||||
# https://github.com/jupyterhub/jupyterhub/network/updates.
|
|
||||||
#
|
|
||||||
version: 2
|
|
||||||
updates:
|
|
||||||
# Maintain dependencies in our GitHub Workflows
|
|
||||||
- package-ecosystem: github-actions
|
|
||||||
directory: /
|
|
||||||
labels: [ci]
|
|
||||||
schedule:
|
|
||||||
interval: monthly
|
|
||||||
time: "05:00"
|
|
||||||
timezone: Etc/UTC
|
|
||||||
- package-ecosystem: npm
|
|
||||||
directory: /
|
|
||||||
groups:
|
|
||||||
# one big pull request for minor bumps
|
|
||||||
npm-minor:
|
|
||||||
patterns:
|
|
||||||
- "*"
|
|
||||||
update-types:
|
|
||||||
- minor
|
|
||||||
- patch
|
|
||||||
schedule:
|
|
||||||
interval: monthly
|
|
||||||
- package-ecosystem: npm
|
|
||||||
directory: /jsx
|
|
||||||
groups:
|
|
||||||
# one big pull request for minor bumps
|
|
||||||
jsx-minor:
|
|
||||||
patterns:
|
|
||||||
- "*"
|
|
||||||
update-types:
|
|
||||||
- minor
|
|
||||||
- patch
|
|
||||||
# group major bumps of react-related dependencies
|
|
||||||
jsx-react:
|
|
||||||
patterns:
|
|
||||||
- "react*"
|
|
||||||
- "redux*"
|
|
||||||
- "*react"
|
|
||||||
- "recompose"
|
|
||||||
update-types:
|
|
||||||
- major
|
|
||||||
# group major bumps of webpack-related dependencies
|
|
||||||
jsx-webpack:
|
|
||||||
patterns:
|
|
||||||
- "*webpack*"
|
|
||||||
- "@babel/*"
|
|
||||||
- "*-loader"
|
|
||||||
update-types:
|
|
||||||
- major
|
|
||||||
# group major bumps of jest-related dependencies
|
|
||||||
jsx-jest:
|
|
||||||
patterns:
|
|
||||||
- "*jest*"
|
|
||||||
- "*test*"
|
|
||||||
update-types:
|
|
||||||
- major
|
|
||||||
schedule:
|
|
||||||
interval: monthly
|
|
194
.github/workflows/release.yml
vendored
@@ -1,7 +1,7 @@
|
|||||||
# This is a GitHub workflow defining a set of jobs with a set of steps.
|
# This is a GitHub workflow defining a set of jobs with a set of steps.
|
||||||
# ref: https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
|
# ref: https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
|
||||||
#
|
#
|
||||||
# Test build release artifacts (PyPI package) and publish them on
|
# Test build release artifacts (PyPI package, Docker images) and publish them on
|
||||||
# pushed git tags.
|
# pushed git tags.
|
||||||
#
|
#
|
||||||
name: Release
|
name: Release
|
||||||
@@ -28,26 +28,21 @@ on:
|
|||||||
- "**"
|
- "**"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-release:
|
build-release:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-python@v6
|
- uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: "3.11"
|
python-version: 3.8
|
||||||
cache: pip
|
|
||||||
|
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: "20"
|
node-version: "14"
|
||||||
|
|
||||||
- name: install build requirements
|
- name: install build package
|
||||||
run: |
|
run: |
|
||||||
npm install -g yarn
|
|
||||||
pip install --upgrade pip
|
pip install --upgrade pip
|
||||||
pip install build
|
pip install build
|
||||||
pip freeze
|
pip freeze
|
||||||
@@ -57,21 +52,28 @@ jobs:
|
|||||||
python -m build --sdist --wheel .
|
python -m build --sdist --wheel .
|
||||||
ls -l dist
|
ls -l dist
|
||||||
|
|
||||||
- name: verify sdist
|
- name: verify wheel
|
||||||
run: |
|
run: |
|
||||||
./ci/check_sdist.py dist/jupyterhub-*.tar.gz
|
cd dist
|
||||||
|
pip install ./*.whl
|
||||||
- name: verify data-files are installed where they are found
|
# verify data-files are installed where they are found
|
||||||
run: |
|
cat <<EOF | python
|
||||||
pip install dist/*.whl
|
import os
|
||||||
./ci/check_installed_data.py
|
from jupyterhub._data import DATA_FILES_PATH
|
||||||
|
print(f"DATA_FILES_PATH={DATA_FILES_PATH}")
|
||||||
- name: verify sdist can be installed without npm/yarn
|
assert os.path.exists(DATA_FILES_PATH), DATA_FILES_PATH
|
||||||
run: |
|
for subpath in (
|
||||||
docker run --rm -v $PWD/dist:/dist:ro docker.io/library/python:3.9-slim-bullseye bash -c 'pip install /dist/jupyterhub-*.tar.gz'
|
"templates/page.html",
|
||||||
|
"static/css/style.min.css",
|
||||||
|
"static/components/jquery/dist/jquery.js",
|
||||||
|
):
|
||||||
|
path = os.path.join(DATA_FILES_PATH, subpath)
|
||||||
|
assert os.path.exists(path), path
|
||||||
|
print("OK")
|
||||||
|
EOF
|
||||||
|
|
||||||
# ref: https://github.com/actions/upload-artifact#readme
|
# ref: https://github.com/actions/upload-artifact#readme
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: jupyterhub-${{ github.sha }}
|
name: jupyterhub-${{ github.sha }}
|
||||||
path: "dist/*"
|
path: "dist/*"
|
||||||
@@ -85,3 +87,145 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
pip install twine
|
pip install twine
|
||||||
twine upload --skip-existing dist/*
|
twine upload --skip-existing dist/*
|
||||||
|
|
||||||
|
publish-docker:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
|
services:
|
||||||
|
# So that we can test this in PRs/branches
|
||||||
|
local-registry:
|
||||||
|
image: registry:2
|
||||||
|
ports:
|
||||||
|
- 5000:5000
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Should we push this image to a public registry?
|
||||||
|
run: |
|
||||||
|
if [ "${{ startsWith(github.ref, 'refs/tags/') || (github.ref == 'refs/heads/main') }}" = "true" ]; then
|
||||||
|
# Empty => Docker Hub
|
||||||
|
echo "REGISTRY=" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "REGISTRY=localhost:5000/" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
# Setup docker to build for multiple platforms, see:
|
||||||
|
# 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@25f0500ff22e406f7191a2a8ba8cda16901ca018 # associated tag: v1.0.2
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx (for multi-arch builds)
|
||||||
|
uses: docker/setup-buildx-action@2a4b53665e15ce7d7049afb11ff1f70ff1610609 # associated tag: v1.1.2
|
||||||
|
with:
|
||||||
|
# Allows pushing to registry on localhost:5000
|
||||||
|
driver-opts: network=host
|
||||||
|
|
||||||
|
- name: Setup push rights to Docker Hub
|
||||||
|
# This was setup by...
|
||||||
|
# 1. Creating a Docker Hub service account "jupyterhubbot"
|
||||||
|
# 2. Creating a access token for the service account specific to this
|
||||||
|
# repository: https://hub.docker.com/settings/security
|
||||||
|
# 3. Making the account part of the "bots" team, and granting that team
|
||||||
|
# permissions to push to the relevant images:
|
||||||
|
# https://hub.docker.com/orgs/jupyterhub/teams/bots/permissions
|
||||||
|
# 4. Registering the username and token as a secret for this repo:
|
||||||
|
# https://github.com/jupyterhub/jupyterhub/settings/secrets/actions
|
||||||
|
if: env.REGISTRY != 'localhost:5000/'
|
||||||
|
run: |
|
||||||
|
docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" -p "${{ secrets.DOCKERHUB_TOKEN }}"
|
||||||
|
|
||||||
|
# image: jupyterhub/jupyterhub
|
||||||
|
#
|
||||||
|
# https://github.com/jupyterhub/action-major-minor-tag-calculator
|
||||||
|
# If this is a tagged build this will return additional parent tags.
|
||||||
|
# E.g. 1.2.3 is expanded to Docker tags
|
||||||
|
# [{prefix}:1.2.3, {prefix}:1.2, {prefix}:1, {prefix}:latest] unless
|
||||||
|
# this is a backported tag in which case the newer tags aren't updated.
|
||||||
|
# For branches this will return the branch name.
|
||||||
|
# If GITHUB_TOKEN isn't available (e.g. in PRs) returns no tags [].
|
||||||
|
- name: Get list of jupyterhub tags
|
||||||
|
id: jupyterhubtags
|
||||||
|
uses: jupyterhub/action-major-minor-tag-calculator@v2
|
||||||
|
with:
|
||||||
|
githubToken: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
prefix: "${{ env.REGISTRY }}jupyterhub/jupyterhub:"
|
||||||
|
defaultTag: "${{ env.REGISTRY }}jupyterhub/jupyterhub:noref"
|
||||||
|
branchRegex: ^\w[\w-.]*$
|
||||||
|
|
||||||
|
- name: Build and push jupyterhub
|
||||||
|
uses: docker/build-push-action@e1b7f96249f2e4c8e4ac1519b9608c0d48944a1f
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
# tags parameter must be a string input so convert `gettags` JSON
|
||||||
|
# array into a comma separated list of tags
|
||||||
|
tags: ${{ join(fromJson(steps.jupyterhubtags.outputs.tags)) }}
|
||||||
|
|
||||||
|
# image: jupyterhub/jupyterhub-onbuild
|
||||||
|
#
|
||||||
|
- name: Get list of jupyterhub-onbuild tags
|
||||||
|
id: onbuildtags
|
||||||
|
uses: jupyterhub/action-major-minor-tag-calculator@v2
|
||||||
|
with:
|
||||||
|
githubToken: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
prefix: "${{ env.REGISTRY }}jupyterhub/jupyterhub-onbuild:"
|
||||||
|
defaultTag: "${{ env.REGISTRY }}jupyterhub/jupyterhub-onbuild:noref"
|
||||||
|
branchRegex: ^\w[\w-.]*$
|
||||||
|
|
||||||
|
- name: Build and push jupyterhub-onbuild
|
||||||
|
uses: docker/build-push-action@e1b7f96249f2e4c8e4ac1519b9608c0d48944a1f
|
||||||
|
with:
|
||||||
|
build-args: |
|
||||||
|
BASE_IMAGE=${{ fromJson(steps.jupyterhubtags.outputs.tags)[0] }}
|
||||||
|
context: onbuild
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: ${{ join(fromJson(steps.onbuildtags.outputs.tags)) }}
|
||||||
|
|
||||||
|
# image: jupyterhub/jupyterhub-demo
|
||||||
|
#
|
||||||
|
- name: Get list of jupyterhub-demo tags
|
||||||
|
id: demotags
|
||||||
|
uses: jupyterhub/action-major-minor-tag-calculator@v2
|
||||||
|
with:
|
||||||
|
githubToken: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
prefix: "${{ env.REGISTRY }}jupyterhub/jupyterhub-demo:"
|
||||||
|
defaultTag: "${{ env.REGISTRY }}jupyterhub/jupyterhub-demo:noref"
|
||||||
|
branchRegex: ^\w[\w-.]*$
|
||||||
|
|
||||||
|
- name: Build and push jupyterhub-demo
|
||||||
|
uses: docker/build-push-action@e1b7f96249f2e4c8e4ac1519b9608c0d48944a1f
|
||||||
|
with:
|
||||||
|
build-args: |
|
||||||
|
BASE_IMAGE=${{ fromJson(steps.onbuildtags.outputs.tags)[0] }}
|
||||||
|
context: demo-image
|
||||||
|
# linux/arm64 currently fails:
|
||||||
|
# ERROR: Could not build wheels for argon2-cffi which use PEP 517 and cannot be installed directly
|
||||||
|
# ERROR: executor failed running [/bin/sh -c python3 -m pip install notebook]: exit code: 1
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: ${{ join(fromJson(steps.demotags.outputs.tags)) }}
|
||||||
|
|
||||||
|
# image: jupyterhub/singleuser
|
||||||
|
#
|
||||||
|
- name: Get list of jupyterhub/singleuser tags
|
||||||
|
id: singleusertags
|
||||||
|
uses: jupyterhub/action-major-minor-tag-calculator@v2
|
||||||
|
with:
|
||||||
|
githubToken: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
prefix: "${{ env.REGISTRY }}jupyterhub/singleuser:"
|
||||||
|
defaultTag: "${{ env.REGISTRY }}jupyterhub/singleuser:noref"
|
||||||
|
branchRegex: ^\w[\w-.]*$
|
||||||
|
|
||||||
|
- name: Build and push jupyterhub/singleuser
|
||||||
|
uses: docker/build-push-action@e1b7f96249f2e4c8e4ac1519b9608c0d48944a1f
|
||||||
|
with:
|
||||||
|
build-args: |
|
||||||
|
JUPYTERHUB_VERSION=${{ github.ref_type == 'tag' && github.ref_name || format('git:{0}', github.sha) }}
|
||||||
|
context: singleuser
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: ${{ join(fromJson(steps.singleusertags.outputs.tags)) }}
|
||||||
|
4
.github/workflows/support-bot.yml
vendored
@@ -12,7 +12,7 @@ jobs:
|
|||||||
action:
|
action:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: dessant/support-requests@v4
|
- uses: dessant/support-requests@v2
|
||||||
with:
|
with:
|
||||||
github-token: ${{ github.token }}
|
github-token: ${{ github.token }}
|
||||||
support-label: "support"
|
support-label: "support"
|
||||||
@@ -25,7 +25,7 @@ jobs:
|
|||||||
|
|
||||||
Our goal is to sustain a positive experience for both users and developers. We use GitHub issues for specific discussions related to changing a repository's content, and let the forum be where we can more generally help and inspire each other.
|
Our goal is to sustain a positive experience for both users and developers. We use GitHub issues for specific discussions related to changing a repository's content, and let the forum be where we can more generally help and inspire each other.
|
||||||
|
|
||||||
Thank you for being an active member of our community! :heart:
|
Thanks you for being an active member of our community! :heart:
|
||||||
close-issue: true
|
close-issue: true
|
||||||
lock-issue: false
|
lock-issue: false
|
||||||
issue-lock-reason: "off-topic"
|
issue-lock-reason: "off-topic"
|
||||||
|
84
.github/workflows/test-docs.yml
vendored
@@ -15,13 +15,15 @@ on:
|
|||||||
- "docs/**"
|
- "docs/**"
|
||||||
- "jupyterhub/_version.py"
|
- "jupyterhub/_version.py"
|
||||||
- "jupyterhub/scopes.py"
|
- "jupyterhub/scopes.py"
|
||||||
- ".github/workflows/test-docs.yml"
|
- ".github/workflows/*"
|
||||||
|
- "!.github/workflows/test-docs.yml"
|
||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
- "docs/**"
|
- "docs/**"
|
||||||
- "jupyterhub/_version.py"
|
- "jupyterhub/_version.py"
|
||||||
- "jupyterhub/scopes.py"
|
- "jupyterhub/scopes.py"
|
||||||
- ".github/workflows/test-docs.yml"
|
- ".github/workflows/*"
|
||||||
|
- "!.github/workflows/test-docs.yml"
|
||||||
branches-ignore:
|
branches-ignore:
|
||||||
- "dependabot/**"
|
- "dependabot/**"
|
||||||
- "pre-commit-ci-update-config"
|
- "pre-commit-ci-update-config"
|
||||||
@@ -29,9 +31,6 @@ on:
|
|||||||
- "**"
|
- "**"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
# UTF-8 content may be interpreted as ascii and causes errors without this.
|
# UTF-8 content may be interpreted as ascii and causes errors without this.
|
||||||
LANG: C.UTF-8
|
LANG: C.UTF-8
|
||||||
@@ -39,82 +38,27 @@ env:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
validate-rest-api-definition:
|
validate-rest-api-definition:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- uses: actions/setup-node@v5
|
|
||||||
with:
|
|
||||||
node-version: "20"
|
|
||||||
cache: npm
|
|
||||||
|
|
||||||
- name: Validate REST API definition
|
- name: Validate REST API definition
|
||||||
run: |
|
uses: char0n/swagger-editor-validate@182d1a5d26ff5c2f4f452c43bd55e2c7d8064003
|
||||||
npx @redocly/cli lint
|
with:
|
||||||
|
definition-file: docs/source/_static/rest-api.yml
|
||||||
|
|
||||||
test-docs:
|
test-docs:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
# make rediraffecheckdiff requires git history to compare current
|
python-version: "3.9"
|
||||||
# commit with the main branch and previous releases.
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- uses: actions/setup-python@v6
|
|
||||||
with:
|
|
||||||
python-version: "3.11"
|
|
||||||
cache: pip
|
|
||||||
cache-dependency-path: |
|
|
||||||
requirements.txt
|
|
||||||
docs/requirements.txt
|
|
||||||
|
|
||||||
- name: Install requirements
|
- name: Install requirements
|
||||||
run: |
|
run: |
|
||||||
pip install -e . -r docs/requirements.txt pytest
|
pip install -r docs/requirements.txt pytest -e .
|
||||||
|
|
||||||
- name: pytest docs/
|
- name: pytest docs/
|
||||||
run: |
|
run: |
|
||||||
pytest docs/
|
pytest docs/
|
||||||
|
|
||||||
# readthedocs doesn't halt on warnings,
|
|
||||||
# so raise any warnings here
|
|
||||||
- name: build docs
|
|
||||||
run: |
|
|
||||||
cd docs
|
|
||||||
make html
|
|
||||||
|
|
||||||
# Output broken and permanently redirected links in a readable format
|
|
||||||
- name: check links
|
|
||||||
uses: manics/action-sphinx-linkcheck-summary@main
|
|
||||||
with:
|
|
||||||
docs-dir: docs
|
|
||||||
build-dir: docs/_build
|
|
||||||
|
|
||||||
# make rediraffecheckdiff compares files for different changesets
|
|
||||||
# these diff targets aren't always available
|
|
||||||
# - compare with base ref (usually 'main', always on 'origin') for pull requests
|
|
||||||
# - only compare with tags when running against jupyterhub/jupyterhub
|
|
||||||
# to avoid errors on forks, which often lack tags
|
|
||||||
- name: check redirects for this PR
|
|
||||||
if: github.event_name == 'pull_request'
|
|
||||||
run: |
|
|
||||||
cd docs
|
|
||||||
export REDIRAFFE_BRANCH=origin/${{ github.base_ref }}
|
|
||||||
make rediraffecheckdiff
|
|
||||||
|
|
||||||
# this should check currently published 'stable' links for redirects
|
|
||||||
- name: check redirects since last release
|
|
||||||
if: github.repository == 'jupyterhub/jupyterhub'
|
|
||||||
run: |
|
|
||||||
cd docs
|
|
||||||
export REDIRAFFE_BRANCH=$(git describe --tags --abbrev=0)
|
|
||||||
make rediraffecheckdiff
|
|
||||||
|
|
||||||
# longer-term redirect check (fixed version) for older links
|
|
||||||
- name: check redirects since 3.0.0
|
|
||||||
if: github.repository == 'jupyterhub/jupyterhub'
|
|
||||||
run: |
|
|
||||||
cd docs
|
|
||||||
export REDIRAFFE_BRANCH=3.0.0
|
|
||||||
make rediraffecheckdiff
|
|
||||||
|
84
.github/workflows/test-jsx.yml
vendored
@@ -19,30 +19,90 @@ on:
|
|||||||
- "**"
|
- "**"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# The ./jsx folder contains React based source code files that are to compile
|
# The ./jsx folder contains React based source code files that are to compile
|
||||||
# to share/jupyterhub/static/js/admin-react.js. The ./jsx folder includes
|
# to share/jupyterhub/static/js/admin-react.js. The ./jsx folder includes
|
||||||
# tests also has tests that this job is meant to run with `npm test`
|
# tests also has tests that this job is meant to run with `yarn test`
|
||||||
# according to the documentation in jsx/README.md.
|
# according to the documentation in jsx/README.md.
|
||||||
test-jsx-admin-react:
|
test-jsx-admin-react:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-20.04
|
||||||
timeout-minutes: 5
|
timeout-minutes: 5
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: "20"
|
node-version: "14"
|
||||||
|
|
||||||
- name: install jsx
|
- name: Install yarn
|
||||||
|
run: |
|
||||||
|
npm install -g yarn
|
||||||
|
|
||||||
|
- name: yarn
|
||||||
run: |
|
run: |
|
||||||
cd jsx
|
cd jsx
|
||||||
npm ci
|
yarn
|
||||||
|
|
||||||
- name: test
|
- name: yarn test
|
||||||
run: |
|
run: |
|
||||||
cd jsx
|
cd jsx
|
||||||
npm test
|
yarn test
|
||||||
|
|
||||||
|
# The ./jsx folder contains React based source files that are to compile to
|
||||||
|
# share/jupyterhub/static/js/admin-react.js. This job makes sure that whatever
|
||||||
|
# we have in jsx/src matches the compiled asset that we package and
|
||||||
|
# distribute.
|
||||||
|
#
|
||||||
|
# This job's purpose is to make sure we don't forget to compile changes and to
|
||||||
|
# verify nobody sneaks in a change in the hard to review compiled asset.
|
||||||
|
#
|
||||||
|
# NOTE: In the future we may want to stop version controlling the compiled
|
||||||
|
# artifact and instead generate it whenever we package JupyterHub. If we
|
||||||
|
# do this, we are required to setup node and compile the source code
|
||||||
|
# more often, at the same time we could avoid having this check be made.
|
||||||
|
#
|
||||||
|
compile-jsx-admin-react:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
timeout-minutes: 5
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: "14"
|
||||||
|
|
||||||
|
- name: Install yarn
|
||||||
|
run: |
|
||||||
|
npm install -g yarn
|
||||||
|
|
||||||
|
- name: yarn
|
||||||
|
run: |
|
||||||
|
cd jsx
|
||||||
|
yarn
|
||||||
|
|
||||||
|
- name: yarn build
|
||||||
|
run: |
|
||||||
|
cd jsx
|
||||||
|
yarn build
|
||||||
|
|
||||||
|
- name: yarn place
|
||||||
|
run: |
|
||||||
|
cd jsx
|
||||||
|
yarn place
|
||||||
|
|
||||||
|
- name: Verify compiled jsx/src matches version controlled artifact
|
||||||
|
run: |
|
||||||
|
if [[ `git status --porcelain=v1` ]]; then
|
||||||
|
echo "The source code in ./jsx compiles to something different than found in ./share/jupyterhub/static/js/admin-react.js!"
|
||||||
|
echo
|
||||||
|
echo "Please re-compile the source code in ./jsx with the following commands:"
|
||||||
|
echo
|
||||||
|
echo "yarn"
|
||||||
|
echo "yarn build"
|
||||||
|
echo "yarn place"
|
||||||
|
echo
|
||||||
|
echo "See ./jsx/README.md for more details."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "Compilation of jsx/src to share/jupyterhub/static/js/admin-react.js didn't lead to changes."
|
||||||
|
fi
|
||||||
|
160
.github/workflows/test.yml
vendored
@@ -28,15 +28,12 @@ on:
|
|||||||
env:
|
env:
|
||||||
# UTF-8 content may be interpreted as ascii and causes errors without this.
|
# UTF-8 content may be interpreted as ascii and causes errors without this.
|
||||||
LANG: C.UTF-8
|
LANG: C.UTF-8
|
||||||
SQLALCHEMY_WARN_20: "1"
|
PYTEST_ADDOPTS: "--verbose --color=yes"
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Run "pytest jupyterhub/tests" in various configurations
|
# Run "pytest jupyterhub/tests" in various configurations
|
||||||
pytest:
|
pytest:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-20.04
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
@@ -56,57 +53,36 @@ jobs:
|
|||||||
# Tests everything when JupyterHub works against a dedicated mysql or
|
# Tests everything when JupyterHub works against a dedicated mysql or
|
||||||
# postgresql server.
|
# postgresql server.
|
||||||
#
|
#
|
||||||
# legacy_notebook:
|
# nbclassic:
|
||||||
# Tests everything when the user instances are started with
|
# Tests everything when the user instances are started with
|
||||||
# the legacy notebook server instead of jupyter_server.
|
# notebook instead of jupyter_server.
|
||||||
#
|
#
|
||||||
# ssl:
|
# ssl:
|
||||||
# Tests everything using internal SSL connections instead of
|
# Tests everything using internal SSL connections instead of
|
||||||
# unencrypted HTTP
|
# unencrypted HTTP
|
||||||
#
|
#
|
||||||
# main_dependencies:
|
# main_dependencies:
|
||||||
# Tests everything when we use the latest available dependencies
|
# Tests everything when the we use the latest available dependencies
|
||||||
# from: traitlets.
|
# from: traitlets.
|
||||||
#
|
#
|
||||||
# NOTE: Since only the value of these parameters are presented in the
|
# NOTE: Since only the value of these parameters are presented in the
|
||||||
# GitHub UI when the workflow run, we avoid using true/false as
|
# GitHub UI when the workflow run, we avoid using true/false as
|
||||||
# values by instead duplicating the name to signal true.
|
# 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:
|
include:
|
||||||
- python: "3.8"
|
- python: "3.6"
|
||||||
oldest_dependencies: oldest_dependencies
|
oldest_dependencies: oldest_dependencies
|
||||||
legacy_notebook: legacy_notebook
|
nbclassic: nbclassic
|
||||||
- python: "3.8"
|
- python: "3.6"
|
||||||
jupyter_server: "1.*"
|
subdomain: subdomain
|
||||||
subset: singleuser
|
- python: "3.7"
|
||||||
- python: "3.9"
|
|
||||||
db: mysql
|
db: mysql
|
||||||
- python: "3.10"
|
- python: "3.7"
|
||||||
|
ssl: ssl
|
||||||
|
- python: "3.8"
|
||||||
db: postgres
|
db: postgres
|
||||||
- python: "3.12"
|
- python: "3.8"
|
||||||
subdomain: subdomain
|
nbclassic: nbclassic
|
||||||
serverextension: serverextension
|
- python: "3.9"
|
||||||
- python: "3.11"
|
|
||||||
ssl: ssl
|
|
||||||
serverextension: serverextension
|
|
||||||
- python: "3.11"
|
|
||||||
jupyverse: jupyverse
|
|
||||||
subset: singleuser
|
|
||||||
- python: "3.11"
|
|
||||||
subdomain: subdomain
|
|
||||||
noextension: noextension
|
|
||||||
subset: singleuser
|
|
||||||
- python: "3.11"
|
|
||||||
ssl: ssl
|
|
||||||
noextension: noextension
|
|
||||||
subset: singleuser
|
|
||||||
- python: "3.11"
|
|
||||||
browser: browser
|
|
||||||
- python: "3.11"
|
|
||||||
subdomain: subdomain
|
|
||||||
browser: browser
|
|
||||||
- python: "3.12"
|
|
||||||
main_dependencies: main_dependencies
|
main_dependencies: main_dependencies
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -120,7 +96,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
if [ "${{ matrix.db }}" == "mysql" ]; then
|
if [ "${{ matrix.db }}" == "mysql" ]; then
|
||||||
echo "MYSQL_HOST=127.0.0.1" >> $GITHUB_ENV
|
echo "MYSQL_HOST=127.0.0.1" >> $GITHUB_ENV
|
||||||
echo "JUPYTERHUB_TEST_DB_URL=mysql+mysqldb://root@127.0.0.1:3306/jupyterhub" >> $GITHUB_ENV
|
echo "JUPYTERHUB_TEST_DB_URL=mysql+mysqlconnector://root@127.0.0.1:3306/jupyterhub" >> $GITHUB_ENV
|
||||||
fi
|
fi
|
||||||
if [ "${{ matrix.ssl }}" == "ssl" ]; then
|
if [ "${{ matrix.ssl }}" == "ssl" ]; then
|
||||||
echo "SSL_ENABLED=1" >> $GITHUB_ENV
|
echo "SSL_ENABLED=1" >> $GITHUB_ENV
|
||||||
@@ -131,77 +107,54 @@ jobs:
|
|||||||
echo "PGPASSWORD=hub[test/:?" >> $GITHUB_ENV
|
echo "PGPASSWORD=hub[test/:?" >> $GITHUB_ENV
|
||||||
echo "JUPYTERHUB_TEST_DB_URL=postgresql://test_user:hub%5Btest%2F%3A%3F@127.0.0.1:5432/jupyterhub" >> $GITHUB_ENV
|
echo "JUPYTERHUB_TEST_DB_URL=postgresql://test_user:hub%5Btest%2F%3A%3F@127.0.0.1:5432/jupyterhub" >> $GITHUB_ENV
|
||||||
fi
|
fi
|
||||||
if [ "${{ matrix.serverextension }}" != "" ]; then
|
if [ "${{ matrix.jupyter_server }}" != "" ]; then
|
||||||
echo "JUPYTERHUB_SINGLEUSER_EXTENSION=1" >> $GITHUB_ENV
|
echo "JUPYTERHUB_SINGLEUSER_APP=jupyterhub.tests.mockserverapp.MockServerApp" >> $GITHUB_ENV
|
||||||
elif [ "${{ matrix.noextension }}" != "" ]; then
|
|
||||||
echo "JUPYTERHUB_SINGLEUSER_EXTENSION=0" >> $GITHUB_ENV
|
|
||||||
fi
|
fi
|
||||||
if [ "${{ matrix.jupyverse }}" != "" ]; then
|
- uses: actions/checkout@v2
|
||||||
echo "JUPYTERHUB_SINGLEUSER_APP=jupyverse" >> $GITHUB_ENV
|
# NOTE: actions/setup-node@v1 make use of a cache within the GitHub base
|
||||||
fi
|
|
||||||
- uses: actions/checkout@v5
|
|
||||||
# NOTE: actions/setup-node@v5 make use of a cache within the GitHub base
|
|
||||||
# environment and setup in a fraction of a second.
|
# environment and setup in a fraction of a second.
|
||||||
- name: Install Node
|
- name: Install Node v14
|
||||||
uses: actions/setup-node@v5
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: "20"
|
node-version: "14"
|
||||||
- name: Install Javascript dependencies
|
- name: Install Node dependencies
|
||||||
run: |
|
run: |
|
||||||
npm install
|
npm install
|
||||||
npm install -g configurable-http-proxy yarn
|
npm install -g configurable-http-proxy
|
||||||
npm list
|
npm list
|
||||||
|
|
||||||
# NOTE: actions/setup-python@v6 make use of a cache within the GitHub base
|
# NOTE: actions/setup-python@v2 make use of a cache within the GitHub base
|
||||||
# environment and setup in a fraction of a second.
|
# environment and setup in a fraction of a second.
|
||||||
- name: Install Python ${{ matrix.python }}
|
- name: Install Python ${{ matrix.python }}
|
||||||
uses: actions/setup-python@v6
|
uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: "${{ matrix.python }}"
|
python-version: ${{ matrix.python }}
|
||||||
cache: pip
|
|
||||||
cache-dependency-path: |
|
|
||||||
pyproject.toml
|
|
||||||
requirements.txt
|
|
||||||
ci/oldest-dependencies/requirements.old
|
|
||||||
|
|
||||||
- name: Install Python dependencies
|
- name: Install Python dependencies
|
||||||
run: |
|
run: |
|
||||||
pip install --upgrade pip
|
pip install --upgrade pip
|
||||||
|
pip install --upgrade . -r dev-requirements.txt
|
||||||
|
|
||||||
if [ "${{ matrix.oldest_dependencies }}" != "" ]; then
|
if [ "${{ matrix.oldest_dependencies }}" != "" ]; then
|
||||||
# frozen env with oldest dependencies
|
# take any dependencies in requirements.txt such as tornado>=5.0
|
||||||
# make sure our `>=` pins really do express our minimum supported versions
|
# and transform them to tornado==5.0 so we can run tests with
|
||||||
pip install -r ci/oldest-dependencies/requirements.old -e .
|
# the earliest-supported versions
|
||||||
else
|
cat requirements.txt | grep '>=' | sed -e 's@>=@==@g' > oldest-requirements.txt
|
||||||
pip install --pre -e ".[test]" "pycurl; python_version >= '3.10'"
|
pip install -r oldest-requirements.txt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${{ matrix.main_dependencies }}" != "" ]; then
|
if [ "${{ matrix.main_dependencies }}" != "" ]; then
|
||||||
# Tests are broken:
|
pip install git+https://github.com/ipython/traitlets#egg=traitlets --force
|
||||||
# https://github.com/jupyterhub/jupyterhub/issues/4418
|
|
||||||
# pip install git+https://github.com/ipython/traitlets#egg=traitlets --force
|
|
||||||
pip install --upgrade --pre sqlalchemy
|
|
||||||
fi
|
fi
|
||||||
if [ "${{ matrix.legacy_notebook }}" != "" ]; then
|
if [ "${{ matrix.nbclassic }}" != "" ]; then
|
||||||
pip uninstall jupyter_server --yes
|
pip uninstall jupyter_server --yes
|
||||||
pip install 'notebook<7'
|
pip install notebook
|
||||||
fi
|
|
||||||
if [ "${{ matrix.jupyter_server }}" != "" ]; then
|
|
||||||
pip install "jupyter_server==${{ matrix.jupyter_server }}"
|
|
||||||
fi
|
|
||||||
if [ "${{ matrix.jupyverse }}" != "" ]; then
|
|
||||||
pip install "jupyverse[jupyterlab,auth-jupyterhub]"
|
|
||||||
pip install -e .
|
|
||||||
fi
|
fi
|
||||||
if [ "${{ matrix.db }}" == "mysql" ]; then
|
if [ "${{ matrix.db }}" == "mysql" ]; then
|
||||||
pip install mysqlclient
|
pip install mysql-connector-python
|
||||||
fi
|
fi
|
||||||
if [ "${{ matrix.db }}" == "postgres" ]; then
|
if [ "${{ matrix.db }}" == "postgres" ]; then
|
||||||
pip install psycopg2-binary
|
pip install psycopg2-binary
|
||||||
fi
|
fi
|
||||||
if [ "${{ matrix.serverextension }}" != "" ]; then
|
|
||||||
pip install 'jupyter-server>=2'
|
|
||||||
fi
|
|
||||||
|
|
||||||
pip freeze
|
pip freeze
|
||||||
|
|
||||||
@@ -246,16 +199,31 @@ jobs:
|
|||||||
DB=postgres bash ci/init-db.sh
|
DB=postgres bash ci/init-db.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Configure browser tests
|
|
||||||
if: matrix.browser
|
|
||||||
run: echo "PYTEST_ADDOPTS=$PYTEST_ADDOPTS -m browser" >> "${GITHUB_ENV}"
|
|
||||||
|
|
||||||
- name: Ensure browsers are installed for playwright
|
|
||||||
if: matrix.browser
|
|
||||||
run: python -m playwright install --with-deps firefox
|
|
||||||
|
|
||||||
- name: Run pytest
|
- name: Run pytest
|
||||||
run: |
|
run: |
|
||||||
pytest -k "${{ matrix.subset }}" --maxfail=2 --cov=jupyterhub jupyterhub/tests
|
pytest --maxfail=2 --cov=jupyterhub jupyterhub/tests
|
||||||
|
- name: Submit codecov report
|
||||||
|
run: |
|
||||||
|
codecov
|
||||||
|
|
||||||
- uses: codecov/codecov-action@v5
|
docker-build:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
timeout-minutes: 20
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: build images
|
||||||
|
run: |
|
||||||
|
docker build -t jupyterhub/jupyterhub .
|
||||||
|
docker build -t jupyterhub/jupyterhub-onbuild onbuild
|
||||||
|
docker build -t jupyterhub/jupyterhub:alpine -f dockerfiles/Dockerfile.alpine .
|
||||||
|
docker build -t jupyterhub/singleuser singleuser
|
||||||
|
|
||||||
|
- name: smoke test jupyterhub
|
||||||
|
run: |
|
||||||
|
docker run --rm -t jupyterhub/jupyterhub jupyterhub --help
|
||||||
|
|
||||||
|
- name: verify static files
|
||||||
|
run: |
|
||||||
|
docker run --rm -t -v $PWD/dockerfiles:/io jupyterhub/jupyterhub python3 /io/test.py
|
||||||
|
14
.gitignore
vendored
@@ -7,24 +7,18 @@ node_modules
|
|||||||
dist
|
dist
|
||||||
docs/_build
|
docs/_build
|
||||||
docs/build
|
docs/build
|
||||||
docs/source/reference/metrics.md
|
docs/source/_static/rest-api
|
||||||
|
docs/source/rbac/scope-table.md
|
||||||
.ipynb_checkpoints
|
.ipynb_checkpoints
|
||||||
.virtual_documents
|
|
||||||
|
|
||||||
jsx/build/
|
|
||||||
# ignore config file at the top-level of the repo
|
# ignore config file at the top-level of the repo
|
||||||
# but not sub-dirs
|
# but not sub-dirs
|
||||||
/jupyterhub_config.py
|
/jupyterhub_config.py
|
||||||
jupyterhub_cookie_secret
|
jupyterhub_cookie_secret
|
||||||
jupyterhub.sqlite
|
jupyterhub.sqlite
|
||||||
jupyterhub.sqlite*
|
package-lock.json
|
||||||
share/jupyterhub/static/components
|
share/jupyterhub/static/components
|
||||||
share/jupyterhub/static/css/style.css
|
|
||||||
share/jupyterhub/static/css/style.css.map
|
|
||||||
share/jupyterhub/static/css/style.min.css
|
share/jupyterhub/static/css/style.min.css
|
||||||
share/jupyterhub/static/css/style.min.css.map
|
share/jupyterhub/static/css/style.min.css.map
|
||||||
share/jupyterhub/static/js/admin-react.js*
|
|
||||||
*.egg-info
|
*.egg-info
|
||||||
MANIFEST
|
MANIFEST
|
||||||
.coverage
|
.coverage
|
||||||
@@ -38,5 +32,3 @@ docs/source/reference/metrics.rst
|
|||||||
oldest-requirements.txt
|
oldest-requirements.txt
|
||||||
jupyterhub-proxy.pid
|
jupyterhub-proxy.pid
|
||||||
examples/server-api/service-token
|
examples/server-api/service-token
|
||||||
|
|
||||||
*.hot-update*
|
|
||||||
|
@@ -8,48 +8,36 @@
|
|||||||
# - Run on all files: pre-commit run --all-files
|
# - Run on all files: pre-commit run --all-files
|
||||||
# - Register git hooks: pre-commit install --install-hooks
|
# - Register git hooks: pre-commit install --install-hooks
|
||||||
#
|
#
|
||||||
|
|
||||||
ci:
|
|
||||||
# pre-commit.ci will open PRs updating our hooks once a month
|
|
||||||
autoupdate_schedule: monthly
|
|
||||||
|
|
||||||
repos:
|
repos:
|
||||||
# autoformat and lint Python code
|
# Autoformat: Python code, syntax patterns are modernized
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/asottile/pyupgrade
|
||||||
rev: v0.12.11
|
rev: v2.32.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: pyupgrade
|
||||||
types_or:
|
args:
|
||||||
- python
|
- --py36-plus
|
||||||
- jupyter
|
|
||||||
args: ["--fix", "--show-fixes"]
|
# Autoformat: Python code
|
||||||
- id: ruff-format
|
- repo: https://github.com/asottile/reorder_python_imports
|
||||||
types_or:
|
rev: v3.1.0
|
||||||
- python
|
hooks:
|
||||||
- jupyter
|
- id: reorder-python-imports
|
||||||
|
|
||||||
|
# Autoformat: Python code
|
||||||
|
- repo: https://github.com/psf/black
|
||||||
|
rev: 22.3.0
|
||||||
|
hooks:
|
||||||
|
- id: black
|
||||||
|
|
||||||
# Autoformat: markdown, yaml, javascript (see the file .prettierignore)
|
# Autoformat: markdown, yaml, javascript (see the file .prettierignore)
|
||||||
- repo: https://github.com/rbubley/mirrors-prettier
|
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||||
rev: v3.6.2
|
rev: v2.6.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: prettier
|
- id: prettier
|
||||||
exclude: .*/templates/.*|docs/source/_static/rest-api.yml|docs/source/rbac/scope-table.md
|
|
||||||
|
|
||||||
# autoformat HTML templates
|
|
||||||
- repo: https://github.com/djlint/djLint
|
|
||||||
rev: v1.36.4
|
|
||||||
hooks:
|
|
||||||
- id: djlint-reformat-jinja
|
|
||||||
files: ".*templates/.*.html"
|
|
||||||
types_or: ["html"]
|
|
||||||
exclude: redoc.html
|
|
||||||
- id: djlint-jinja
|
|
||||||
files: ".*templates/.*.html"
|
|
||||||
types_or: ["html"]
|
|
||||||
|
|
||||||
# Autoformat and linting, misc. details
|
# Autoformat and linting, misc. details
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v6.0.0
|
rev: v4.2.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: end-of-file-fixer
|
- id: end-of-file-fixer
|
||||||
exclude: share/jupyterhub/static/js/admin-react.js
|
exclude: share/jupyterhub/static/js/admin-react.js
|
||||||
@@ -57,30 +45,8 @@ repos:
|
|||||||
- id: check-case-conflict
|
- id: check-case-conflict
|
||||||
- id: check-executables-have-shebangs
|
- id: check-executables-have-shebangs
|
||||||
|
|
||||||
# source docs: rest-api.yml and scope-table.md are autogenerated
|
# Linting: Python code (see the file .flake8)
|
||||||
- repo: local
|
- repo: https://github.com/PyCQA/flake8
|
||||||
|
rev: "4.0.1"
|
||||||
hooks:
|
hooks:
|
||||||
- id: update-api-and-scope-docs
|
- id: flake8
|
||||||
name: Update rest-api.yml and scope-table.md based on scopes.py
|
|
||||||
language: python
|
|
||||||
additional_dependencies: ["pytablewriter", "ruamel.yaml"]
|
|
||||||
entry: python docs/source/rbac/generate-scope-table.py
|
|
||||||
args:
|
|
||||||
- --update
|
|
||||||
files: jupyterhub/scopes.py
|
|
||||||
pass_filenames: false
|
|
||||||
|
|
||||||
# run eslint in the jsx directory
|
|
||||||
# need to pass through 'jsx:install-run' hook in
|
|
||||||
# top-level package.json to ensure dependencies are installed
|
|
||||||
# eslint pre-commit hook doesn't really work with eslint 9,
|
|
||||||
# so use `npm run lint:fix`
|
|
||||||
- id: jsx-eslint
|
|
||||||
name: eslint in jsx/
|
|
||||||
entry: npm run jsx:install-run lint:fix
|
|
||||||
pass_filenames: false
|
|
||||||
language: node
|
|
||||||
files: "jsx/.*"
|
|
||||||
# can't run on pre-commit; hangs, for some reason
|
|
||||||
stages:
|
|
||||||
- manual
|
|
||||||
|
@@ -1,4 +1,2 @@
|
|||||||
share/jupyterhub/templates/
|
share/jupyterhub/templates/
|
||||||
share/jupyterhub/static/js/admin-react.js
|
share/jupyterhub/static/js/admin-react.js
|
||||||
jupyterhub/singleuser/templates/
|
|
||||||
docs/source/_templates/
|
|
||||||
|
@@ -1,25 +1,20 @@
|
|||||||
# 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
|
version: 2
|
||||||
|
|
||||||
sphinx:
|
sphinx:
|
||||||
configuration: docs/source/conf.py
|
configuration: docs/source/conf.py
|
||||||
|
|
||||||
build:
|
build:
|
||||||
os: ubuntu-24.04
|
os: ubuntu-20.04
|
||||||
tools:
|
tools:
|
||||||
python: "3.13"
|
nodejs: "16"
|
||||||
|
python: "3.9"
|
||||||
|
|
||||||
python:
|
python:
|
||||||
install:
|
install:
|
||||||
- path: .
|
- method: pip
|
||||||
|
path: .
|
||||||
- requirements: docs/requirements.txt
|
- requirements: docs/requirements.txt
|
||||||
|
|
||||||
formats:
|
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
|
- htmlzip
|
||||||
|
- epub
|
||||||
|
145
CONTRIBUTING.md
@@ -6,35 +6,134 @@ you can follow the [Jupyter contributor guide](https://jupyter.readthedocs.io/en
|
|||||||
Make sure to also follow [Project Jupyter's Code of Conduct](https://github.com/jupyter/governance/blob/HEAD/conduct/code_of_conduct.md)
|
Make sure to also follow [Project Jupyter's Code of Conduct](https://github.com/jupyter/governance/blob/HEAD/conduct/code_of_conduct.md)
|
||||||
for a friendly and welcoming collaborative environment.
|
for a friendly and welcoming collaborative environment.
|
||||||
|
|
||||||
Please see our documentation on
|
## Setting up a development environment
|
||||||
|
|
||||||
- [Setting up a development install](https://jupyterhub.readthedocs.io/en/latest/contributing/setup.html)
|
<!--
|
||||||
- [Testing JupyterHub and linting code](https://jupyterhub.readthedocs.io/en/latest/contributing/tests.html)
|
https://jupyterhub.readthedocs.io/en/stable/contributing/setup.html
|
||||||
|
contains a lot of the same information. Should we merge the docs and
|
||||||
|
just have this page link to that one?
|
||||||
|
-->
|
||||||
|
|
||||||
If you need some help, feel free to ask on [Gitter](https://gitter.im/jupyterhub/jupyterhub) or [Discourse](https://discourse.jupyter.org/).
|
JupyterHub requires Python >= 3.5 and nodejs.
|
||||||
|
|
||||||
## Our Copyright Policy
|
As a Python project, a development install of JupyterHub follows standard practices for the basics (steps 1-2).
|
||||||
|
|
||||||
Jupyter uses a shared copyright model. Each contributor maintains copyright
|
1. clone the repo
|
||||||
over their contributions to Jupyter. But, it is important to note that these
|
```bash
|
||||||
contributions are typically only changes to the repositories. Thus, the Jupyter
|
git clone https://github.com/jupyterhub/jupyterhub
|
||||||
source code, in its entirety is not the copyright of any single person or
|
```
|
||||||
institution. Instead, it is the collective copyright of the entire Jupyter
|
2. do a development install with pip
|
||||||
Development Team. If individual contributors want to maintain a record of what
|
|
||||||
changes/contributions they have specific copyright on, they should indicate
|
|
||||||
their copyright in the commit message of the change, when they commit the
|
|
||||||
change to one of the Jupyter repositories.
|
|
||||||
|
|
||||||
With this in mind, the following banner should be used in any source code file
|
```bash
|
||||||
to indicate the copyright and license terms:
|
cd jupyterhub
|
||||||
|
python3 -m pip install --editable .
|
||||||
|
```
|
||||||
|
|
||||||
# Copyright (c) Jupyter Development Team.
|
3. install the development requirements,
|
||||||
# Distributed under the terms of the Modified BSD License.
|
which include things like testing tools
|
||||||
|
|
||||||
### About the Jupyter Development Team
|
```bash
|
||||||
|
python3 -m pip install -r dev-requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
The Jupyter Development Team is the set of all contributors to the Jupyter project.
|
4. install configurable-http-proxy with npm:
|
||||||
This includes all of the Jupyter subprojects.
|
|
||||||
|
|
||||||
The team that coordinates JupyterHub subproject can be found here:
|
```bash
|
||||||
https://compass.hub.jupyter.org/page/governance.html
|
npm install -g configurable-http-proxy
|
||||||
|
```
|
||||||
|
|
||||||
|
5. set up pre-commit hooks for automatic code formatting, etc.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pre-commit install
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also invoke the pre-commit hook manually at any time with
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pre-commit run
|
||||||
|
```
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
JupyterHub has adopted automatic code formatting so you shouldn't
|
||||||
|
need to worry too much about your code style.
|
||||||
|
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:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
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 setting up the pre-commit
|
||||||
|
hook with `pre-commit install`, you can fix everything up using
|
||||||
|
`pre-commit run --all-files`. You need to make the fixing commit
|
||||||
|
yourself after that.
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
It's a good idea to write tests to exercise any new features,
|
||||||
|
or that trigger any bugs that you have fixed to catch regressions.
|
||||||
|
|
||||||
|
You can run the tests with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pytest -v
|
||||||
|
```
|
||||||
|
|
||||||
|
in the repo directory. If you want to just run certain tests,
|
||||||
|
check out the [pytest docs](https://pytest.readthedocs.io/en/latest/usage.html)
|
||||||
|
for how pytest can be called.
|
||||||
|
For instance, to test only spawner-related things in the REST API:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pytest -v -k spawn jupyterhub/tests/test_api.py
|
||||||
|
```
|
||||||
|
|
||||||
|
The tests live in `jupyterhub/tests` and are organized roughly into:
|
||||||
|
|
||||||
|
1. `test_api.py` tests the REST API
|
||||||
|
2. `test_pages.py` tests loading the HTML pages
|
||||||
|
|
||||||
|
and other collections of tests for different components.
|
||||||
|
When writing a new test, there should usually be a test of
|
||||||
|
similar functionality already written and related tests should
|
||||||
|
be added nearby.
|
||||||
|
|
||||||
|
The fixtures live in `jupyterhub/tests/conftest.py`. There are
|
||||||
|
fixtures that can be used for JupyterHub components, such as:
|
||||||
|
|
||||||
|
- `app`: an instance of JupyterHub with mocked parts
|
||||||
|
- `auth_state_enabled`: enables persisting auth_state (like authentication tokens)
|
||||||
|
- `db`: a sqlite in-memory DB session
|
||||||
|
- `io_loop`: a Tornado event loop
|
||||||
|
- `event_loop`: a new asyncio event loop
|
||||||
|
- `user`: creates a new temporary user
|
||||||
|
- `admin_user`: creates a new temporary admin user
|
||||||
|
- single user servers
|
||||||
|
- `cleanup_after`: allows cleanup of single user servers between tests
|
||||||
|
- mocked service
|
||||||
|
- `MockServiceSpawner`: a spawner that mocks services for testing with a short poll interval
|
||||||
|
- `mockservice`: mocked service with no external service url
|
||||||
|
- `mockservice_url`: mocked service with a url to test external services
|
||||||
|
|
||||||
|
And fixtures to add functionality or spawning behavior:
|
||||||
|
|
||||||
|
- `admin_access`: grants admin access
|
||||||
|
- `no_patience`: sets slow-spawning timeouts to zero
|
||||||
|
- `slow_spawn`: enables the SlowSpawner (a spawner that takes a few seconds to start)
|
||||||
|
- `never_spawn`: enables the NeverSpawner (a spawner that will never start)
|
||||||
|
- `bad_spawn`: enables the BadSpawner (a spawner that fails immediately)
|
||||||
|
- `slow_bad_spawn`: enables the SlowBadSpawner (a spawner that fails after a short delay)
|
||||||
|
|
||||||
|
To read more about fixtures check out the
|
||||||
|
[pytest docs](https://docs.pytest.org/en/latest/fixture.html)
|
||||||
|
for how to use the existing fixtures, and how to create new ones.
|
||||||
|
|
||||||
|
When in doubt, feel free to [ask](https://gitter.im/jupyterhub/jupyterhub).
|
||||||
|
59
COPYING.md
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
# The Jupyter multi-user notebook server licensing terms
|
||||||
|
|
||||||
|
Jupyter multi-user notebook server is licensed under the terms of the Modified BSD License
|
||||||
|
(also known as New or Revised or 3-Clause BSD), as follows:
|
||||||
|
|
||||||
|
- Copyright (c) 2014-, Jupyter Development Team
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer in the documentation and/or
|
||||||
|
other materials provided with the distribution.
|
||||||
|
|
||||||
|
Neither the name of the Jupyter Development Team nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from this
|
||||||
|
software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
## About the Jupyter Development Team
|
||||||
|
|
||||||
|
The Jupyter Development Team is the set of all contributors to the Jupyter project.
|
||||||
|
This includes all of the Jupyter subprojects.
|
||||||
|
|
||||||
|
The core team that coordinates development on GitHub can be found here:
|
||||||
|
https://github.com/jupyter/.
|
||||||
|
|
||||||
|
## Our Copyright Policy
|
||||||
|
|
||||||
|
Jupyter uses a shared copyright model. Each contributor maintains copyright
|
||||||
|
over their contributions to Jupyter. But, it is important to note that these
|
||||||
|
contributions are typically only changes to the repositories. Thus, the Jupyter
|
||||||
|
source code, in its entirety is not the copyright of any single person or
|
||||||
|
institution. Instead, it is the collective copyright of the entire Jupyter
|
||||||
|
Development Team. If individual contributors want to maintain a record of what
|
||||||
|
changes/contributions they have specific copyright on, they should indicate
|
||||||
|
their copyright in the commit message of the change, when they commit the
|
||||||
|
change to one of the Jupyter repositories.
|
||||||
|
|
||||||
|
With this in mind, the following banner should be used in any source code file
|
||||||
|
to indicate the copyright and license terms:
|
||||||
|
|
||||||
|
# Copyright (c) Jupyter Development Team.
|
||||||
|
# Distributed under the terms of the Modified BSD License.
|
101
Dockerfile
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
# An incomplete base Docker image for running JupyterHub
|
||||||
|
#
|
||||||
|
# Add your configuration to create a complete derivative Docker image.
|
||||||
|
#
|
||||||
|
# Include your configuration settings by starting with one of two options:
|
||||||
|
#
|
||||||
|
# Option 1:
|
||||||
|
#
|
||||||
|
# FROM jupyterhub/jupyterhub:latest
|
||||||
|
#
|
||||||
|
# And put your configuration file jupyterhub_config.py in /srv/jupyterhub/jupyterhub_config.py.
|
||||||
|
#
|
||||||
|
# Option 2:
|
||||||
|
#
|
||||||
|
# Or you can create your jupyterhub config and database on the host machine, and mount it with:
|
||||||
|
#
|
||||||
|
# docker run -v $PWD:/srv/jupyterhub -t jupyterhub/jupyterhub
|
||||||
|
#
|
||||||
|
# NOTE
|
||||||
|
# If you base on jupyterhub/jupyterhub-onbuild
|
||||||
|
# your jupyterhub_config.py will be added automatically
|
||||||
|
# from your docker directory.
|
||||||
|
|
||||||
|
ARG BASE_IMAGE=ubuntu:focal-20200729
|
||||||
|
FROM $BASE_IMAGE AS builder
|
||||||
|
|
||||||
|
USER root
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -yq --no-install-recommends \
|
||||||
|
build-essential \
|
||||||
|
ca-certificates \
|
||||||
|
locales \
|
||||||
|
python3-dev \
|
||||||
|
python3-pip \
|
||||||
|
python3-pycurl \
|
||||||
|
nodejs \
|
||||||
|
npm \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN python3 -m pip install --upgrade setuptools pip wheel
|
||||||
|
|
||||||
|
# copy everything except whats in .dockerignore, its a
|
||||||
|
# compromise between needing to rebuild and maintaining
|
||||||
|
# what needs to be part of the build
|
||||||
|
COPY . /src/jupyterhub/
|
||||||
|
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 pip wheel --wheel-dir wheelhouse dist/*.whl
|
||||||
|
|
||||||
|
|
||||||
|
FROM $BASE_IMAGE
|
||||||
|
|
||||||
|
USER root
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -yq --no-install-recommends \
|
||||||
|
ca-certificates \
|
||||||
|
curl \
|
||||||
|
gnupg \
|
||||||
|
locales \
|
||||||
|
python3-pip \
|
||||||
|
python3-pycurl \
|
||||||
|
nodejs \
|
||||||
|
npm \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
ENV SHELL=/bin/bash \
|
||||||
|
LC_ALL=en_US.UTF-8 \
|
||||||
|
LANG=en_US.UTF-8 \
|
||||||
|
LANGUAGE=en_US.UTF-8
|
||||||
|
|
||||||
|
RUN locale-gen $LC_ALL
|
||||||
|
|
||||||
|
# always make sure pip is up to date!
|
||||||
|
RUN python3 -m pip install --no-cache --upgrade setuptools pip
|
||||||
|
|
||||||
|
RUN npm install -g configurable-http-proxy@^4.2.0 \
|
||||||
|
&& rm -rf ~/.npm
|
||||||
|
|
||||||
|
# install the wheels we built in the first stage
|
||||||
|
COPY --from=builder /src/jupyterhub/wheelhouse /tmp/wheelhouse
|
||||||
|
RUN python3 -m pip install --no-cache /tmp/wheelhouse/*
|
||||||
|
|
||||||
|
RUN mkdir -p /srv/jupyterhub/
|
||||||
|
WORKDIR /srv/jupyterhub/
|
||||||
|
|
||||||
|
EXPOSE 8000
|
||||||
|
|
||||||
|
LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>"
|
||||||
|
LABEL org.jupyter.service="jupyterhub"
|
||||||
|
|
||||||
|
CMD ["jupyterhub"]
|
11
LICENSE
@@ -1,11 +0,0 @@
|
|||||||
Copyright 2014-, Jupyter Development Team
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
31
MANIFEST.in
@@ -1,13 +1,24 @@
|
|||||||
# using setuptools-scm means we only need to handle _non-tracked files here_
|
include README.md
|
||||||
|
include COPYING.md
|
||||||
|
include setupegg.py
|
||||||
|
include bower-lite
|
||||||
|
include package.json
|
||||||
include package-lock.json
|
include package-lock.json
|
||||||
|
include *requirements.txt
|
||||||
|
include Dockerfile
|
||||||
|
|
||||||
# include untracked js/css artifacts, components
|
graft onbuild
|
||||||
|
graft jupyterhub
|
||||||
|
graft scripts
|
||||||
graft share
|
graft share
|
||||||
|
graft singleuser
|
||||||
|
graft ci
|
||||||
|
|
||||||
# prune some large unused files from components.
|
# Documentation
|
||||||
# these patterns affect source distributions (sdists)
|
graft docs
|
||||||
# we have stricter exclusions from installation in setup.py:get_data_files
|
prune docs/node_modules
|
||||||
|
|
||||||
|
# prune some large unused files from components
|
||||||
prune share/jupyterhub/static/components/bootstrap/dist/css
|
prune share/jupyterhub/static/components/bootstrap/dist/css
|
||||||
exclude share/jupyterhub/static/components/bootstrap/dist/fonts/*.svg
|
exclude share/jupyterhub/static/components/bootstrap/dist/fonts/*.svg
|
||||||
prune share/jupyterhub/static/components/font-awesome/css
|
prune share/jupyterhub/static/components/font-awesome/css
|
||||||
@@ -17,3 +28,11 @@ prune share/jupyterhub/static/components/jquery/external
|
|||||||
prune share/jupyterhub/static/components/jquery/src
|
prune share/jupyterhub/static/components/jquery/src
|
||||||
prune share/jupyterhub/static/components/moment/lang
|
prune share/jupyterhub/static/components/moment/lang
|
||||||
prune share/jupyterhub/static/components/moment/min
|
prune share/jupyterhub/static/components/moment/min
|
||||||
|
|
||||||
|
# Patterns to exclude from any directory
|
||||||
|
global-exclude *~
|
||||||
|
global-exclude *.pyc
|
||||||
|
global-exclude *.pyo
|
||||||
|
global-exclude .git
|
||||||
|
global-exclude .ipynb_checkpoints
|
||||||
|
global-exclude .bower.json
|
||||||
|
31
README.md
@@ -8,12 +8,22 @@
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
Please note that this repository is participating in a study into the sustainability of open source projects. Data will be gathered about this repository for approximately the next 12 months, starting from 2021-06-11.
|
||||||
|
|
||||||
|
Data collected will include the number of contributors, number of PRs, time taken to close/merge these PRs, and issues closed.
|
||||||
|
|
||||||
|
For more information, please visit
|
||||||
|
[our informational page](https://sustainable-open-science-and-software.github.io/) or download our [participant information sheet](https://sustainable-open-science-and-software.github.io/assets/PIS_sustainable_software.pdf).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
# [JupyterHub](https://github.com/jupyterhub/jupyterhub)
|
# [JupyterHub](https://github.com/jupyterhub/jupyterhub)
|
||||||
|
|
||||||
[](https://pypi.python.org/pypi/jupyterhub)
|
[](https://pypi.python.org/pypi/jupyterhub)
|
||||||
[](https://anaconda.org/conda-forge/jupyterhub)
|
[](https://anaconda.org/conda-forge/jupyterhub)
|
||||||
[](https://jupyterhub.readthedocs.org/en/latest/)
|
[](https://jupyterhub.readthedocs.org/en/latest/)
|
||||||
[](https://github.com/jupyterhub/jupyterhub/actions)
|
[](https://github.com/jupyterhub/jupyterhub/actions)
|
||||||
|
[](https://hub.docker.com/r/jupyterhub/jupyterhub/tags)
|
||||||
[](https://codecov.io/gh/jupyterhub/jupyterhub)
|
[](https://codecov.io/gh/jupyterhub/jupyterhub)
|
||||||
[](https://github.com/jupyterhub/jupyterhub/issues)
|
[](https://github.com/jupyterhub/jupyterhub/issues)
|
||||||
[](https://discourse.jupyter.org/c/jupyterhub)
|
[](https://discourse.jupyter.org/c/jupyterhub)
|
||||||
@@ -56,8 +66,9 @@ for administration of the Hub and its users.
|
|||||||
### Check prerequisites
|
### Check prerequisites
|
||||||
|
|
||||||
- A Linux/Unix based system
|
- A Linux/Unix based system
|
||||||
- [Python](https://www.python.org/downloads/) 3.8 or greater
|
- [Python](https://www.python.org/downloads/) 3.6 or greater
|
||||||
- [nodejs/npm](https://www.npmjs.com/)
|
- [nodejs/npm](https://www.npmjs.com/)
|
||||||
|
|
||||||
- If you are using **`conda`**, the nodejs and npm dependencies will be installed for
|
- If you are using **`conda`**, the nodejs and npm dependencies will be installed for
|
||||||
you by conda.
|
you by conda.
|
||||||
|
|
||||||
@@ -110,13 +121,13 @@ Visit `http://localhost:8000` in your browser, and sign in with your system user
|
|||||||
|
|
||||||
_Note_: To allow multiple users to sign in to the server, you will need to
|
_Note_: To allow multiple users to sign in to the server, you will need to
|
||||||
run the `jupyterhub` command as a _privileged user_, such as root.
|
run the `jupyterhub` command as a _privileged user_, such as root.
|
||||||
The [documentation](https://jupyterhub.readthedocs.io/en/latest/howto/configuration/config-sudo.html)
|
The [wiki](https://github.com/jupyterhub/jupyterhub/wiki/Using-sudo-to-run-JupyterHub-without-root-privileges)
|
||||||
describes how to run the server as a _less privileged user_, which requires
|
describes how to run the server as a _less privileged user_, which requires
|
||||||
more configuration of the system.
|
more configuration of the system.
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
The [Getting Started](https://jupyterhub.readthedocs.io/en/latest/tutorial/index.html#getting-started) section of the
|
The [Getting Started](https://jupyterhub.readthedocs.io/en/latest/getting-started/index.html) section of the
|
||||||
documentation explains the common steps in setting up JupyterHub.
|
documentation explains the common steps in setting up JupyterHub.
|
||||||
|
|
||||||
The [**JupyterHub tutorial**](https://github.com/jupyterhub/jupyterhub-tutorial)
|
The [**JupyterHub tutorial**](https://github.com/jupyterhub/jupyterhub-tutorial)
|
||||||
@@ -158,10 +169,10 @@ To start the Hub on a specific url and port `10.0.1.2:443` with **https**:
|
|||||||
|
|
||||||
## Docker
|
## Docker
|
||||||
|
|
||||||
A starter [**docker image for JupyterHub**](https://quay.io/repository/jupyterhub/jupyterhub)
|
A starter [**docker image for JupyterHub**](https://hub.docker.com/r/jupyterhub/jupyterhub/)
|
||||||
gives a baseline deployment of JupyterHub using Docker.
|
gives a baseline deployment of JupyterHub using Docker.
|
||||||
|
|
||||||
**Important:** This `quay.io/jupyterhub/jupyterhub` image contains only the Hub itself,
|
**Important:** This `jupyterhub/jupyterhub` image contains only the Hub itself,
|
||||||
with no configuration. In general, one needs to make a derivative image, with
|
with no configuration. In general, one needs to make a derivative image, with
|
||||||
at least a `jupyterhub_config.py` setting up an Authenticator and/or a Spawner.
|
at least a `jupyterhub_config.py` setting up an Authenticator and/or a Spawner.
|
||||||
To run the single-user servers, which may be on the same system as the Hub or
|
To run the single-user servers, which may be on the same system as the Hub or
|
||||||
@@ -169,7 +180,7 @@ not, Jupyter Notebook version 4 or greater must be installed.
|
|||||||
|
|
||||||
The JupyterHub docker image can be started with the following command:
|
The JupyterHub docker image can be started with the following command:
|
||||||
|
|
||||||
docker run -p 8000:8000 -d --name jupyterhub quay.io/jupyterhub/jupyterhub jupyterhub
|
docker run -p 8000:8000 -d --name jupyterhub jupyterhub/jupyterhub jupyterhub
|
||||||
|
|
||||||
This command will create a container named `jupyterhub` that you can
|
This command will create a container named `jupyterhub` that you can
|
||||||
**stop and resume** with `docker stop/start`.
|
**stop and resume** with `docker stop/start`.
|
||||||
@@ -179,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
|
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
|
(as in MUST) **secure it with ssl** by adding ssl options to your docker
|
||||||
configuration or by using an ssl enabled proxy.
|
configuration or by using a ssl enabled proxy.
|
||||||
|
|
||||||
[Mounting volumes](https://docs.docker.com/engine/admin/volumes/volumes/) will
|
[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
|
allow you to **store data outside the docker image (host system) so it will be persistent**, even when you start
|
||||||
@@ -219,7 +230,7 @@ docker container or Linux VM.
|
|||||||
We use a shared copyright model that enables all contributors to maintain the
|
We use a shared copyright model that enables all contributors to maintain the
|
||||||
copyright on their contributions.
|
copyright on their contributions.
|
||||||
|
|
||||||
All code is licensed under the terms of the [revised BSD license](./LICENSE).
|
All code is licensed under the terms of the [revised BSD license](./COPYING.md).
|
||||||
|
|
||||||
## Help and resources
|
## Help and resources
|
||||||
|
|
||||||
@@ -228,9 +239,9 @@ You can also talk with us on our JupyterHub [Gitter](https://gitter.im/jupyterhu
|
|||||||
|
|
||||||
- [Reporting Issues](https://github.com/jupyterhub/jupyterhub/issues)
|
- [Reporting Issues](https://github.com/jupyterhub/jupyterhub/issues)
|
||||||
- [JupyterHub tutorial](https://github.com/jupyterhub/jupyterhub-tutorial)
|
- [JupyterHub tutorial](https://github.com/jupyterhub/jupyterhub-tutorial)
|
||||||
- [Documentation for JupyterHub](https://jupyterhub.readthedocs.io/en/latest/)
|
- [Documentation for JupyterHub](https://jupyterhub.readthedocs.io/en/latest/) | [PDF (latest)](https://media.readthedocs.org/pdf/jupyterhub/latest/jupyterhub.pdf) | [PDF (stable)](https://media.readthedocs.org/pdf/jupyterhub/stable/jupyterhub.pdf)
|
||||||
- [Documentation for JupyterHub's REST API][rest api]
|
- [Documentation for JupyterHub's REST API][rest api]
|
||||||
- [Documentation for Project Jupyter](http://jupyter.readthedocs.io/en/latest/index.html)
|
- [Documentation for Project Jupyter](http://jupyter.readthedocs.io/en/latest/index.html) | [PDF](https://media.readthedocs.org/pdf/jupyter/latest/jupyter.pdf)
|
||||||
- [Project Jupyter website](https://jupyter.org)
|
- [Project Jupyter website](https://jupyter.org)
|
||||||
- [Project Jupyter community](https://jupyter.org/community)
|
- [Project Jupyter community](https://jupyter.org/community)
|
||||||
|
|
||||||
|
49
RELEASE.md
@@ -1,42 +1,39 @@
|
|||||||
# How to make a release
|
# How to make a release
|
||||||
|
|
||||||
`jupyterhub` is a package available on [PyPI][] and [conda-forge][].
|
`jupyterhub` is a package [available on
|
||||||
These are instructions on how to make a release.
|
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.
|
||||||
|
|
||||||
## Pre-requisites
|
For you to follow along according to these instructions, you need:
|
||||||
|
|
||||||
- Push rights to [jupyterhub/jupyterhub][]
|
- To have push rights to the [jupyterhub GitHub
|
||||||
- Push rights to [conda-forge/jupyterhub-feedstock][]
|
repository](https://github.com/jupyterhub/jupyterhub).
|
||||||
|
|
||||||
## Steps to make a release
|
## 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.
|
1. Checkout main and make sure it is up to date.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
ORIGIN=${ORIGIN:-origin} # set to the canonical remote, e.g. 'upstream' if 'origin' is not the official repo
|
||||||
git checkout main
|
git checkout main
|
||||||
git fetch origin main
|
git fetch $ORIGIN main
|
||||||
git reset --hard origin/main
|
git reset --hard $ORIGIN/main
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Update the version, make commits, and push a git tag with `tbump`.
|
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}`
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
pip install tbump
|
|
||||||
tbump --dry-run ${VERSION}
|
|
||||||
|
|
||||||
tbump ${VERSION}
|
tbump ${VERSION}
|
||||||
```
|
```
|
||||||
|
|
||||||
Following this, the [CI system][] will build and publish a release.
|
This will tag and publish a release,
|
||||||
|
which will be finished on CI.
|
||||||
|
|
||||||
1. Reset the version back to dev, e.g. `2.1.0.dev` after releasing `2.0.0`
|
1. Reset the version back to dev, e.g. `2.1.0.dev` after releasing `2.0.0`
|
||||||
|
|
||||||
@@ -45,11 +42,9 @@ These are instructions on how to make a release.
|
|||||||
```
|
```
|
||||||
|
|
||||||
1. Following the release to PyPI, an automated PR should arrive to
|
1. Following the release to PyPI, an automated PR should arrive to
|
||||||
[conda-forge/jupyterhub-feedstock][] with instructions.
|
[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.
|
||||||
|
|
||||||
[pypi]: https://pypi.org/project/jupyterhub/
|
[github-activity]: https://github.com/choldgraf/github-activity
|
||||||
[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
|
[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
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
# Reporting a Vulnerability
|
# Reporting a Vulnerability
|
||||||
|
|
||||||
If you believe you’ve found a security vulnerability in a Jupyter
|
If you believe you’ve found a security vulnerability in a Jupyter
|
||||||
project, please report it!
|
project, please report it to security@ipython.org. If you prefer to
|
||||||
See the [security documentation](https://jupyterhub.readthedocs.org/en/latest/contributing/security.html) for how.
|
encrypt your security reports, you can use [this PGP public key](https://jupyter-notebook.readthedocs.io/en/stable/_downloads/1d303a645f2505a8fd283826fafc9908/ipython_security.asc).
|
||||||
|
@@ -7,7 +7,6 @@ bower-lite
|
|||||||
Since Bower's on its way out,
|
Since Bower's on its way out,
|
||||||
stage frontend dependencies from node_modules into components
|
stage frontend dependencies from node_modules into components
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
@@ -1,36 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# Check that installed package contains everything we expect
|
|
||||||
|
|
||||||
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import jupyterhub
|
|
||||||
from jupyterhub._data import 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/spawn.html",
|
|
||||||
"static/css/style.min.css",
|
|
||||||
"static/components/jquery/dist/jquery.js",
|
|
||||||
"static/js/admin-react.js",
|
|
||||||
):
|
|
||||||
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",
|
|
||||||
"singleuser/templates/page.html",
|
|
||||||
):
|
|
||||||
path = jupyterhub_path / subpath
|
|
||||||
assert path.is_file(), path
|
|
||||||
|
|
||||||
print("OK")
|
|
@@ -1,27 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# Check that sdist contains everything we expect
|
|
||||||
|
|
||||||
import sys
|
|
||||||
import tarfile
|
|
||||||
|
|
||||||
expected_files = [
|
|
||||||
"docs/requirements.txt",
|
|
||||||
"jsx/package.json",
|
|
||||||
"package.json",
|
|
||||||
"README.md",
|
|
||||||
]
|
|
||||||
|
|
||||||
assert len(sys.argv) == 2, "Expected one file"
|
|
||||||
print(f"Checking {sys.argv[1]}")
|
|
||||||
|
|
||||||
tar = tarfile.open(name=sys.argv[1], mode="r:gz")
|
|
||||||
try:
|
|
||||||
# Remove leading jupyterhub-VERSION/
|
|
||||||
filelist = {f.partition('/')[2] for f in tar.getnames()}
|
|
||||||
finally:
|
|
||||||
tar.close()
|
|
||||||
|
|
||||||
for e in expected_files:
|
|
||||||
assert e in filelist, f"{e} not found"
|
|
||||||
|
|
||||||
print("OK")
|
|
@@ -22,7 +22,7 @@ if [[ "$DB" == "mysql" ]]; then
|
|||||||
# ref server: https://hub.docker.com/_/mysql/
|
# ref server: https://hub.docker.com/_/mysql/
|
||||||
# ref client: https://dev.mysql.com/doc/refman/5.7/en/setting-environment-variables.html
|
# 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:8.0"
|
DOCKER_RUN_ARGS="-p 3306:3306 --env MYSQL_ALLOW_EMPTY_PASSWORD=1 mysql:5.7"
|
||||||
READINESS_CHECK="mysql --user root --execute \q"
|
READINESS_CHECK="mysql --user root --execute \q"
|
||||||
elif [[ "$DB" == "postgres" ]]; then
|
elif [[ "$DB" == "postgres" ]]; then
|
||||||
# Environment variables can influence both the postgresql server in the
|
# 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
|
# used by the postgresql client psql, so we configure the user based on how
|
||||||
# we want to connect.
|
# we want to connect.
|
||||||
#
|
#
|
||||||
DOCKER_RUN_ARGS="-p 5432:5432 --env "POSTGRES_USER=${PGUSER}" --env "POSTGRES_PASSWORD=${PGPASSWORD}" postgres:15.1"
|
DOCKER_RUN_ARGS="-p 5432:5432 --env "POSTGRES_USER=${PGUSER}" --env "POSTGRES_PASSWORD=${PGPASSWORD}" postgres:9.5"
|
||||||
READINESS_CHECK="psql --command \q"
|
READINESS_CHECK="psql --command \q"
|
||||||
else
|
else
|
||||||
echo '$DB must be mysql or postgres'
|
echo '$DB must be mysql or postgres'
|
||||||
|
@@ -19,9 +19,8 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Configure a set of databases in the database server for upgrade tests
|
# 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
|
set -x
|
||||||
for SUFFIX in '' _upgrade_110 _upgrade_122 _upgrade_130 _upgrade_150 _upgrade_211 _upgrade_311; do
|
for SUFFIX in '' _upgrade_100 _upgrade_122 _upgrade_130; do
|
||||||
$SQL_CLIENT "DROP DATABASE jupyterhub${SUFFIX};" 2>/dev/null || true
|
$SQL_CLIENT "DROP DATABASE jupyterhub${SUFFIX};" 2>/dev/null || true
|
||||||
$SQL_CLIENT "CREATE DATABASE jupyterhub${SUFFIX} ${EXTRA_CREATE_DATABASE_ARGS:-};"
|
$SQL_CLIENT "CREATE DATABASE jupyterhub${SUFFIX} ${EXTRA_CREATE_DATABASE_ARGS:-};"
|
||||||
done
|
done
|
||||||
|
@@ -1,13 +0,0 @@
|
|||||||
alembic==1.4
|
|
||||||
async_generator==1.9
|
|
||||||
certipy==0.1.2
|
|
||||||
importlib_metadata==3.6; python_version < '3.10'
|
|
||||||
jinja2==2.11.0
|
|
||||||
jupyter_telemetry==0.1.0
|
|
||||||
oauthlib==3.0
|
|
||||||
pamela==1.1.0; sys_platform != 'win32'
|
|
||||||
prometheus_client==0.5.0
|
|
||||||
psutil==5.6.5; sys_platform == 'win32'
|
|
||||||
SQLAlchemy==1.4.1
|
|
||||||
tornado==5.1
|
|
||||||
traitlets==4.3.2
|
|
@@ -1,20 +0,0 @@
|
|||||||
# oldest-dependencies.txt is autogenerated.
|
|
||||||
# recreate with:
|
|
||||||
# cat requirements.txt | grep '>=' | sed -e 's@>=@==@g' > ci/legacy-env/oldest-dependencies.txt
|
|
||||||
-r ./oldest-dependencies.txt
|
|
||||||
# then `pip-compile` with Python 3.8
|
|
||||||
# below are additional pins to make this a working test env
|
|
||||||
# these are extracted from jupyterhub[test]
|
|
||||||
beautifulsoup4
|
|
||||||
coverage
|
|
||||||
playwright
|
|
||||||
pytest
|
|
||||||
pytest-cov
|
|
||||||
pytest-asyncio==0.17.*
|
|
||||||
requests-mock
|
|
||||||
virtualenv
|
|
||||||
|
|
||||||
# and any additional pins to make this a working test env
|
|
||||||
# e.g. pinning down a transitive dependency
|
|
||||||
notebook==6.*
|
|
||||||
markupsafe==2.0.*
|
|
@@ -1,285 +0,0 @@
|
|||||||
#
|
|
||||||
# This file is autogenerated by pip-compile with Python 3.8
|
|
||||||
# by the following command:
|
|
||||||
#
|
|
||||||
# pip-compile --output-file=requirements.old
|
|
||||||
#
|
|
||||||
alembic==1.4.0
|
|
||||||
# via -r ./oldest-dependencies.txt
|
|
||||||
appnope==0.1.3
|
|
||||||
# via
|
|
||||||
# ipykernel
|
|
||||||
# ipython
|
|
||||||
argon2-cffi==23.1.0
|
|
||||||
# via notebook
|
|
||||||
argon2-cffi-bindings==21.2.0
|
|
||||||
# via argon2-cffi
|
|
||||||
async-generator==1.9
|
|
||||||
# via -r ./oldest-dependencies.txt
|
|
||||||
attrs==23.1.0
|
|
||||||
# via
|
|
||||||
# jsonschema
|
|
||||||
# referencing
|
|
||||||
backcall==0.2.0
|
|
||||||
# via ipython
|
|
||||||
beautifulsoup4==4.12.2
|
|
||||||
# via -r requirements.in
|
|
||||||
bleach==6.0.0
|
|
||||||
# via nbconvert
|
|
||||||
certifi==2023.7.22
|
|
||||||
# via requests
|
|
||||||
certipy==0.1.2
|
|
||||||
# via -r ./oldest-dependencies.txt
|
|
||||||
cffi==1.15.1
|
|
||||||
# via
|
|
||||||
# argon2-cffi-bindings
|
|
||||||
# cryptography
|
|
||||||
charset-normalizer==3.2.0
|
|
||||||
# via requests
|
|
||||||
coverage[toml]==7.3.1
|
|
||||||
# via
|
|
||||||
# -r requirements.in
|
|
||||||
# pytest-cov
|
|
||||||
cryptography==41.0.4
|
|
||||||
# via pyopenssl
|
|
||||||
debugpy==1.8.0
|
|
||||||
# via ipykernel
|
|
||||||
decorator==5.1.1
|
|
||||||
# via
|
|
||||||
# ipython
|
|
||||||
# traitlets
|
|
||||||
defusedxml==0.7.1
|
|
||||||
# via nbconvert
|
|
||||||
distlib==0.3.7
|
|
||||||
# via virtualenv
|
|
||||||
entrypoints==0.4
|
|
||||||
# via
|
|
||||||
# jupyter-client
|
|
||||||
# nbconvert
|
|
||||||
exceptiongroup==1.1.3
|
|
||||||
# via pytest
|
|
||||||
fastjsonschema==2.18.0
|
|
||||||
# via nbformat
|
|
||||||
filelock==3.12.4
|
|
||||||
# via virtualenv
|
|
||||||
greenlet==2.0.2
|
|
||||||
# via
|
|
||||||
# playwright
|
|
||||||
# sqlalchemy
|
|
||||||
idna==3.4
|
|
||||||
# via requests
|
|
||||||
importlib-metadata==3.6.0 ; python_version < "3.10"
|
|
||||||
# via -r ./oldest-dependencies.txt
|
|
||||||
importlib-resources==6.1.0
|
|
||||||
# via
|
|
||||||
# jsonschema
|
|
||||||
# jsonschema-specifications
|
|
||||||
iniconfig==2.0.0
|
|
||||||
# via pytest
|
|
||||||
ipykernel==6.4.2
|
|
||||||
# via notebook
|
|
||||||
ipython==7.34.0
|
|
||||||
# via ipykernel
|
|
||||||
ipython-genutils==0.2.0
|
|
||||||
# via
|
|
||||||
# ipykernel
|
|
||||||
# notebook
|
|
||||||
# traitlets
|
|
||||||
jedi==0.19.0
|
|
||||||
# via ipython
|
|
||||||
jinja2==2.11.0
|
|
||||||
# via
|
|
||||||
# -r ./oldest-dependencies.txt
|
|
||||||
# nbconvert
|
|
||||||
# notebook
|
|
||||||
jsonschema==4.19.1
|
|
||||||
# via
|
|
||||||
# jupyter-telemetry
|
|
||||||
# nbformat
|
|
||||||
jsonschema-specifications==2023.7.1
|
|
||||||
# via jsonschema
|
|
||||||
jupyter-client==7.2.0
|
|
||||||
# via
|
|
||||||
# ipykernel
|
|
||||||
# nbclient
|
|
||||||
# notebook
|
|
||||||
jupyter-core==5.0.0
|
|
||||||
# via
|
|
||||||
# jupyter-client
|
|
||||||
# nbconvert
|
|
||||||
# nbformat
|
|
||||||
# notebook
|
|
||||||
jupyter-telemetry==0.1.0
|
|
||||||
# via -r ./oldest-dependencies.txt
|
|
||||||
jupyterlab-pygments==0.2.2
|
|
||||||
# via nbconvert
|
|
||||||
mako==1.2.4
|
|
||||||
# via alembic
|
|
||||||
markupsafe==2.0.1
|
|
||||||
# via
|
|
||||||
# -r requirements.in
|
|
||||||
# jinja2
|
|
||||||
# mako
|
|
||||||
matplotlib-inline==0.1.6
|
|
||||||
# via
|
|
||||||
# ipykernel
|
|
||||||
# ipython
|
|
||||||
mistune==0.8.4
|
|
||||||
# via nbconvert
|
|
||||||
nbclient==0.5.11
|
|
||||||
# via nbconvert
|
|
||||||
nbconvert==6.0.7
|
|
||||||
# via notebook
|
|
||||||
nbformat==5.3.0
|
|
||||||
# via
|
|
||||||
# nbclient
|
|
||||||
# nbconvert
|
|
||||||
# notebook
|
|
||||||
nest-asyncio==1.5.8
|
|
||||||
# via
|
|
||||||
# jupyter-client
|
|
||||||
# nbclient
|
|
||||||
notebook==6.1.6
|
|
||||||
# via -r requirements.in
|
|
||||||
oauthlib==3.0.0
|
|
||||||
# via -r ./oldest-dependencies.txt
|
|
||||||
packaging==23.1
|
|
||||||
# via pytest
|
|
||||||
pamela==1.1.0 ; sys_platform != "win32"
|
|
||||||
# via -r ./oldest-dependencies.txt
|
|
||||||
pandocfilters==1.5.0
|
|
||||||
# via nbconvert
|
|
||||||
parso==0.8.3
|
|
||||||
# via jedi
|
|
||||||
pexpect==4.8.0
|
|
||||||
# via ipython
|
|
||||||
pickleshare==0.7.5
|
|
||||||
# via ipython
|
|
||||||
pkgutil-resolve-name==1.3.10
|
|
||||||
# via jsonschema
|
|
||||||
platformdirs==3.10.0
|
|
||||||
# via
|
|
||||||
# jupyter-core
|
|
||||||
# virtualenv
|
|
||||||
playwright==1.38.0
|
|
||||||
# via -r requirements.in
|
|
||||||
pluggy==1.3.0
|
|
||||||
# via pytest
|
|
||||||
prometheus-client==0.5.0
|
|
||||||
# via
|
|
||||||
# -r ./oldest-dependencies.txt
|
|
||||||
# notebook
|
|
||||||
prompt-toolkit==3.0.39
|
|
||||||
# via ipython
|
|
||||||
ptyprocess==0.7.0
|
|
||||||
# via
|
|
||||||
# pexpect
|
|
||||||
# terminado
|
|
||||||
pycparser==2.21
|
|
||||||
# via cffi
|
|
||||||
pyee==9.0.4
|
|
||||||
# via playwright
|
|
||||||
pygments==2.16.1
|
|
||||||
# via
|
|
||||||
# ipython
|
|
||||||
# nbconvert
|
|
||||||
pyopenssl==23.2.0
|
|
||||||
# via certipy
|
|
||||||
pytest==7.4.2
|
|
||||||
# via
|
|
||||||
# -r requirements.in
|
|
||||||
# pytest-asyncio
|
|
||||||
# pytest-cov
|
|
||||||
pytest-asyncio==0.17.2
|
|
||||||
# via -r requirements.in
|
|
||||||
pytest-cov==4.1.0
|
|
||||||
# via -r requirements.in
|
|
||||||
python-dateutil==2.8.2
|
|
||||||
# via
|
|
||||||
# alembic
|
|
||||||
# jupyter-client
|
|
||||||
python-editor==1.0.4
|
|
||||||
# via alembic
|
|
||||||
python-json-logger==2.0.7
|
|
||||||
# via jupyter-telemetry
|
|
||||||
pyzmq==25.1.1
|
|
||||||
# via
|
|
||||||
# jupyter-client
|
|
||||||
# notebook
|
|
||||||
referencing==0.30.2
|
|
||||||
# via
|
|
||||||
# jsonschema
|
|
||||||
# jsonschema-specifications
|
|
||||||
requests==2.31.0
|
|
||||||
# via requests-mock
|
|
||||||
requests-mock==1.11.0
|
|
||||||
# via -r requirements.in
|
|
||||||
rpds-py==0.10.3
|
|
||||||
# via
|
|
||||||
# jsonschema
|
|
||||||
# referencing
|
|
||||||
ruamel-yaml==0.17.32
|
|
||||||
# via jupyter-telemetry
|
|
||||||
ruamel-yaml-clib==0.2.7
|
|
||||||
# via ruamel-yaml
|
|
||||||
send2trash==1.8.2
|
|
||||||
# via notebook
|
|
||||||
six==1.16.0
|
|
||||||
# via
|
|
||||||
# bleach
|
|
||||||
# python-dateutil
|
|
||||||
# requests-mock
|
|
||||||
# traitlets
|
|
||||||
soupsieve==2.5
|
|
||||||
# via beautifulsoup4
|
|
||||||
sqlalchemy==1.4.1
|
|
||||||
# via
|
|
||||||
# -r ./oldest-dependencies.txt
|
|
||||||
# alembic
|
|
||||||
terminado==0.13.3
|
|
||||||
# via notebook
|
|
||||||
testpath==0.6.0
|
|
||||||
# via nbconvert
|
|
||||||
tomli==2.0.1
|
|
||||||
# via
|
|
||||||
# coverage
|
|
||||||
# pytest
|
|
||||||
tornado==5.1
|
|
||||||
# via
|
|
||||||
# -r ./oldest-dependencies.txt
|
|
||||||
# ipykernel
|
|
||||||
# jupyter-client
|
|
||||||
# notebook
|
|
||||||
# terminado
|
|
||||||
traitlets==4.3.2
|
|
||||||
# via
|
|
||||||
# -r ./oldest-dependencies.txt
|
|
||||||
# ipykernel
|
|
||||||
# ipython
|
|
||||||
# jupyter-client
|
|
||||||
# jupyter-core
|
|
||||||
# jupyter-telemetry
|
|
||||||
# matplotlib-inline
|
|
||||||
# nbclient
|
|
||||||
# nbconvert
|
|
||||||
# nbformat
|
|
||||||
# notebook
|
|
||||||
typing-extensions==4.8.0
|
|
||||||
# via
|
|
||||||
# playwright
|
|
||||||
# pyee
|
|
||||||
urllib3==2.0.5
|
|
||||||
# via requests
|
|
||||||
virtualenv==20.24.5
|
|
||||||
# via -r requirements.in
|
|
||||||
wcwidth==0.2.6
|
|
||||||
# via prompt-toolkit
|
|
||||||
webencodings==0.5.1
|
|
||||||
# via bleach
|
|
||||||
zipp==3.17.0
|
|
||||||
# via
|
|
||||||
# importlib-metadata
|
|
||||||
# importlib-resources
|
|
||||||
|
|
||||||
# The following packages are considered to be unsafe in a requirements file:
|
|
||||||
# setuptools
|
|
16
demo-image/Dockerfile
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# Demo JupyterHub Docker image
|
||||||
|
#
|
||||||
|
# This should only be used for demo or testing and not as a base image to build on.
|
||||||
|
#
|
||||||
|
# It includes the notebook package and it uses the DummyAuthenticator and the SimpleLocalProcessSpawner.
|
||||||
|
ARG BASE_IMAGE=jupyterhub/jupyterhub-onbuild
|
||||||
|
FROM ${BASE_IMAGE}
|
||||||
|
|
||||||
|
# Install the notebook package
|
||||||
|
RUN python3 -m pip install notebook
|
||||||
|
|
||||||
|
# Create a demo user
|
||||||
|
RUN useradd --create-home demo
|
||||||
|
RUN chown demo .
|
||||||
|
|
||||||
|
USER demo
|
26
demo-image/README.md
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
## Demo Dockerfile
|
||||||
|
|
||||||
|
This is a demo JupyterHub Docker image to help you get a quick overview of what
|
||||||
|
JupyterHub is and how it works.
|
||||||
|
|
||||||
|
It uses the SimpleLocalProcessSpawner to spawn new user servers and
|
||||||
|
DummyAuthenticator for authentication.
|
||||||
|
The DummyAuthenticator allows you to log in with any username & password and the
|
||||||
|
SimpleLocalProcessSpawner allows starting servers without having to create a
|
||||||
|
local user for each JupyterHub user.
|
||||||
|
|
||||||
|
### Important!
|
||||||
|
|
||||||
|
This should only be used for demo or testing purposes!
|
||||||
|
It shouldn't be used as a base image to build on.
|
||||||
|
|
||||||
|
### Try it
|
||||||
|
|
||||||
|
1. `cd` to the root of your jupyterhub repo.
|
||||||
|
|
||||||
|
2. Build the demo image with `docker build -t jupyterhub-demo demo-image`.
|
||||||
|
|
||||||
|
3. Run the demo image with `docker run -d -p 8000:8000 jupyterhub-demo`.
|
||||||
|
|
||||||
|
4. Visit http://localhost:8000 and login with any username and password
|
||||||
|
5. Happy demo-ing :tada:!
|
7
demo-image/jupyterhub_config.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# Configuration file for jupyterhub-demo
|
||||||
|
|
||||||
|
c = get_config()
|
||||||
|
|
||||||
|
# Use DummyAuthenticator and SimpleSpawner
|
||||||
|
c.JupyterHub.spawner_class = "simple"
|
||||||
|
c.JupyterHub.authenticator_class = "dummy"
|
22
dev-requirements.txt
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
-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
|
||||||
|
pre-commit
|
||||||
|
pytest>=3.3
|
||||||
|
pytest-asyncio; python_version < "3.7"
|
||||||
|
pytest-asyncio>=0.17; python_version >= "3.7"
|
||||||
|
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
|
14
dockerfiles/Dockerfile.alpine
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
FROM alpine:3.13
|
||||||
|
ENV LANG=en_US.UTF-8
|
||||||
|
RUN apk add --no-cache \
|
||||||
|
python3 \
|
||||||
|
py3-pip \
|
||||||
|
py3-ruamel.yaml \
|
||||||
|
py3-cryptography \
|
||||||
|
py3-sqlalchemy
|
||||||
|
|
||||||
|
ARG JUPYTERHUB_VERSION=1.3.0
|
||||||
|
RUN pip3 install --no-cache jupyterhub==${JUPYTERHUB_VERSION}
|
||||||
|
|
||||||
|
USER nobody
|
||||||
|
CMD ["jupyterhub"]
|
20
dockerfiles/README.md
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
## 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
|
||||||
|
|
||||||
|
## How to use it?
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
## Steps to test it outside a cluster
|
||||||
|
|
||||||
|
- start configurable-http-proxy in another container
|
||||||
|
- specify CONFIGPROXY_AUTH_TOKEN env in both containers
|
||||||
|
- 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
|
||||||
|
- c.JupyterHub.authenticator_class = 'dummyauthenticator.DummyAuthenticator'
|
||||||
|
- c.DummyAuthenticator.password = "your strong password"
|
9
dockerfiles/test.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
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"):
|
||||||
|
path = os.path.join(DATA_FILES_PATH, sub_path)
|
||||||
|
assert os.path.exists(path), path
|
239
docs/Makefile
@@ -1,58 +1,209 @@
|
|||||||
# Makefile for Sphinx documentation generated by sphinx-quickstart
|
# Makefile for Sphinx documentation
|
||||||
# ----------------------------------------------------------------------------
|
#
|
||||||
|
|
||||||
# You can set these variables from the command line, and also
|
# You can set these variables from the command line.
|
||||||
# from the environment for the first two.
|
SPHINXOPTS = "-W"
|
||||||
SPHINXOPTS ?= --color -W --keep-going
|
SPHINXBUILD = sphinx-build
|
||||||
SPHINXBUILD ?= sphinx-build
|
PAPER =
|
||||||
SOURCEDIR = source
|
BUILDDIR = build
|
||||||
BUILDDIR = _build
|
|
||||||
|
# User-friendly check for sphinx-build
|
||||||
|
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
|
||||||
|
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Internal variables.
|
||||||
|
PAPEROPT_a4 = -D latex_paper_size=a4
|
||||||
|
PAPEROPT_letter = -D latex_paper_size=letter
|
||||||
|
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
|
||||||
|
# the i18n builder cannot share the environment and doctrees with the others
|
||||||
|
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
|
||||||
|
|
||||||
|
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext
|
||||||
|
|
||||||
# Put it first so that "make" without argument is like "make help".
|
|
||||||
help:
|
help:
|
||||||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS)
|
@echo "Please use \`make <target>' where <target> is one of"
|
||||||
|
@echo " html to make standalone HTML files"
|
||||||
|
@echo " dirhtml to make HTML files named index.html in directories"
|
||||||
|
@echo " singlehtml to make a single large HTML file"
|
||||||
|
@echo " pickle to make pickle files"
|
||||||
|
@echo " json to make JSON files"
|
||||||
|
@echo " htmlhelp to make HTML files and a HTML help project"
|
||||||
|
@echo " qthelp to make HTML files and a qthelp project"
|
||||||
|
@echo " applehelp to make an Apple Help Book"
|
||||||
|
@echo " devhelp to make HTML files and a Devhelp project"
|
||||||
|
@echo " epub to make an epub"
|
||||||
|
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
||||||
|
@echo " latexpdf to make LaTeX files and run them through pdflatex"
|
||||||
|
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
|
||||||
|
@echo " text to make text files"
|
||||||
|
@echo " man to make manual pages"
|
||||||
|
@echo " texinfo to make Texinfo files"
|
||||||
|
@echo " info to make Texinfo files and run them through makeinfo"
|
||||||
|
@echo " gettext to make PO message catalogs"
|
||||||
|
@echo " changes to make an overview of all changed/added/deprecated items"
|
||||||
|
@echo " xml to make Docutils-native XML files"
|
||||||
|
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
|
||||||
|
@echo " linkcheck to check all external links for integrity"
|
||||||
|
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
|
||||||
|
@echo " coverage to run coverage check of the documentation (if enabled)"
|
||||||
|
@echo " spelling to run spell check on documentation"
|
||||||
|
@echo " metrics to generate documentation for metrics by inspecting the source code"
|
||||||
|
|
||||||
.PHONY: help Makefile metrics scopes
|
clean:
|
||||||
|
rm -rf $(BUILDDIR)/*
|
||||||
|
|
||||||
# Catch-all target: route all unknown targets to Sphinx using the new
|
metrics: source/reference/metrics.rst
|
||||||
# "make mode" option.
|
|
||||||
#
|
|
||||||
# Several sphinx-build commands can be used through this, for example:
|
|
||||||
#
|
|
||||||
# - make clean
|
|
||||||
# - make linkcheck
|
|
||||||
# - make spelling
|
|
||||||
#
|
|
||||||
%: Makefile
|
|
||||||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS)
|
|
||||||
|
|
||||||
|
source/reference/metrics.rst: generate-metrics.py
|
||||||
|
python3 generate-metrics.py
|
||||||
|
|
||||||
# Manually added targets - related to code generation
|
scopes: source/rbac/scope-table.md
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# For local development:
|
source/rbac/scope-table.md: source/rbac/generate-scope-table.py
|
||||||
# - builds the html
|
python3 source/rbac/generate-scope-table.py
|
||||||
# - NOTE: 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
|
||||||
html: metrics
|
|
||||||
$(SPHINXBUILD) -b html "$(SOURCEDIR)" "$(BUILDDIR)/html" $(SPHINXOPTS)
|
|
||||||
@echo
|
@echo
|
||||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
||||||
|
|
||||||
metrics: source/reference/metrics.md
|
dirhtml:
|
||||||
source/reference/metrics.md:
|
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
|
||||||
python3 generate-metrics.py
|
@echo
|
||||||
|
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
|
||||||
|
|
||||||
|
singlehtml:
|
||||||
|
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
|
||||||
|
|
||||||
# Manually added targets - related to development
|
pickle:
|
||||||
# ----------------------------------------------------------------------------
|
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
|
||||||
|
@echo
|
||||||
|
@echo "Build finished; now you can process the pickle files."
|
||||||
|
|
||||||
# For local development:
|
json:
|
||||||
# - requires sphinx-autobuild, see
|
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
|
||||||
# https://sphinxcontrib-spelling.readthedocs.io/en/latest/
|
@echo
|
||||||
# - builds and rebuilds html on changes to source, but does not re-generate
|
@echo "Build finished; now you can process the JSON files."
|
||||||
# metrics files
|
|
||||||
# - starts a livereload enabled webserver and opens up a browser
|
htmlhelp:
|
||||||
devenv: html
|
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
|
||||||
sphinx-autobuild -b html --open-browser "$(SOURCEDIR)" "$(BUILDDIR)/html"
|
@echo
|
||||||
|
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
||||||
|
".hhp project file in $(BUILDDIR)/htmlhelp."
|
||||||
|
|
||||||
|
qthelp:
|
||||||
|
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
|
||||||
|
@echo
|
||||||
|
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
|
||||||
|
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
|
||||||
|
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/JupyterHub.qhcp"
|
||||||
|
@echo "To view the help file:"
|
||||||
|
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/JupyterHub.qhc"
|
||||||
|
|
||||||
|
applehelp:
|
||||||
|
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
|
||||||
|
@echo "N.B. You won't be able to view it unless you put it in" \
|
||||||
|
"~/Library/Documentation/Help or install it in your application" \
|
||||||
|
"bundle."
|
||||||
|
|
||||||
|
devhelp:
|
||||||
|
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
|
||||||
|
@echo
|
||||||
|
@echo "Build finished."
|
||||||
|
@echo "To view the help file:"
|
||||||
|
@echo "# mkdir -p $$HOME/.local/share/devhelp/JupyterHub"
|
||||||
|
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/JupyterHub"
|
||||||
|
@echo "# devhelp"
|
||||||
|
|
||||||
|
epub:
|
||||||
|
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
|
||||||
|
|
||||||
|
latex:
|
||||||
|
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||||
|
@echo
|
||||||
|
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
|
||||||
|
@echo "Run \`make' in that directory to run these through (pdf)latex" \
|
||||||
|
"(use \`make latexpdf' here to do that automatically)."
|
||||||
|
|
||||||
|
latexpdf:
|
||||||
|
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||||
|
@echo "Running LaTeX files through pdflatex..."
|
||||||
|
$(MAKE) -C $(BUILDDIR)/latex all-pdf
|
||||||
|
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
||||||
|
|
||||||
|
latexpdfja:
|
||||||
|
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||||
|
@echo "Running LaTeX files through platex and dvipdfmx..."
|
||||||
|
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
|
||||||
|
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
||||||
|
|
||||||
|
text:
|
||||||
|
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The text files are in $(BUILDDIR)/text."
|
||||||
|
|
||||||
|
man:
|
||||||
|
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
|
||||||
|
|
||||||
|
texinfo:
|
||||||
|
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
|
||||||
|
@echo "Run \`make' in that directory to run these through makeinfo" \
|
||||||
|
"(use \`make info' here to do that automatically)."
|
||||||
|
|
||||||
|
info:
|
||||||
|
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||||
|
@echo "Running Texinfo files through makeinfo..."
|
||||||
|
make -C $(BUILDDIR)/texinfo info
|
||||||
|
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
|
||||||
|
|
||||||
|
gettext:
|
||||||
|
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
|
||||||
|
|
||||||
|
changes:
|
||||||
|
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
|
||||||
|
@echo
|
||||||
|
@echo "The overview file is in $(BUILDDIR)/changes."
|
||||||
|
|
||||||
|
linkcheck:
|
||||||
|
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
|
||||||
|
@echo
|
||||||
|
@echo "Link check complete; look for any errors in the above output " \
|
||||||
|
"or in $(BUILDDIR)/linkcheck/output.txt."
|
||||||
|
|
||||||
|
spelling:
|
||||||
|
$(SPHINXBUILD) -b spelling $(ALLSPHINXOPTS) $(BUILDDIR)/spelling
|
||||||
|
@echo
|
||||||
|
@echo "Spell check complete; look for any errors in the above output " \
|
||||||
|
"or in $(BUILDDIR)/spelling/output.txt."
|
||||||
|
doctest:
|
||||||
|
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
|
||||||
|
@echo "Testing of doctests in the sources finished, look at the " \
|
||||||
|
"results in $(BUILDDIR)/doctest/output.txt."
|
||||||
|
|
||||||
|
coverage:
|
||||||
|
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
|
||||||
|
@echo "Testing of coverage in the sources finished, look at the " \
|
||||||
|
"results in $(BUILDDIR)/coverage/python.txt."
|
||||||
|
|
||||||
|
xml:
|
||||||
|
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
|
||||||
|
|
||||||
|
pseudoxml:
|
||||||
|
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
import os
|
import os
|
||||||
|
from os.path import join
|
||||||
|
|
||||||
from pytablewriter import MarkdownTableWriter
|
from pytablewriter import RstSimpleTableWriter
|
||||||
|
from pytablewriter.style import Style
|
||||||
|
|
||||||
import jupyterhub.metrics
|
import jupyterhub.metrics
|
||||||
|
|
||||||
@@ -10,11 +12,12 @@ HERE = os.path.abspath(os.path.dirname(__file__))
|
|||||||
class Generator:
|
class Generator:
|
||||||
@classmethod
|
@classmethod
|
||||||
def create_writer(cls, table_name, headers, values):
|
def create_writer(cls, table_name, headers, values):
|
||||||
writer = MarkdownTableWriter()
|
writer = RstSimpleTableWriter()
|
||||||
writer.table_name = table_name
|
writer.table_name = table_name
|
||||||
writer.headers = headers
|
writer.headers = headers
|
||||||
writer.value_matrix = values
|
writer.value_matrix = values
|
||||||
writer.margin = 1
|
writer.margin = 1
|
||||||
|
[writer.set_style(header, Style(align="center")) for header in headers]
|
||||||
return writer
|
return writer
|
||||||
|
|
||||||
def _parse_metrics(self):
|
def _parse_metrics(self):
|
||||||
@@ -31,17 +34,18 @@ class Generator:
|
|||||||
if not os.path.exists(generated_directory):
|
if not os.path.exists(generated_directory):
|
||||||
os.makedirs(generated_directory)
|
os.makedirs(generated_directory)
|
||||||
|
|
||||||
filename = f"{generated_directory}/metrics.md"
|
filename = f"{generated_directory}/metrics.rst"
|
||||||
table_name = ""
|
table_name = ""
|
||||||
headers = ["Type", "Name", "Description"]
|
headers = ["Type", "Name", "Description"]
|
||||||
values = self._parse_metrics()
|
values = self._parse_metrics()
|
||||||
writer = self.create_writer(table_name, headers, values)
|
writer = self.create_writer(table_name, headers, values)
|
||||||
|
|
||||||
|
title = "List of Prometheus Metrics"
|
||||||
|
underline = "============================"
|
||||||
|
content = f"{title}\n{underline}\n{writer.dumps()}"
|
||||||
with open(filename, 'w') as f:
|
with open(filename, 'w') as f:
|
||||||
f.write("# List of Prometheus Metrics\n\n")
|
f.write(content)
|
||||||
f.write(writer.dumps())
|
print(f"Generated {filename}.")
|
||||||
f.write("\n")
|
|
||||||
print(f"Generated {filename}")
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
270
docs/make.bat
@@ -1,49 +1,263 @@
|
|||||||
@ECHO OFF
|
@ECHO OFF
|
||||||
|
|
||||||
pushd %~dp0
|
|
||||||
|
|
||||||
REM Command file for Sphinx documentation
|
REM Command file for Sphinx documentation
|
||||||
|
|
||||||
if "%SPHINXBUILD%" == "" (
|
|
||||||
set SPHINXBUILD=--color -W --keep-going
|
|
||||||
)
|
|
||||||
if "%SPHINXBUILD%" == "" (
|
if "%SPHINXBUILD%" == "" (
|
||||||
set SPHINXBUILD=sphinx-build
|
set SPHINXBUILD=sphinx-build
|
||||||
)
|
)
|
||||||
set SOURCEDIR=source
|
set BUILDDIR=build
|
||||||
set BUILDDIR=_build
|
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source
|
||||||
|
set I18NSPHINXOPTS=%SPHINXOPTS% source
|
||||||
|
if NOT "%PAPER%" == "" (
|
||||||
|
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
|
||||||
|
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
|
||||||
|
)
|
||||||
|
|
||||||
if "%1" == "" goto help
|
if "%1" == "" goto help
|
||||||
if "%1" == "devenv" goto devenv
|
|
||||||
goto default
|
|
||||||
|
|
||||||
|
|
||||||
:default
|
|
||||||
%SPHINXBUILD% >NUL 2>NUL
|
|
||||||
if errorlevel 9009 (
|
|
||||||
echo.
|
|
||||||
echo.The 'sphinx-build' command was not found. Open and read README.md!
|
|
||||||
exit /b 1
|
|
||||||
)
|
|
||||||
%SPHINXBUILD% -M %1 "%SOURCEDIR%" "%BUILDDIR%" %SPHINXOPTS%
|
|
||||||
goto end
|
|
||||||
|
|
||||||
|
|
||||||
|
if "%1" == "help" (
|
||||||
:help
|
:help
|
||||||
%SPHINXBUILD% -M help "%SOURCEDIR%" "%BUILDDIR%" %SPHINXOPTS%
|
echo.Please use `make ^<target^>` where ^<target^> is one of
|
||||||
|
echo. html to make standalone HTML files
|
||||||
|
echo. dirhtml to make HTML files named index.html in directories
|
||||||
|
echo. singlehtml to make a single large HTML file
|
||||||
|
echo. pickle to make pickle files
|
||||||
|
echo. json to make JSON files
|
||||||
|
echo. htmlhelp to make HTML files and a HTML help project
|
||||||
|
echo. qthelp to make HTML files and a qthelp project
|
||||||
|
echo. devhelp to make HTML files and a Devhelp project
|
||||||
|
echo. epub to make an epub
|
||||||
|
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
|
||||||
|
echo. text to make text files
|
||||||
|
echo. man to make manual pages
|
||||||
|
echo. texinfo to make Texinfo files
|
||||||
|
echo. gettext to make PO message catalogs
|
||||||
|
echo. changes to make an overview over all changed/added/deprecated items
|
||||||
|
echo. xml to make Docutils-native XML files
|
||||||
|
echo. pseudoxml to make pseudoxml-XML files for display purposes
|
||||||
|
echo. linkcheck to check all external links for integrity
|
||||||
|
echo. doctest to run all doctests embedded in the documentation if enabled
|
||||||
|
echo. coverage to run coverage check of the documentation if enabled
|
||||||
goto end
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "clean" (
|
||||||
|
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
|
||||||
|
del /q /s %BUILDDIR%\*
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
:devenv
|
REM Check if sphinx-build is available and fallback to Python version if any
|
||||||
sphinx-autobuild >NUL 2>NUL
|
%SPHINXBUILD% 1>NUL 2>NUL
|
||||||
|
if errorlevel 9009 goto sphinx_python
|
||||||
|
goto sphinx_ok
|
||||||
|
|
||||||
|
:sphinx_python
|
||||||
|
|
||||||
|
set SPHINXBUILD=python -m sphinx.__init__
|
||||||
|
%SPHINXBUILD% 2> nul
|
||||||
if errorlevel 9009 (
|
if errorlevel 9009 (
|
||||||
echo.
|
echo.
|
||||||
echo.The 'sphinx-autobuild' command was not found. Open and read README.md!
|
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
||||||
|
echo.installed, then set the SPHINXBUILD environment variable to point
|
||||||
|
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
||||||
|
echo.may add the Sphinx directory to PATH.
|
||||||
|
echo.
|
||||||
|
echo.If you don't have Sphinx installed, grab it from
|
||||||
|
echo.http://sphinx-doc.org/
|
||||||
exit /b 1
|
exit /b 1
|
||||||
)
|
)
|
||||||
sphinx-autobuild -b html --open-browser "%SOURCEDIR%" "%BUILDDIR%/html"
|
|
||||||
goto end
|
|
||||||
|
|
||||||
|
:sphinx_ok
|
||||||
|
|
||||||
|
|
||||||
|
if "%1" == "html" (
|
||||||
|
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "dirhtml" (
|
||||||
|
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "singlehtml" (
|
||||||
|
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "pickle" (
|
||||||
|
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished; now you can process the pickle files.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "json" (
|
||||||
|
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished; now you can process the JSON files.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "htmlhelp" (
|
||||||
|
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished; now you can run HTML Help Workshop with the ^
|
||||||
|
.hhp project file in %BUILDDIR%/htmlhelp.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "qthelp" (
|
||||||
|
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished; now you can run "qcollectiongenerator" with the ^
|
||||||
|
.qhcp project file in %BUILDDIR%/qthelp, like this:
|
||||||
|
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\JupyterHub.qhcp
|
||||||
|
echo.To view the help file:
|
||||||
|
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\JupyterHub.ghc
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "devhelp" (
|
||||||
|
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "epub" (
|
||||||
|
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. The epub file is in %BUILDDIR%/epub.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "latex" (
|
||||||
|
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "latexpdf" (
|
||||||
|
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
||||||
|
cd %BUILDDIR%/latex
|
||||||
|
make all-pdf
|
||||||
|
cd %~dp0
|
||||||
|
echo.
|
||||||
|
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "latexpdfja" (
|
||||||
|
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
||||||
|
cd %BUILDDIR%/latex
|
||||||
|
make all-pdf-ja
|
||||||
|
cd %~dp0
|
||||||
|
echo.
|
||||||
|
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "text" (
|
||||||
|
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. The text files are in %BUILDDIR%/text.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "man" (
|
||||||
|
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. The manual pages are in %BUILDDIR%/man.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "texinfo" (
|
||||||
|
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "gettext" (
|
||||||
|
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "changes" (
|
||||||
|
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.The overview file is in %BUILDDIR%/changes.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "linkcheck" (
|
||||||
|
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Link check complete; look for any errors in the above output ^
|
||||||
|
or in %BUILDDIR%/linkcheck/output.txt.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "doctest" (
|
||||||
|
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Testing of doctests in the sources finished, look at the ^
|
||||||
|
results in %BUILDDIR%/doctest/output.txt.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "coverage" (
|
||||||
|
%SPHINXBUILD% -b coverage %ALLSPHINXOPTS% %BUILDDIR%/coverage
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Testing of coverage in the sources finished, look at the ^
|
||||||
|
results in %BUILDDIR%/coverage/python.txt.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "xml" (
|
||||||
|
%SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. The XML files are in %BUILDDIR%/xml.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "pseudoxml" (
|
||||||
|
%SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
:end
|
:end
|
||||||
popd
|
|
||||||
|
@@ -1,15 +1,12 @@
|
|||||||
# docs also require jupyterhub itself to be installed
|
-r ../requirements.txt
|
||||||
# don't depend on it here, as that often results in a duplicate
|
|
||||||
# installation of jupyterhub that's already installed
|
alabaster_jupyterhub
|
||||||
autodoc-traits
|
autodoc-traits
|
||||||
intersphinx-registry
|
myst-parser
|
||||||
jupyterhub-sphinx-theme
|
|
||||||
myst-parser>=0.19
|
|
||||||
pre-commit
|
pre-commit
|
||||||
|
pydata-sphinx-theme
|
||||||
pytablewriter>=0.56
|
pytablewriter>=0.56
|
||||||
ruamel.yaml
|
ruamel.yaml
|
||||||
sphinx>=4
|
sphinx>=1.7
|
||||||
sphinx-copybutton
|
sphinx-copybutton
|
||||||
sphinx-jsonschema
|
sphinx-jsonschema
|
||||||
sphinxext-opengraph
|
|
||||||
sphinxext-rediraffe
|
|
||||||
|
@@ -1,2 +0,0 @@
|
|||||||
{%- set _meta = meta | default({}) %}
|
|
||||||
{%- extends _meta.page_template | default('!page.html') %}
|
|
@@ -1,32 +0,0 @@
|
|||||||
{# djlint: off #}
|
|
||||||
{%- extends "!layout.html" %}
|
|
||||||
{# not sure why, but theme CSS prevents scrolling within redoc content
|
|
||||||
# If this were fixed, we could keep the navbar and footer
|
|
||||||
#}
|
|
||||||
{% block css %}
|
|
||||||
{% endblock css %}
|
|
||||||
{% block docs_navbar %}
|
|
||||||
{% endblock docs_navbar %}
|
|
||||||
{% block footer %}
|
|
||||||
{% endblock footer %}
|
|
||||||
{%- block body_tag -%}<body>{%- endblock body_tag %}
|
|
||||||
{%- block extrahead %}
|
|
||||||
{{ super() }}
|
|
||||||
<link href="{{ pathto('_static/redoc-fonts.css', 1) }}" rel="stylesheet" />
|
|
||||||
<script src="{{ pathto('_static/redoc.js', 1) }}"></script>
|
|
||||||
{%- endblock extrahead %}
|
|
||||||
{%- block content %}
|
|
||||||
<redoc id="redoc-spec"></redoc>
|
|
||||||
<script>
|
|
||||||
if (location.protocol === "file:") {
|
|
||||||
document.body.innerText = "Rendered API specification doesn't work with file: protocol. Use sphinx-autobuild to do local builds of the docs, served over HTTP."
|
|
||||||
} else {
|
|
||||||
Redoc.init(
|
|
||||||
"{{ pathto('_static/rest-api.yml', 1) }}",
|
|
||||||
{{ meta.redoc_options | default ({}) }},
|
|
||||||
document.getElementById("redoc-spec"),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
{%- endblock content %}
|
|
||||||
{# djlint: on #}
|
|
@@ -1,35 +1,33 @@
|
|||||||
(howto:log-messages)=
|
|
||||||
|
|
||||||
# Interpreting common log messages
|
# Interpreting common log messages
|
||||||
|
|
||||||
When debugging errors and outages, looking at the logs emitted by
|
When debugging errors and outages, looking at the logs emitted by
|
||||||
JupyterHub is very helpful. This document intends to describe some common
|
JupyterHub is very helpful. This document tries to document 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.
|
log messages, and what they mean.
|
||||||
|
|
||||||
## Failing suspected API request to not-running server
|
## Failing suspected API request to not-running server
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
Your logs might be littered with lines that look scary
|
Your logs might be littered with lines that might look slightly 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
|
[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
|
||||||
```
|
```
|
||||||
|
|
||||||
### Cause
|
### Most likely 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
|
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
|
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
|
process then explicitly returns a failure response, so the client knows
|
||||||
that the server is not running anymore. This is used by JupyterLab to
|
that the server is not running anymore. This is used by JupyterLab to
|
||||||
inform the user that the server is not running anymore, and provide an option
|
tell you your server is not running anymore, and offer you the option
|
||||||
to restart it.
|
to let you restart it.
|
||||||
|
|
||||||
Most commonly, you'll see this in reference to the `/api/metrics/v1`
|
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).
|
URL, used by [jupyter-resource-usage](https://github.com/jupyter-server/jupyter-resource-usage).
|
||||||
@@ -49,9 +47,9 @@ This log message is benign, and there is usually no action for you to take.
|
|||||||
### Cause
|
### Cause
|
||||||
|
|
||||||
JupyterHub requires the `jupyterhub` python package installed inside the image or
|
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 `jupyterhub` package installed inside the user image or environment is not
|
||||||
the same as the JupyterHub server's version itself. This is not necessarily always a
|
the same version as the JupyterHub server itself. This is not necessarily always a
|
||||||
problem - some version drift is mostly acceptable, and the only two known cases of
|
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
|
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
|
up immediately after upgrading your version of JupyterHub, so **always check the JupyterHub
|
||||||
@@ -69,6 +67,6 @@ aligned, rather than as an indicator of an existing problem.
|
|||||||
### Actions you can take
|
### Actions you can take
|
||||||
|
|
||||||
Upgrade the version of the `jupyterhub` package in your user environment or image
|
Upgrade the version of the `jupyterhub` package in your user environment or image
|
||||||
so that it matches the version of JupyterHub running your JupyterHub server! If you
|
so 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
|
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://hub.jupyter.org/helm-chart/)
|
version of the `jupyterhub` package to install in your user image [here](https://jupyterhub.github.io/helm-chart/)
|
157
docs/source/admin/upgrading.rst
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
====================
|
||||||
|
Upgrading JupyterHub
|
||||||
|
====================
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
It is long because is pretty detailed! Most likely, upgrading
|
||||||
|
JupyterHub is painless, quick and with minimal user interruption.
|
||||||
|
|
||||||
|
Read the Changelog
|
||||||
|
==================
|
||||||
|
|
||||||
|
The `changelog <../changelog.html>`_ 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
|
||||||
|
read the changelogs for those too!
|
||||||
|
|
||||||
|
Notify your users
|
||||||
|
=================
|
||||||
|
|
||||||
|
If you are using 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``
|
||||||
|
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.
|
||||||
|
|
||||||
|
|
||||||
|
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_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.
|
||||||
|
|
||||||
|
|
||||||
|
Shutdown 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
|
||||||
|
supervisor of some sort (``systemd`` or ``supervisord`` or even ``docker``).
|
||||||
|
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
|
||||||
|
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
|
||||||
|
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
|
||||||
|
launched the ``jupyterhub-singleuser`` command in this environment,
|
||||||
|
which in turn starts the notebook server.
|
||||||
|
|
||||||
|
You need to make sure the version of the ``jupyterhub`` package matches
|
||||||
|
in both these environments. If you installed ``jupyterhub`` with pip,
|
||||||
|
you can upgrade it with:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
python3 -m pip install --upgrade jupyterhub==<version>
|
||||||
|
|
||||||
|
Where ``<version>`` is the version of JupyterHub you are upgrading to.
|
||||||
|
|
||||||
|
If you used ``conda`` to install ``jupyterhub``, you should upgrade it
|
||||||
|
with:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
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,
|
||||||
|
or upgrade them separately.
|
||||||
|
|
||||||
|
Upgrade JupyterHub database
|
||||||
|
===========================
|
||||||
|
|
||||||
|
Once new packages are installed, you need to upgrade the JupyterHub
|
||||||
|
database. From the hub environment, in the same directory as your
|
||||||
|
``jupyterhub_config.py`` file, you should run:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
jupyterhub upgrade-db
|
||||||
|
|
||||||
|
This should find the location of your database, and run necessary upgrades
|
||||||
|
for it.
|
||||||
|
|
||||||
|
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
|
||||||
|
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
|
||||||
|
|
||||||
|
What happens if I delete my database?
|
||||||
|
-------------------------------------
|
||||||
|
|
||||||
|
Losing the Hub database is often not a big deal. Information that
|
||||||
|
resides only in the Hub database includes:
|
||||||
|
|
||||||
|
- active login tokens (user cookies, service tokens)
|
||||||
|
- users added via JupyterHub UI, instead of config files
|
||||||
|
- info about running servers
|
||||||
|
|
||||||
|
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
|
||||||
|
authentication provider (Google, GitHub, LDAP, etc)
|
||||||
|
- user servers are stopped during upgrade
|
||||||
|
- don't mind causing users to login again after upgrade
|
||||||
|
|
||||||
|
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
|
||||||
|
expected.
|
||||||
|
#. Check the logs for any errors or deprecation warnings. You
|
||||||
|
might have to update your ``jupyterhub_config.py`` file to
|
||||||
|
deal with any deprecated options.
|
||||||
|
|
||||||
|
Congratulations, your JupyterHub has been upgraded!
|
15
docs/source/api/app.rst
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
=========================
|
||||||
|
Application configuration
|
||||||
|
=========================
|
||||||
|
|
||||||
|
Module: :mod:`jupyterhub.app`
|
||||||
|
=============================
|
||||||
|
|
||||||
|
.. automodule:: jupyterhub.app
|
||||||
|
|
||||||
|
.. currentmodule:: jupyterhub.app
|
||||||
|
|
||||||
|
:class:`JupyterHub`
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
.. autoconfigurable:: JupyterHub
|
32
docs/source/api/auth.rst
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
==============
|
||||||
|
Authenticators
|
||||||
|
==============
|
||||||
|
|
||||||
|
Module: :mod:`jupyterhub.auth`
|
||||||
|
==============================
|
||||||
|
|
||||||
|
.. automodule:: jupyterhub.auth
|
||||||
|
|
||||||
|
.. currentmodule:: jupyterhub.auth
|
||||||
|
|
||||||
|
:class:`Authenticator`
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
.. autoconfigurable:: Authenticator
|
||||||
|
:members:
|
||||||
|
|
||||||
|
:class:`LocalAuthenticator`
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
.. autoconfigurable:: LocalAuthenticator
|
||||||
|
:members:
|
||||||
|
|
||||||
|
:class:`PAMAuthenticator`
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
.. autoconfigurable:: PAMAuthenticator
|
||||||
|
|
||||||
|
:class:`DummyAuthenticator`
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
.. autoconfigurable:: DummyAuthenticator
|
33
docs/source/api/index.rst
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
.. _api-index:
|
||||||
|
|
||||||
|
##############
|
||||||
|
JupyterHub API
|
||||||
|
##############
|
||||||
|
|
||||||
|
:Release: |release|
|
||||||
|
:Date: |today|
|
||||||
|
|
||||||
|
JupyterHub also provides a REST API for administration of the Hub and users.
|
||||||
|
The documentation on `Using JupyterHub's REST API <../reference/rest.html>`_ provides
|
||||||
|
information on:
|
||||||
|
|
||||||
|
- what you can do with the API
|
||||||
|
- creating an API token
|
||||||
|
- adding API tokens to the config files
|
||||||
|
- making an API request programmatically using the requests library
|
||||||
|
- learning more about JupyterHub's API
|
||||||
|
|
||||||
|
JupyterHub API Reference:
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
|
||||||
|
app
|
||||||
|
auth
|
||||||
|
spawner
|
||||||
|
proxy
|
||||||
|
user
|
||||||
|
service
|
||||||
|
services.auth
|
||||||
|
|
||||||
|
|
||||||
|
.. _OpenAPI Initiative: https://www.openapis.org/
|
22
docs/source/api/proxy.rst
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
=======
|
||||||
|
Proxies
|
||||||
|
=======
|
||||||
|
|
||||||
|
Module: :mod:`jupyterhub.proxy`
|
||||||
|
===============================
|
||||||
|
|
||||||
|
.. automodule:: jupyterhub.proxy
|
||||||
|
|
||||||
|
.. currentmodule:: jupyterhub.proxy
|
||||||
|
|
||||||
|
:class:`Proxy`
|
||||||
|
--------------
|
||||||
|
|
||||||
|
.. autoconfigurable:: Proxy
|
||||||
|
:members:
|
||||||
|
|
||||||
|
:class:`ConfigurableHTTPProxy`
|
||||||
|
------------------------------
|
||||||
|
|
||||||
|
.. autoconfigurable:: ConfigurableHTTPProxy
|
||||||
|
:members: debug, auth_token, check_running_interval, api_url, command
|
16
docs/source/api/service.rst
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
========
|
||||||
|
Services
|
||||||
|
========
|
||||||
|
|
||||||
|
Module: :mod:`jupyterhub.services.service`
|
||||||
|
==========================================
|
||||||
|
|
||||||
|
.. automodule:: jupyterhub.services.service
|
||||||
|
|
||||||
|
.. currentmodule:: jupyterhub.services.service
|
||||||
|
|
||||||
|
:class:`Service`
|
||||||
|
----------------
|
||||||
|
|
||||||
|
.. autoconfigurable:: Service
|
||||||
|
:members: name, admin, url, api_token, managed, kind, command, cwd, environment, user, oauth_client_id, server, prefix, proxy_spec
|
40
docs/source/api/services.auth.rst
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
=======================
|
||||||
|
Services Authentication
|
||||||
|
=======================
|
||||||
|
|
||||||
|
Module: :mod:`jupyterhub.services.auth`
|
||||||
|
=======================================
|
||||||
|
|
||||||
|
.. automodule:: jupyterhub.services.auth
|
||||||
|
|
||||||
|
.. currentmodule:: jupyterhub.services.auth
|
||||||
|
|
||||||
|
|
||||||
|
:class:`HubAuth`
|
||||||
|
----------------
|
||||||
|
|
||||||
|
.. autoconfigurable:: HubAuth
|
||||||
|
:members:
|
||||||
|
|
||||||
|
:class:`HubOAuth`
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
.. autoconfigurable:: HubOAuth
|
||||||
|
:members:
|
||||||
|
|
||||||
|
|
||||||
|
:class:`HubAuthenticated`
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
.. autoclass:: HubAuthenticated
|
||||||
|
:members:
|
||||||
|
|
||||||
|
:class:`HubOAuthenticated`
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
.. autoclass:: HubOAuthenticated
|
||||||
|
|
||||||
|
:class:`HubOAuthCallbackHandler`
|
||||||
|
--------------------------------
|
||||||
|
|
||||||
|
.. autoclass:: HubOAuthCallbackHandler
|
21
docs/source/api/spawner.rst
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
========
|
||||||
|
Spawners
|
||||||
|
========
|
||||||
|
|
||||||
|
Module: :mod:`jupyterhub.spawner`
|
||||||
|
=================================
|
||||||
|
|
||||||
|
.. automodule:: jupyterhub.spawner
|
||||||
|
|
||||||
|
.. currentmodule:: jupyterhub.spawner
|
||||||
|
|
||||||
|
:class:`Spawner`
|
||||||
|
----------------
|
||||||
|
|
||||||
|
.. autoconfigurable:: Spawner
|
||||||
|
:members: options_from_form, poll, start, stop, get_args, get_env, get_state, template_namespace, format_string, create_certs, move_certs
|
||||||
|
|
||||||
|
:class:`LocalProcessSpawner`
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
.. autoconfigurable:: LocalProcessSpawner
|
36
docs/source/api/user.rst
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
=====
|
||||||
|
Users
|
||||||
|
=====
|
||||||
|
|
||||||
|
Module: :mod:`jupyterhub.user`
|
||||||
|
==============================
|
||||||
|
|
||||||
|
.. automodule:: jupyterhub.user
|
||||||
|
|
||||||
|
.. currentmodule:: jupyterhub.user
|
||||||
|
|
||||||
|
:class:`UserDict`
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
.. autoclass:: UserDict
|
||||||
|
:members:
|
||||||
|
|
||||||
|
|
||||||
|
:class:`User`
|
||||||
|
-------------
|
||||||
|
|
||||||
|
.. autoclass:: User
|
||||||
|
:members: escaped_name
|
||||||
|
|
||||||
|
.. attribute:: name
|
||||||
|
|
||||||
|
The user's name
|
||||||
|
|
||||||
|
.. attribute:: server
|
||||||
|
|
||||||
|
The user's Server data object if running, None otherwise.
|
||||||
|
Has ``ip``, ``port`` attributes.
|
||||||
|
|
||||||
|
.. attribute:: spawner
|
||||||
|
|
||||||
|
The user's :class:`~.Spawner` instance.
|
1617
docs/source/changelog.md
Normal file
@@ -1,93 +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 os
|
||||||
import re
|
import sys
|
||||||
import subprocess
|
|
||||||
from pathlib import Path
|
|
||||||
from urllib.request import urlretrieve
|
|
||||||
|
|
||||||
from docutils import nodes
|
# Set paths
|
||||||
from intersphinx_registry import get_intersphinx_mapping
|
sys.path.insert(0, os.path.abspath('.'))
|
||||||
from ruamel.yaml import YAML
|
|
||||||
from sphinx.directives.other import SphinxDirective
|
# -- General configuration ------------------------------------------------
|
||||||
from sphinx.util import logging
|
|
||||||
|
# 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
|
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 = None
|
||||||
|
exclude_patterns = []
|
||||||
|
pygments_style = 'sphinx'
|
||||||
|
todo_include_todos = False
|
||||||
|
|
||||||
|
# Set the default role so we can use `foo` instead of ``foo``
|
||||||
|
default_role = 'literal'
|
||||||
|
|
||||||
|
# -- Config -------------------------------------------------------------
|
||||||
from jupyterhub.app import JupyterHub
|
from jupyterhub.app import JupyterHub
|
||||||
|
from docutils import nodes
|
||||||
|
from sphinx.directives.other import SphinxDirective
|
||||||
|
from contextlib import redirect_stdout
|
||||||
|
from io import StringIO
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
# create a temp instance of JupyterHub just to get the output of the generate-config
|
||||||
# -- Project information -----------------------------------------------------
|
# and help --all commands.
|
||||||
# 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}"
|
|
||||||
|
|
||||||
|
|
||||||
# -- 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",
|
|
||||||
"jupyterhub_sphinx_theme",
|
|
||||||
"myst_parser",
|
|
||||||
]
|
|
||||||
root_doc = "index"
|
|
||||||
source_suffix = [".md"]
|
|
||||||
# default_role let's use use `foo` instead of ``foo`` in rST
|
|
||||||
default_role = "literal"
|
|
||||||
|
|
||||||
docs = Path(__file__).parent.parent.absolute()
|
|
||||||
docs_source = docs / "source"
|
|
||||||
rest_api_yaml = docs_source / "_static" / "rest-api.yml"
|
|
||||||
|
|
||||||
|
|
||||||
# -- MyST configuration ------------------------------------------------------
|
|
||||||
# ref: https://myst-parser.readthedocs.io/en/latest/configuration.html
|
|
||||||
#
|
|
||||||
myst_heading_anchors = 2
|
|
||||||
|
|
||||||
myst_enable_extensions = [
|
|
||||||
# available extensions: https://myst-parser.readthedocs.io/en/latest/syntax/optional.html
|
|
||||||
"attrs_inline",
|
|
||||||
"colon_fence",
|
|
||||||
"deflist",
|
|
||||||
"fieldlist",
|
|
||||||
"substitution",
|
|
||||||
]
|
|
||||||
|
|
||||||
myst_substitutions = {
|
|
||||||
# date example: Dev 07, 2022
|
|
||||||
"date": datetime.date.today().strftime("%b %d, %Y").title(),
|
|
||||||
"node_min": "12",
|
|
||||||
"python_min": "3.8",
|
|
||||||
"version": jupyterhub.__version__,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# -- 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()
|
jupyterhub_app = JupyterHub()
|
||||||
|
|
||||||
|
|
||||||
@@ -104,8 +81,8 @@ class ConfigDirective(SphinxDirective):
|
|||||||
# The generated configuration file for this version
|
# The generated configuration file for this version
|
||||||
generated_config = jupyterhub_app.generate_config_file()
|
generated_config = jupyterhub_app.generate_config_file()
|
||||||
# post-process output
|
# post-process output
|
||||||
home_dir = os.environ["HOME"]
|
home_dir = os.environ['HOME']
|
||||||
generated_config = generated_config.replace(home_dir, "$HOME", 1)
|
generated_config = generated_config.replace(home_dir, '$HOME', 1)
|
||||||
par = nodes.literal_block(text=generated_config)
|
par = nodes.literal_block(text=generated_config)
|
||||||
return [par]
|
return [par]
|
||||||
|
|
||||||
@@ -121,246 +98,160 @@ class HelpAllDirective(SphinxDirective):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
# The output of the help command for this version
|
# The output of the help command for this version
|
||||||
buffer = io.StringIO()
|
buffer = StringIO()
|
||||||
with contextlib.redirect_stdout(buffer):
|
with redirect_stdout(buffer):
|
||||||
jupyterhub_app.print_help("--help-all")
|
jupyterhub_app.print_help('--help-all')
|
||||||
all_help = buffer.getvalue()
|
all_help = buffer.getvalue()
|
||||||
# post-process output
|
# post-process output
|
||||||
home_dir = os.environ["HOME"]
|
home_dir = os.environ['HOME']
|
||||||
all_help = all_help.replace(home_dir, "$HOME", 1)
|
all_help = all_help.replace(home_dir, '$HOME', 1)
|
||||||
par = nodes.literal_block(text=all_help)
|
par = nodes.literal_block(text=all_help)
|
||||||
return [par]
|
return [par]
|
||||||
|
|
||||||
|
|
||||||
class RestAPILinksDirective(SphinxDirective):
|
|
||||||
"""Directive to populate link targets for the REST API
|
|
||||||
|
|
||||||
The resulting nodes resolve xref targets,
|
|
||||||
but are not actually rendered in the final result
|
|
||||||
which is handled by a custom template.
|
|
||||||
"""
|
|
||||||
|
|
||||||
has_content = False
|
|
||||||
required_arguments = 0
|
|
||||||
optional_arguments = 0
|
|
||||||
final_argument_whitespace = False
|
|
||||||
option_spec = {}
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
targets = []
|
|
||||||
yaml = YAML(typ="safe")
|
|
||||||
with rest_api_yaml.open() as f:
|
|
||||||
api = yaml.load(f)
|
|
||||||
for path, path_spec in api["paths"].items():
|
|
||||||
for method, operation in path_spec.items():
|
|
||||||
operation_id = operation.get("operationId")
|
|
||||||
if not operation_id:
|
|
||||||
logger.warning(f"No operation id for {method} {path}")
|
|
||||||
continue
|
|
||||||
# 'id' is the id on the page (must match redoc anchor)
|
|
||||||
# 'name' is the name of the ref for use in our documents
|
|
||||||
target = nodes.target(
|
|
||||||
ids=[f"operation/{operation_id}"],
|
|
||||||
names=[f"rest-api-{operation_id}"],
|
|
||||||
)
|
|
||||||
targets.append(target)
|
|
||||||
self.state.document.note_explicit_target(target, target)
|
|
||||||
|
|
||||||
return targets
|
|
||||||
|
|
||||||
|
|
||||||
templates_path = ["_templates"]
|
|
||||||
|
|
||||||
|
|
||||||
def stage_redoc_js(app, exception):
|
|
||||||
"""Download redoc.js to our static files"""
|
|
||||||
if app.builder.name != "html":
|
|
||||||
logger.info(f"Skipping redoc download for builder: {app.builder.name}")
|
|
||||||
return
|
|
||||||
|
|
||||||
out_static = Path(app.builder.outdir) / "_static"
|
|
||||||
|
|
||||||
redoc_version = "2.1.3"
|
|
||||||
redoc_url = (
|
|
||||||
f"https://cdn.redoc.ly/redoc/v{redoc_version}/bundles/redoc.standalone.js"
|
|
||||||
)
|
|
||||||
dest = out_static / "redoc.js"
|
|
||||||
if not dest.exists():
|
|
||||||
logger.info(f"Downloading {redoc_url} -> {dest}")
|
|
||||||
urlretrieve(redoc_url, dest)
|
|
||||||
|
|
||||||
# stage fonts for redoc from google fonts
|
|
||||||
fonts_css_url = "https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700"
|
|
||||||
fonts_css_file = out_static / "redoc-fonts.css"
|
|
||||||
fonts_dir = out_static / "fonts"
|
|
||||||
fonts_dir.mkdir(exist_ok=True)
|
|
||||||
if not fonts_css_file.exists():
|
|
||||||
logger.info(f"Downloading {fonts_css_url} -> {fonts_css_file}")
|
|
||||||
urlretrieve(fonts_css_url, fonts_css_file)
|
|
||||||
|
|
||||||
# For each font external font URL,
|
|
||||||
# download the font and rewrite to a local URL
|
|
||||||
# The downloaded TTF fonts have license info in their metadata
|
|
||||||
with open(fonts_css_file) as f:
|
|
||||||
fonts_css = f.read()
|
|
||||||
|
|
||||||
fonts_css_changed = False
|
|
||||||
for font_url in re.findall(r'url\((https?[^\)]+)\)', fonts_css):
|
|
||||||
fonts_css_changed = True
|
|
||||||
filename = font_url.rpartition("/")[-1]
|
|
||||||
dest = fonts_dir / filename
|
|
||||||
local_url = str(dest.relative_to(fonts_css_file.parent))
|
|
||||||
fonts_css = fonts_css.replace(font_url, local_url)
|
|
||||||
if not dest.exists():
|
|
||||||
logger.info(f"Downloading {font_url} -> {dest}")
|
|
||||||
urlretrieve(font_url, dest)
|
|
||||||
|
|
||||||
if fonts_css_changed:
|
|
||||||
# rewrite font css with local URLs
|
|
||||||
with open(fonts_css_file, "w") as f:
|
|
||||||
logger.info(f"Rewriting URLs in {fonts_css_file}")
|
|
||||||
f.write(fonts_css)
|
|
||||||
|
|
||||||
|
|
||||||
def setup(app):
|
def setup(app):
|
||||||
app.connect("build-finished", stage_redoc_js)
|
app.add_css_file('custom.css')
|
||||||
app.add_css_file("custom.css")
|
app.add_directive('jupyterhub-generate-config', ConfigDirective)
|
||||||
app.add_directive("jupyterhub-generate-config", ConfigDirective)
|
app.add_directive('jupyterhub-help-all', HelpAllDirective)
|
||||||
app.add_directive("jupyterhub-help-all", HelpAllDirective)
|
|
||||||
app.add_directive("jupyterhub-rest-api-links", RestAPILinksDirective)
|
|
||||||
app.add_css_file("https://docs.jupyter.org/en/latest/_static/jupyter.css")
|
|
||||||
|
|
||||||
|
|
||||||
# -- Read The Docs -----------------------------------------------------------
|
source_suffix = ['.rst', '.md']
|
||||||
#
|
# source_encoding = 'utf-8-sig'
|
||||||
# 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"):
|
|
||||||
subprocess.check_call(["make", "metrics", "scopes"], cwd=str(docs))
|
|
||||||
|
|
||||||
|
# -- Options for HTML output ----------------------------------------------
|
||||||
|
|
||||||
# -- Spell checking ----------------------------------------------------------
|
# The theme to use for HTML and HTML Help pages.
|
||||||
# ref: https://sphinxcontrib-spelling.readthedocs.io/en/latest/customize.html#configuration-options
|
html_theme = 'pydata_sphinx_theme'
|
||||||
#
|
|
||||||
# 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'
|
||||||
|
|
||||||
# -- Options for HTML output -------------------------------------------------
|
# Paths that contain custom static files (such as style sheets)
|
||||||
# ref: https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
html_static_path = ['_static']
|
||||||
#
|
|
||||||
html_logo = "_static/images/logo/logo.png"
|
htmlhelp_basename = 'JupyterHubdoc'
|
||||||
html_favicon = "_static/images/logo/favicon.ico"
|
|
||||||
html_static_path = ["_static"]
|
|
||||||
|
|
||||||
html_theme = "jupyterhub_sphinx_theme"
|
|
||||||
html_theme_options = {
|
html_theme_options = {
|
||||||
"announcement": "🚀 Join us in San Diego · JupyterCon 2025 · Nov 4-5 · <a href=\"https://events.linuxfoundation.org/jupytercon/program/schedule/?ajs_aid=53afb00d-be65-4a99-9112-28cdaac99463\">SCHEDULE</a> · <a href=\"https://events.linuxfoundation.org/jupytercon/register/?ajs_aid=53afb00d-be65-4a99-9112-28cdaac99463\">REGISTER NOW</a>",
|
|
||||||
"header_links_before_dropdown": 6,
|
|
||||||
"icon_links": [
|
"icon_links": [
|
||||||
{
|
{
|
||||||
"name": "GitHub",
|
"name": "GitHub",
|
||||||
"url": "https://github.com/jupyterhub/jupyterhub",
|
"url": "https://github.com/jupyterhub/jupyterhub",
|
||||||
"icon": "fa-brands fa-github",
|
"icon": "fab fa-github-square",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Discourse",
|
||||||
|
"url": "https://discourse.jupyter.org/c/jupyterhub/10",
|
||||||
|
"icon": "fab fa-discourse",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
"use_edit_page_button": True,
|
"use_edit_page_button": True,
|
||||||
"navbar_align": "left",
|
"navbar_align": "left",
|
||||||
}
|
}
|
||||||
|
|
||||||
html_context = {
|
html_context = {
|
||||||
"github_user": "jupyterhub",
|
"github_user": "jupyterhub",
|
||||||
"github_repo": "jupyterhub",
|
"github_repo": "jupyterhub",
|
||||||
"github_version": "main",
|
"github_version": "main",
|
||||||
"doc_path": "docs/source",
|
"doc_path": "docs",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# -- Options for LaTeX output ---------------------------------------------
|
||||||
|
|
||||||
# -- Options for linkcheck builder -------------------------------------------
|
latex_elements = {
|
||||||
# ref: https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-the-linkcheck-builder
|
# 'papersize': 'letterpaper',
|
||||||
#
|
# 'pointsize': '10pt',
|
||||||
linkcheck_ignore = [
|
# 'preamble': '',
|
||||||
r"(.*)github\.com(.*)#", # javascript based anchors
|
# 'figure_align': 'htbp',
|
||||||
r"(.*)/#%21(.*)/(.*)", # /#!forum/jupyter - encoded anchor edge case
|
|
||||||
r"https?://(.*\.)?example\.(org|com)(/.*)?", # example links
|
|
||||||
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
|
|
||||||
"https://schema.jupyter.org/jupyterhub/.*", # schemas are not published yet
|
|
||||||
r"https?://(localhost|127.0.0.1).*", # ignore localhost references in auto-links
|
|
||||||
r"https://linux.die.net/.*", # linux.die.net seems to block requests from CI with 403 sometimes
|
|
||||||
# don't check links to unpublished advisories
|
|
||||||
r"https://github.com/jupyterhub/jupyterhub/security/advisories/.*",
|
|
||||||
# Occasionally blocks CI checks with 403
|
|
||||||
r"https://www\.mysql\.com",
|
|
||||||
r"https://www\.npmjs\.com",
|
|
||||||
# Occasionally blocks CI checks with SSL error
|
|
||||||
r"https://mediaspace\.msu\.edu/.*",
|
|
||||||
]
|
|
||||||
|
|
||||||
linkcheck_anchors_ignore = [
|
|
||||||
"/#!",
|
|
||||||
"/#%21",
|
|
||||||
]
|
|
||||||
|
|
||||||
# -- Intersphinx -------------------------------------------------------------
|
|
||||||
# ref: https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html#configuration
|
|
||||||
#
|
|
||||||
|
|
||||||
intersphinx_mapping = get_intersphinx_mapping(
|
|
||||||
packages={
|
|
||||||
"python",
|
|
||||||
"tornado",
|
|
||||||
"jupyter-server",
|
|
||||||
"nbgitpuller",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 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 the opengraph extension -------------------------------------
|
# latex_logo = None
|
||||||
# ref: https://github.com/wpilibsuite/sphinxext-opengraph#options
|
# latex_use_parts = False
|
||||||
#
|
# latex_show_pagerefs = False
|
||||||
# ogp_site_url is set automatically by RTD
|
# latex_show_urls = False
|
||||||
ogp_image = "_static/logo.png"
|
# latex_appendices = []
|
||||||
ogp_use_first_image = True
|
# latex_domain_indices = True
|
||||||
|
|
||||||
|
|
||||||
# -- Options for the rediraffe extension -------------------------------------
|
# -- manual page output -------------------------------------------------
|
||||||
# ref: https://github.com/wpilibsuite/sphinxext-rediraffe#readme
|
|
||||||
#
|
|
||||||
# This extension helps us relocate content without breaking links. If a
|
|
||||||
# document is moved internally, a redirect link should be configured as below to
|
|
||||||
# help us not break links.
|
|
||||||
#
|
|
||||||
# The workflow for adding redirects can be as follows:
|
|
||||||
# 1. Change "rediraffe_branch" below to point to the commit/ branch you
|
|
||||||
# want to base off the changes.
|
|
||||||
# 2. Option 1: run "make rediraffecheckdiff"
|
|
||||||
# a. Analyze the output of this command.
|
|
||||||
# b. Manually add the redirect entries to the "redirects.txt" file.
|
|
||||||
# Option 2: run "make rediraffewritediff"
|
|
||||||
# a. rediraffe will then automatically add the obvious redirects to redirects.txt.
|
|
||||||
# b. Analyze the output of the command for broken links.
|
|
||||||
# c. Check the "redirects.txt" file for any files that were moved/ renamed but are not listed.
|
|
||||||
# d. Manually add the redirects that have been mised by the automatic builder to "redirects.txt".
|
|
||||||
# Option 3: Do not use the commands above and, instead, do everything manually - by taking
|
|
||||||
# note of the files you have moved or renamed and adding them to the "redirects.txt" file.
|
|
||||||
#
|
|
||||||
# If you are basing changes off another branch/ commit, always change back
|
|
||||||
# rediraffe_branch to main before pushing your changes upstream.
|
|
||||||
#
|
|
||||||
rediraffe_branch = os.environ.get("REDIRAFFE_BRANCH", "main")
|
|
||||||
rediraffe_redirects = "redirects.txt"
|
|
||||||
|
|
||||||
# allow 80% match for autogenerated redirects
|
# One entry per manual page. List of tuples
|
||||||
rediraffe_auto_redirect_perc = 80
|
# (source start file, name, description, authors, manual section).
|
||||||
|
man_pages = [(master_doc, 'jupyterhub', 'JupyterHub Documentation', [author], 1)]
|
||||||
|
|
||||||
# rediraffe_redirects = {
|
# man_show_urls = False
|
||||||
# "old-file": "new-folder/new-file-name",
|
|
||||||
# }
|
|
||||||
|
# -- 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_mapping = {
|
||||||
|
'python': ('https://docs.python.org/3/', None),
|
||||||
|
'tornado': ('https://www.tornadoweb.org/en/stable/', None),
|
||||||
|
}
|
||||||
|
|
||||||
|
# -- 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'
|
||||||
|
@@ -1,42 +0,0 @@
|
|||||||
(contributing:community)=
|
|
||||||
|
|
||||||
# Community communication channels
|
|
||||||
|
|
||||||
```{note}
|
|
||||||
Our community is distributed across the world in various timezones, so please be patient if you do not get a response immediately!
|
|
||||||
```
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
```{note}
|
|
||||||
[Discourse] is open source.
|
|
||||||
```
|
|
||||||
|
|
||||||
We use [Jupyter instance of Discourse] for online discussions and support questions.
|
|
||||||
You can ask questions at [Jupyter instance of Discourse] if you are a first-time contributor to the JupyterHub project.
|
|
||||||
Everyone is welcome to bring ideas and questions at [Jupyter instance of Discourse].
|
|
||||||
|
|
||||||
We recommend that you first use [Jupyter instance of Discourse] as all past and current discussions on it are archived and searchable. Thus, all discussions remain useful and accessible to the whole community.
|
|
||||||
|
|
||||||
## Zulip
|
|
||||||
|
|
||||||
```{note}
|
|
||||||
[Zulip] is open source.
|
|
||||||
```
|
|
||||||
|
|
||||||
We use [Jupyter instance of Zulip] for online, real-time text chat; a place for more ephemeral discussions. When you're not on [Jupyter instance of Discourse], you can stop at [Jupyter instance of Zulip] 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](https://github.com/jupyterhub/zero-to-jupyterhub-k8s) or [The Littlest JupyterHub](https://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.
|
|
||||||
|
|
||||||
[Discourse]: https://www.discourse.org/
|
|
||||||
[Jupyter instance of Discourse]: https://discourse.jupyter.org
|
|
||||||
[Jupyter instance of Zulip]: https://jupyter.zulipchat.com/
|
|
||||||
[Zulip]: https://zulip.com/
|
|
30
docs/source/contributing/community.rst
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
.. _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>`_.
|
@@ -1,69 +0,0 @@
|
|||||||
(contributing:docs)=
|
|
||||||
|
|
||||||
# Contributing Documentation
|
|
||||||
|
|
||||||
Documentation is often more important than code. This page helps
|
|
||||||
you get set up on how to contribute to JupyterHub's documentation.
|
|
||||||
|
|
||||||
We use [Sphinx](https://www.sphinx-doc.org) to build our documentation. It takes
|
|
||||||
our documentation source files (written in [Markedly Structured Text (MyST)](https://mystmd.org/) and
|
|
||||||
stored under the `docs/source` directory) and converts it into various
|
|
||||||
formats for people to read.
|
|
||||||
|
|
||||||
## Building documentation locally
|
|
||||||
|
|
||||||
To make sure the documentation you write or
|
|
||||||
change renders correctly, it is good practice to test it locally.
|
|
||||||
|
|
||||||
```{note}
|
|
||||||
You will need Python and Git installed. Installation details are avaiable at {ref}`contributing:setup`.
|
|
||||||
```
|
|
||||||
|
|
||||||
1. Install the packages required to build the docs.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python3 -m pip install -r docs/requirements.txt
|
|
||||||
python3 -m pip install sphinx-autobuild
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Build the HTML version of the docs. This is the most commonly used
|
|
||||||
output format, so verifying it renders correctly is usually good
|
|
||||||
enough.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sphinx-autobuild docs/source/ docs/_build/html
|
|
||||||
```
|
|
||||||
|
|
||||||
This step will display any syntax or formatting errors in the documentation,
|
|
||||||
along with the filename / line number in which they occurred. Fix them,
|
|
||||||
and the HTML will be re-render automatically.
|
|
||||||
|
|
||||||
3. View the rendered documentation by opening <http://127.0.0.1:8000> in
|
|
||||||
a web browser.
|
|
||||||
|
|
||||||
(contributing-docs-conventions)=
|
|
||||||
|
|
||||||
## Documentation conventions
|
|
||||||
|
|
||||||
This section lists various conventions we use in our documentation. This is a
|
|
||||||
living document that grows over time, so feel free to add to it / change it!
|
|
||||||
|
|
||||||
Our entire documentation does not yet fully conform to these conventions yet,
|
|
||||||
so help in making it so would be appreciated!
|
|
||||||
|
|
||||||
### `pip` invocation
|
|
||||||
|
|
||||||
There are many ways to invoke a `pip` command, we recommend the following
|
|
||||||
approach:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python3 -m pip
|
|
||||||
```
|
|
||||||
|
|
||||||
This invokes `pip` explicitly using the `python3` binary that you are
|
|
||||||
currently using. This is the **recommended way** to invoke pip
|
|
||||||
in our documentation, since it is least likely to cause problems
|
|
||||||
with `python3` and `pip` being from different environments.
|
|
||||||
|
|
||||||
For more information on how to invoke `pip` commands, see
|
|
||||||
[the `pip` documentation](https://pip.pypa.io/en/stable/).
|
|
78
docs/source/contributing/docs.rst
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
.. _contributing/docs:
|
||||||
|
|
||||||
|
==========================
|
||||||
|
Contributing Documentation
|
||||||
|
==========================
|
||||||
|
|
||||||
|
Documentation is often more important than code. This page helps
|
||||||
|
you get set up on how to contribute documentation to JupyterHub.
|
||||||
|
|
||||||
|
Building documentation locally
|
||||||
|
==============================
|
||||||
|
|
||||||
|
We use `sphinx <http://sphinx-doc.org>`_ to build our documentation. It takes
|
||||||
|
our documentation source files (written in `markdown
|
||||||
|
<https://daringfireball.net/projects/markdown/>`_ or `reStructuredText
|
||||||
|
<https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html>`_ &
|
||||||
|
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`.
|
||||||
|
|
||||||
|
#. Install the packages required to build the docs.
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
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
|
||||||
|
enough.
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
cd docs
|
||||||
|
make html
|
||||||
|
|
||||||
|
This step will display any syntax or formatting errors in the documentation,
|
||||||
|
along with the filename / line number in which they occurred. Fix them,
|
||||||
|
and re-run the ``make html`` command to re-render the documentation.
|
||||||
|
|
||||||
|
#. View the rendered documentation by opening ``build/html/index.html`` in
|
||||||
|
a web browser.
|
||||||
|
|
||||||
|
.. 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>``.
|
||||||
|
|
||||||
|
|
||||||
|
.. _contributing/docs/conventions:
|
||||||
|
|
||||||
|
Documentation conventions
|
||||||
|
=========================
|
||||||
|
|
||||||
|
This section lists various conventions we use in our documentation. This is a
|
||||||
|
living document that grows over time, so feel free to add to it / change it!
|
||||||
|
|
||||||
|
Our entire documentation does not yet fully conform to these conventions yet,
|
||||||
|
so help in making it so would be appreciated!
|
||||||
|
|
||||||
|
``pip`` invocation
|
||||||
|
------------------
|
||||||
|
|
||||||
|
There are many ways to invoke a ``pip`` command, we recommend the following
|
||||||
|
approach:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
python3 -m pip
|
||||||
|
|
||||||
|
This invokes pip explicitly using the python3 binary that you are
|
||||||
|
currently using. This is the **recommended way** to invoke pip
|
||||||
|
in our documentation, since it is least likely to cause problems
|
||||||
|
with python3 and pip being from different environments.
|
||||||
|
|
||||||
|
For more information on how to invoke ``pip`` commands, see
|
||||||
|
`the pip documentation <https://pip.pypa.io/en/stable/>`_.
|
@@ -1,24 +0,0 @@
|
|||||||
(contributing)=
|
|
||||||
|
|
||||||
# Contributing
|
|
||||||
|
|
||||||
We want you to contribute to JupyterHub in ways that are most exciting
|
|
||||||
and useful to you. We value documentation, testing, bug reporting and code equally,
|
|
||||||
and are glad to have your contributions in whatever form you wish.
|
|
||||||
|
|
||||||
Be sure to first check 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)), which help keep our community welcoming to as many people as possible.
|
|
||||||
|
|
||||||
This section covers information about our community, as well as ways that you can connect and get involved.
|
|
||||||
|
|
||||||
```{toctree}
|
|
||||||
:maxdepth: 2
|
|
||||||
|
|
||||||
contributor-list
|
|
||||||
community
|
|
||||||
setup
|
|
||||||
docs
|
|
||||||
tests
|
|
||||||
roadmap
|
|
||||||
security
|
|
||||||
```
|
|
21
docs/source/contributing/index.rst
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
============
|
||||||
|
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,
|
||||||
|
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.
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 2
|
||||||
|
|
||||||
|
community
|
||||||
|
setup
|
||||||
|
docs
|
||||||
|
tests
|
||||||
|
roadmap
|
||||||
|
security
|
@@ -1,12 +1,10 @@
|
|||||||
(contributing:roadmap)=
|
|
||||||
|
|
||||||
# The JupyterHub roadmap
|
# The JupyterHub roadmap
|
||||||
|
|
||||||
This roadmap collects "next steps" for JupyterHub. It is about creating a
|
This roadmap collects "next steps" for JupyterHub. It is about creating a
|
||||||
shared understanding of the project's vision and direction amongst
|
shared understanding of the project's vision and direction amongst
|
||||||
the community of users, contributors, and maintainers.
|
the community of users, contributors, and maintainers.
|
||||||
The goal is to communicate priorities and upcoming release plans.
|
The goal is to communicate priorities and upcoming release plans.
|
||||||
It is not aimed at limiting contributions to what is listed here.
|
It is not a aimed at limiting contributions to what is listed here.
|
||||||
|
|
||||||
## Using the roadmap
|
## Using the roadmap
|
||||||
|
|
||||||
|
@@ -1,15 +0,0 @@
|
|||||||
(contributing:security)=
|
|
||||||
|
|
||||||
# Reporting security issues in Jupyter or JupyterHub
|
|
||||||
|
|
||||||
If you find a security vulnerability in Jupyter or JupyterHub,
|
|
||||||
whether it is a failure of the security model described in [Security Overview](explanation:security)
|
|
||||||
or a failure in implementation,
|
|
||||||
please report it!
|
|
||||||
|
|
||||||
Please use GitHub's "Report a Vulnerability" button under Security > Advisories on the appropriate repo,
|
|
||||||
e.g. [report here for JupyterHub](https://github.com/jupyterhub/jupyterhub/security/advisories).
|
|
||||||
|
|
||||||
You may also send an email to <mailto:security@ipython.org>, but the GitHub reporting system is preferred.
|
|
||||||
If you prefer to encrypt your security reports,
|
|
||||||
you can use {download}`this PGP public key </ipython_security.asc>`.
|
|
10
docs/source/contributing/security.rst
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
Reporting security issues in Jupyter or JupyterHub
|
||||||
|
==================================================
|
||||||
|
|
||||||
|
If you find a security vulnerability in Jupyter or JupyterHub,
|
||||||
|
whether it is a failure of the security model described in :doc:`../reference/websecurity`
|
||||||
|
or a failure in implementation,
|
||||||
|
please report it to security@ipython.org.
|
||||||
|
|
||||||
|
If you prefer to encrypt your security reports,
|
||||||
|
you can use :download:`this PGP public key </ipython_security.asc>`.
|
@@ -1,261 +0,0 @@
|
|||||||
(contributing:setup)=
|
|
||||||
|
|
||||||
# Setting up a development install
|
|
||||||
|
|
||||||
JupyterHub's continuous integration runs on [Ubuntu LTS](https://ubuntu.com/).
|
|
||||||
|
|
||||||
While JupyterHub is only tested on one [Linux distribution](https://en.wikipedia.org/wiki/Linux_distribution),
|
|
||||||
it should be fairly insensitive to variations between common [POXIS](https://en.wikipedia.org/wiki/POSIX) implementation,
|
|
||||||
though we don't have the bandwidth to verify this automatically and continuously.
|
|
||||||
|
|
||||||
Feel free to try it on your platform, and be sure to {ref}`let us know <contributing:community>` about any issues you encounter.
|
|
||||||
|
|
||||||
## System requirements
|
|
||||||
|
|
||||||
Your system **must** be able to run
|
|
||||||
|
|
||||||
- Python
|
|
||||||
- NodeJS
|
|
||||||
- Git
|
|
||||||
|
|
||||||
Our small team knows JupyterHub to work perfectly on macOS or Linux operating systems.
|
|
||||||
|
|
||||||
```{admonition} What about Windows?
|
|
||||||
Some users have reported that JupyterHub runs successfully on [Windows Subsystem for Linux (WSL)](https://learn.microsoft.com/en-us/windows/wsl/). We have no plans to support Windows outside of the WSL.
|
|
||||||
```
|
|
||||||
|
|
||||||
```{admonition} What about virtualization?
|
|
||||||
Using any form of virtualization (for example, [VirtualBox](https://www.virtualbox.org/), [Docker](https://www.docker.com/), [Podman](https://podman.io/), [WSL](https://learn.microsoft.com/en-us/windows/wsl/)) is a good way to get up and running quickly, though properly configuring the networking settings can be a bit tricky.
|
|
||||||
```
|
|
||||||
|
|
||||||
### Install Python
|
|
||||||
|
|
||||||
JupyterHub is written in the [Python](https://www.python.org) programming language and
|
|
||||||
requires you have at least version {{python_min}} installed locally. If you haven’t
|
|
||||||
installed Python before, the recommended way to install it is to use
|
|
||||||
[Miniforge](https://github.com/conda-forge/miniforge#download).
|
|
||||||
|
|
||||||
### Install NodeJS
|
|
||||||
|
|
||||||
Some JavaScript components require you have at least version {{node_min}} of [NodeJS](https://nodejs.org/en/) installed locally.
|
|
||||||
`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.
|
|
||||||
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) and [GitHub](https://github.com)
|
|
||||||
for development and 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.
|
|
||||||
|
|
||||||
## Install JupyterHub for development
|
|
||||||
|
|
||||||
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
|
|
||||||
[forum thread](https://discourse.jupyter.org/t/thoughts-on-using-tox/3497) for
|
|
||||||
a more detailed discussion.
|
|
||||||
:::
|
|
||||||
|
|
||||||
1. Clone the [JupyterHub Git repository](https://github.com/jupyterhub/jupyterhub)
|
|
||||||
to your computer.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone https://github.com/jupyterhub/jupyterhub
|
|
||||||
cd jupyterhub
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Make sure the `python` you installed and the `npm` you installed
|
|
||||||
are available to you on the command line.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python -V
|
|
||||||
```
|
|
||||||
|
|
||||||
This should return a version number greater than or equal to {{python_min}}.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm -v
|
|
||||||
```
|
|
||||||
|
|
||||||
This should return a version number greater than or equal to {{node_min}}.
|
|
||||||
|
|
||||||
3. Install `configurable-http-proxy` (required to run and test the default JupyterHub configuration):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm install -g configurable-http-proxy
|
|
||||||
```
|
|
||||||
|
|
||||||
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:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm install configurable-http-proxy
|
|
||||||
export PATH=$PATH:$(pwd)/node_modules/.bin
|
|
||||||
```
|
|
||||||
|
|
||||||
The second line needs to be run every time you open a new terminal.
|
|
||||||
|
|
||||||
If you are using conda you can instead run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
conda install configurable-http-proxy
|
|
||||||
```
|
|
||||||
|
|
||||||
4. Install an editable version of JupyterHub and its requirements for
|
|
||||||
development and testing. This lets you edit JupyterHub code in a text editor
|
|
||||||
and restart the JupyterHub process to see your code changes immediately.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python3 -m pip install --editable ".[test]"
|
|
||||||
```
|
|
||||||
|
|
||||||
5. You are now ready to start JupyterHub!
|
|
||||||
|
|
||||||
```bash
|
|
||||||
jupyterhub
|
|
||||||
```
|
|
||||||
|
|
||||||
6. You can access JupyterHub from your browser at
|
|
||||||
`http://localhost:8000` now.
|
|
||||||
|
|
||||||
Happy developing!
|
|
||||||
|
|
||||||
## Using DummyAuthenticator and SimpleLocalProcessSpawner
|
|
||||||
|
|
||||||
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
|
|
||||||
configuration:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
jupyterhub -f testing/jupyterhub_config.py
|
|
||||||
```
|
|
||||||
|
|
||||||
The test configuration enables a few things to make testing easier:
|
|
||||||
|
|
||||||
- use 'dummy' authentication and 'simple' spawner
|
|
||||||
- named servers are enabled
|
|
||||||
- listen only on localhost
|
|
||||||
- 'admin' is an admin user, if you want to test the admin page
|
|
||||||
- disable caching of static files
|
|
||||||
|
|
||||||
The default JupyterHub [authenticator](PAMAuthenticator)
|
|
||||||
and [spawner](LocalProcessSpawner)
|
|
||||||
require your system to have user accounts for each user you want to log in to
|
|
||||||
JupyterHub as.
|
|
||||||
|
|
||||||
DummyAuthenticator allows you to log in with any username and password,
|
|
||||||
while SimpleLocalProcessSpawner allows you to start servers without having to
|
|
||||||
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 and spawners, we recommend using both DummyAuthenticator and
|
|
||||||
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.
|
|
||||||
|
|
||||||
## Building frontend components
|
|
||||||
|
|
||||||
The testing configuration file also disables caching of static files,
|
|
||||||
which allows you to edit and rebuild these files without restarting JupyterHub.
|
|
||||||
|
|
||||||
If you are working on the admin react page, which is in the `jsx` directory, you can run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd jsx
|
|
||||||
npm install
|
|
||||||
npm run build:watch
|
|
||||||
```
|
|
||||||
|
|
||||||
to continuously rebuild the admin page, requiring only a refresh of the page.
|
|
||||||
|
|
||||||
If you are working on the frontend SCSS files, you can run the same `build:watch` command
|
|
||||||
in the _top level_ directory of the repo:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm install
|
|
||||||
npm run build:watch
|
|
||||||
```
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
This section lists common ways setting up your development environment may
|
|
||||||
fail, and how to fix them. Please add to the list if you encounter yet
|
|
||||||
another way it can fail!
|
|
||||||
|
|
||||||
### `lessc` not found
|
|
||||||
|
|
||||||
If the `python3 -m pip install --editable .` command fails and complains about
|
|
||||||
`lessc` being unavailable, you may need to explicitly install some
|
|
||||||
additional JavaScript dependencies:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm install
|
|
||||||
```
|
|
||||||
|
|
||||||
This will fetch client-side JavaScript dependencies necessary to compile
|
|
||||||
CSS.
|
|
||||||
|
|
||||||
You may also need to manually update JavaScript and CSS after some
|
|
||||||
development updates, with:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python3 setup.py js # fetch updated client-side js
|
|
||||||
python3 setup.py css # recompile CSS from LESS sources
|
|
||||||
python3 setup.py jsx # build React admin app
|
|
||||||
```
|
|
||||||
|
|
||||||
### Failed to bind XXX to `http://127.0.0.1:<port>/<path>`
|
|
||||||
|
|
||||||
This error can happen when there's already an application or a service using this
|
|
||||||
port.
|
|
||||||
|
|
||||||
Use the following command to find out which service is using this port.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
lsof -P -i TCP:<port> -sTCP:LISTEN
|
|
||||||
```
|
|
||||||
|
|
||||||
If nothing shows up, it likely means there's a system service that uses it but
|
|
||||||
your current user cannot list it. Reuse the same command with sudo.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo lsof -P -i TCP:<port> -sTCP:LISTEN
|
|
||||||
```
|
|
||||||
|
|
||||||
Depending on the result of the above commands, the most simple solution is to
|
|
||||||
configure JupyterHub to use a different port for the service that is failing.
|
|
||||||
|
|
||||||
As an example, the following is a frequently seen issue:
|
|
||||||
|
|
||||||
`Failed to bind hub to http://127.0.0.1:8081/hub/`
|
|
||||||
|
|
||||||
Using the procedure described above, start with:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
lsof -P -i TCP:8081 -sTCP:LISTEN
|
|
||||||
```
|
|
||||||
|
|
||||||
and if nothing shows up:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo lsof -P -i TCP:8081 -sTCP:LISTEN
|
|
||||||
```
|
|
||||||
|
|
||||||
Finally, depending on your findings, you can apply the following change and start JupyterHub again:
|
|
||||||
|
|
||||||
```python
|
|
||||||
c.JupyterHub.hub_port = 9081 # Or any other free port
|
|
||||||
```
|
|
188
docs/source/contributing/setup.rst
Normal file
@@ -0,0 +1,188 @@
|
|||||||
|
.. _contributing/setup:
|
||||||
|
|
||||||
|
================================
|
||||||
|
Setting up a development install
|
||||||
|
================================
|
||||||
|
|
||||||
|
System requirements
|
||||||
|
===================
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
Install Python
|
||||||
|
--------------
|
||||||
|
|
||||||
|
JupyterHub is written in the `Python <https://python.org>`_ programming language, and
|
||||||
|
requires you have at least version 3.5 installed locally. If you haven’t
|
||||||
|
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,
|
||||||
|
and **not** the ‘Python 2’ version!
|
||||||
|
|
||||||
|
Install nodejs
|
||||||
|
--------------
|
||||||
|
|
||||||
|
``configurable-http-proxy``, the default proxy implementation for
|
||||||
|
JupyterHub, is written in Javascript to run on `NodeJS
|
||||||
|
<https://nodejs.org/en/>`_. 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``.
|
||||||
|
|
||||||
|
Install git
|
||||||
|
-----------
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
.. note:: This guide does not attempt to dictate *how* development
|
||||||
|
environements should be isolated since that is a personal preference and can
|
||||||
|
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.
|
||||||
|
|
||||||
|
1. Clone the `JupyterHub git repository <https://github.com/jupyterhub/jupyterhub>`_
|
||||||
|
to your computer.
|
||||||
|
|
||||||
|
.. code:: bash
|
||||||
|
|
||||||
|
git clone https://github.com/jupyterhub/jupyterhub
|
||||||
|
cd jupyterhub
|
||||||
|
|
||||||
|
2. Make sure the ``python`` you installed and the ``npm`` you installed
|
||||||
|
are available to you on the command line.
|
||||||
|
|
||||||
|
.. code:: bash
|
||||||
|
|
||||||
|
python -V
|
||||||
|
|
||||||
|
This should return a version number greater than or equal to 3.5.
|
||||||
|
|
||||||
|
.. code:: bash
|
||||||
|
|
||||||
|
npm -v
|
||||||
|
|
||||||
|
This should return a version number greater than or equal to 5.0.
|
||||||
|
|
||||||
|
3. Install ``configurable-http-proxy``. This is required to run
|
||||||
|
JupyterHub.
|
||||||
|
|
||||||
|
.. code:: bash
|
||||||
|
|
||||||
|
npm install -g configurable-http-proxy
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
.. code:: bash
|
||||||
|
|
||||||
|
npm install configurable-http-proxy
|
||||||
|
export PATH=$PATH:$(pwd)/node_modules/.bin
|
||||||
|
|
||||||
|
The second line needs to be run every time you open a new terminal.
|
||||||
|
|
||||||
|
4. Install the python packages required for JupyterHub development.
|
||||||
|
|
||||||
|
.. code:: bash
|
||||||
|
|
||||||
|
python3 -m pip install -r dev-requirements.txt
|
||||||
|
python3 -m pip install -r requirements.txt
|
||||||
|
|
||||||
|
5. Setup 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>`__.
|
||||||
|
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!
|
||||||
|
|
||||||
|
.. code:: bash
|
||||||
|
|
||||||
|
jupyterhub
|
||||||
|
|
||||||
|
8. You can access JupyterHub from your browser at
|
||||||
|
``http://localhost:8000`` now.
|
||||||
|
|
||||||
|
Happy developing!
|
||||||
|
|
||||||
|
Using DummyAuthenticator & SimpleLocalProcessSpawner
|
||||||
|
====================================================
|
||||||
|
|
||||||
|
To simplify testing of JupyterHub, it’s 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
|
||||||
|
configuration:
|
||||||
|
|
||||||
|
.. code:: bash
|
||||||
|
|
||||||
|
jupyterhub -f testing/jupyterhub_config.py
|
||||||
|
|
||||||
|
The default JupyterHub `authenticator
|
||||||
|
<https://jupyterhub.readthedocs.io/en/stable/reference/authenticators.html#the-default-pam-authenticator>`_
|
||||||
|
& `spawner
|
||||||
|
<https://jupyterhub.readthedocs.io/en/stable/api/spawner.html#localprocessspawner>`_
|
||||||
|
require your system to have user accounts for each user you want to log in to
|
||||||
|
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
|
||||||
|
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
|
||||||
|
parts, use only SimpleLocalProcessSpawner. Similarly, if you are working on
|
||||||
|
just spawner related parts, use only DummyAuthenticator.
|
||||||
|
|
||||||
|
Troubleshooting
|
||||||
|
===============
|
||||||
|
|
||||||
|
This section lists common ways setting up your development environment may
|
||||||
|
fail, and how to fix them. Please add to the list if you encounter yet
|
||||||
|
another way it can fail!
|
||||||
|
|
||||||
|
``lessc`` not found
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
If the ``python3 -m pip install --editable .`` command fails and complains about
|
||||||
|
``lessc`` being unavailable, you may need to explicitly install some
|
||||||
|
additional JavaScript dependencies:
|
||||||
|
|
||||||
|
.. code:: bash
|
||||||
|
|
||||||
|
npm install
|
||||||
|
|
||||||
|
This will fetch client-side JavaScript dependencies necessary to compile
|
||||||
|
CSS.
|
||||||
|
|
||||||
|
You may also need to manually update JavaScript and CSS after some
|
||||||
|
development updates, with:
|
||||||
|
|
||||||
|
.. code:: bash
|
||||||
|
|
||||||
|
python3 setup.py js # fetch updated client-side js
|
||||||
|
python3 setup.py css # recompile CSS from LESS sources
|
@@ -1,165 +0,0 @@
|
|||||||
(contributing-tests)=
|
|
||||||
|
|
||||||
# Testing JupyterHub and linting code
|
|
||||||
|
|
||||||
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 the tests. You
|
|
||||||
can find them under the [jupyterhub/tests](https://github.com/jupyterhub/jupyterhub/tree/main/jupyterhub/tests) directory in the Git repository.
|
|
||||||
|
|
||||||
```{note}
|
|
||||||
Before run any test, 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 development environment is properly set up for tests to run.
|
|
||||||
```
|
|
||||||
|
|
||||||
```{note}
|
|
||||||
For details of `pytest`, refer to the [`pytest` usage documentation](https://pytest.readthedocs.io/en/latest/usage.html).
|
|
||||||
```
|
|
||||||
|
|
||||||
## Running all the tests
|
|
||||||
|
|
||||||
You can run all tests in JupyterHub
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pytest -v jupyterhub/tests
|
|
||||||
```
|
|
||||||
|
|
||||||
This should display progress as it runs all the tests, printing
|
|
||||||
information about any test failures as they occur.
|
|
||||||
|
|
||||||
If you wish to confirm test coverage the run tests with the `--cov` flag:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pytest -v --cov=jupyterhub jupyterhub/tests
|
|
||||||
```
|
|
||||||
|
|
||||||
## Running tests from a specific file
|
|
||||||
|
|
||||||
You can also run tests in just a specific file:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pytest -v jupyterhub/tests/<test-file-name>
|
|
||||||
```
|
|
||||||
|
|
||||||
## Running a single test
|
|
||||||
|
|
||||||
To run a specific test only, you can do:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pytest -v jupyterhub/tests/<test-file-name>::<test-name>
|
|
||||||
```
|
|
||||||
|
|
||||||
This runs the test with function name `<test-name>` defined in
|
|
||||||
`<test-file-name>`. This is very useful when you are iteratively
|
|
||||||
developing a single test.
|
|
||||||
|
|
||||||
For example, to run the test `test_shutdown` in the file `test_api.py`,
|
|
||||||
you would run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pytest -v jupyterhub/tests/test_api.py::test_shutdown
|
|
||||||
```
|
|
||||||
|
|
||||||
## Test organisation
|
|
||||||
|
|
||||||
The tests live in `jupyterhub/tests` and are organized roughly into:
|
|
||||||
|
|
||||||
1. `test_api.py`: tests the REST API
|
|
||||||
2. `test_pages.py`: tests loading the HTML pages
|
|
||||||
|
|
||||||
and other collections of tests for different components.
|
|
||||||
When writing a new test, there should usually be a test of
|
|
||||||
similar functionality already written and related tests should
|
|
||||||
be added nearby.
|
|
||||||
|
|
||||||
The fixtures live in `jupyterhub/tests/conftest.py`. There are
|
|
||||||
fixtures that can be used for JupyterHub components, such as:
|
|
||||||
|
|
||||||
- `app`: an instance of JupyterHub with mocked parts
|
|
||||||
- `auth_state_enabled`: enables persisting auth_state (like authentication tokens)
|
|
||||||
- `db`: a sqlite in-memory DB session
|
|
||||||
- `` io_loop` ``: a Tornado event loop
|
|
||||||
- `event_loop`: a new asyncio event loop
|
|
||||||
- `user`: creates a new temporary user
|
|
||||||
- `admin_user`: creates a new temporary admin user
|
|
||||||
- single user servers
|
|
||||||
\- `cleanup_after`: allows cleanup of single user servers between tests
|
|
||||||
- mocked service
|
|
||||||
\- `MockServiceSpawner`: a spawner that mocks services for testing with a short poll interval
|
|
||||||
\- `` mockservice` ``: mocked service with no external service url
|
|
||||||
\- `mockservice_url`: mocked service with a url to test external services
|
|
||||||
|
|
||||||
And fixtures to add functionality or spawning behavior:
|
|
||||||
|
|
||||||
- `admin_access`: grants admin access
|
|
||||||
- `` no_patience` ``: sets slow-spawning timeouts to zero
|
|
||||||
- `slow_spawn`: enables the SlowSpawner (a spawner that takes a few seconds to start)
|
|
||||||
- `never_spawn`: enables the NeverSpawner (a spawner that will never start)
|
|
||||||
- `bad_spawn`: enables the BadSpawner (a spawner that fails immediately)
|
|
||||||
- `slow_bad_spawn`: enables the SlowBadSpawner (a spawner that fails after a short delay)
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
### The Pytest-Asyncio Plugin
|
|
||||||
|
|
||||||
When testing the various JupyterHub components and their various implementations, it sometimes becomes necessary to have a running instance of JupyterHub to test against.
|
|
||||||
The [`app`](https://github.com/jupyterhub/jupyterhub/blob/270b61992143b29af8c2fab90c4ed32f2f6fe209/jupyterhub/tests/conftest.py#L60) fixture mocks a JupyterHub application for use in testing by:
|
|
||||||
|
|
||||||
- enabling ssl if internal certificates are available
|
|
||||||
- creating an instance of [MockHub](https://github.com/jupyterhub/jupyterhub/blob/270b61992143b29af8c2fab90c4ed32f2f6fe209/jupyterhub/tests/mocking.py#L221) using any provided configurations as arguments
|
|
||||||
- initializing the mocked instance
|
|
||||||
- starting the mocked instance
|
|
||||||
- finally, a registered finalizer function performs a cleanup and stops the mocked instance
|
|
||||||
|
|
||||||
The JupyterHub test suite uses the [pytest-asyncio plugin](https://pytest-asyncio.readthedocs.io/en/latest/) that handles [event-loop](https://docs.python.org/3/library/asyncio-eventloop.html) integration in [Tornado](https://www.tornadoweb.org/en/stable/) applications. This allows for the use of top-level awaits when calling async functions or [fixtures](https://docs.pytest.org/en/6.2.x/fixture.html#what-fixtures-are) during testing. All test functions and fixtures labelled as `async` will run on the same event loop.
|
|
||||||
|
|
||||||
```{note}
|
|
||||||
With the introduction of [top-level awaits](https://piccolo-orm.com/blog/top-level-await-in-python/), the use of the `io_loop` fixture of the [pytest-tornado plugin](https://www.tornadoweb.org/en/stable/ioloop.html) is no longer necessary. It was initially used to call coroutines. With the upgrades made to `pytest-asyncio`, this usage is now deprecated. It is now, only utilized within the JupyterHub test suite to ensure complete cleanup of resources used during testing such as open file descriptors. This is demonstrated in this [pull request](https://github.com/jupyterhub/jupyterhub/pull/4332).
|
|
||||||
More information is provided below.
|
|
||||||
```
|
|
||||||
|
|
||||||
One of the general goals of the [JupyterHub Pytest Plugin project](https://github.com/jupyterhub/pytest-jupyterhub) is to ensure the MockHub cleanup fully closes and stops all utilized resources during testing so the use of the `io_loop` fixture for teardown is not necessary. This was highlighted in this [issue](https://github.com/jupyterhub/pytest-jupyterhub/issues/30)
|
|
||||||
|
|
||||||
For more information on asyncio and event-loops, here are some resources:
|
|
||||||
|
|
||||||
- **Read**: [Introduction to the Python event loop](https://www.pythontutorial.net/python-concurrency/python-event-loop)
|
|
||||||
- **Read**: [Overview of Async IO in Python 3.7](https://stackabuse.com/overview-of-async-io-in-python-3-7)
|
|
||||||
- **Watch**: [Asyncio: Understanding Async / Await in Python](https://www.youtube.com/watch?v=bs9tlDFWWdQ)
|
|
||||||
- **Watch**: [Learn Python's AsyncIO #2 - The Event Loop](https://www.youtube.com/watch?v=E7Yn5biBZ58)
|
|
||||||
|
|
||||||
## Troubleshooting Test Failures
|
|
||||||
|
|
||||||
### All the tests are failing
|
|
||||||
|
|
||||||
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 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.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pip install pre-commit
|
|
||||||
pre-commit install --install-hooks
|
|
||||||
```
|
|
||||||
|
|
||||||
To run pre-commit manually you would do:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# check for changes to code not yet committed
|
|
||||||
pre-commit run
|
|
||||||
|
|
||||||
# check for changes also in already committed code
|
|
||||||
pre-commit run --all-files
|
|
||||||
```
|
|
||||||
|
|
||||||
You may also install [black integration](https://github.com/psf/black#editor-integration)
|
|
||||||
into your text editor to format code automatically.
|
|
68
docs/source/contributing/tests.rst
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
.. _contributing/tests:
|
||||||
|
|
||||||
|
==================
|
||||||
|
Testing JupyterHub
|
||||||
|
==================
|
||||||
|
|
||||||
|
Unit test help 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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
#. You can run all tests in JupyterHub
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
pytest -v jupyterhub/tests
|
||||||
|
|
||||||
|
This should display progress as it runs all the tests, printing
|
||||||
|
information about any test failures as they occur.
|
||||||
|
|
||||||
|
If you wish to confirm test coverage the run tests with the `--cov` flag:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
pytest -v --cov=jupyterhub jupyterhub/tests
|
||||||
|
|
||||||
|
#. You can also run tests in just a specific file:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
pytest -v jupyterhub/tests/<test-file-name>
|
||||||
|
|
||||||
|
#. To run a specific test only, you can do:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
pytest -v jupyterhub/tests/<test-file-name>::<test-name>
|
||||||
|
|
||||||
|
This runs the test with function name ``<test-name>`` defined in
|
||||||
|
``<test-file-name>``. This is very useful when you are iteratively
|
||||||
|
developing a single test.
|
||||||
|
|
||||||
|
For example, to run the test ``test_shutdown`` in the file ``test_api.py``,
|
||||||
|
you would run:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
pytest -v jupyterhub/tests/test_api.py::test_shutdown
|
||||||
|
|
||||||
|
|
||||||
|
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.
|
@@ -1,5 +1,3 @@
|
|||||||
(contributing:contributors)=
|
|
||||||
|
|
||||||
# Contributors
|
# Contributors
|
||||||
|
|
||||||
Project Jupyter thanks the following people for their help and
|
Project Jupyter thanks the following people for their help and
|
||||||
@@ -122,4 +120,3 @@ contribution on JupyterHub:
|
|||||||
- yuvipanda
|
- yuvipanda
|
||||||
- zoltan-fedor
|
- zoltan-fedor
|
||||||
- zonca
|
- zonca
|
||||||
- Neeraj Natu
|
|
46
docs/source/events/index.rst
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
Eventlogging 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_.
|
||||||
|
|
||||||
|
.. _logging: https://docs.python.org/3/library/logging.html
|
||||||
|
.. _`Telemetry System`: https://github.com/jupyter/telemetry
|
||||||
|
.. _`JSON schemas`: https://json-schema.org/
|
||||||
|
|
||||||
|
How to emit events
|
||||||
|
------------------
|
||||||
|
|
||||||
|
Event logging is handled by its ``Eventlog`` object. This leverages Python's standing logging_ library to emit, filter, and collect event data.
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
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:
|
||||||
|
|
||||||
|
.. code-block::
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
|
c.EventLog.handlers = [
|
||||||
|
logging.FileHandler('event.log'),
|
||||||
|
]
|
||||||
|
|
||||||
|
c.EventLog.allowed_schemas = [
|
||||||
|
'hub.jupyter.org/server-action'
|
||||||
|
]
|
||||||
|
|
||||||
|
The output is a file, ``"event.log"``, with events recorded as JSON data.
|
||||||
|
|
||||||
|
|
||||||
|
.. _page:
|
||||||
|
|
||||||
|
Event schemas
|
||||||
|
-------------
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 2
|
||||||
|
|
||||||
|
server-actions.rst
|
@@ -1,3 +1 @@
|
|||||||
```{eval-rst}
|
|
||||||
.. jsonschema:: ../../../jupyterhub/event-schemas/server-actions/v1.yaml
|
.. jsonschema:: ../../../jupyterhub/event-schemas/server-actions/v1.yaml
|
||||||
```
|
|
@@ -1,310 +0,0 @@
|
|||||||
(explanation:capacity-planning)=
|
|
||||||
|
|
||||||
# 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://z2jh.jupyter.org
|
|
||||||
|
|
||||||
(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.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
[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://z2jh.jupyter.org) documentation on
|
|
||||||
- [projecting costs](https://z2jh.jupyter.org/en/latest/administrator/cost.html)
|
|
||||||
- [configuring user resources](https://z2jh.jupyter.org/en/latest/jupyterhub/customizing/user-resources.html)
|
|
||||||
- Cloud platform cost calculators:
|
|
||||||
- [Google Cloud](https://cloud.google.com/products/calculator/)
|
|
||||||
- [Amazon AWS](https://calculator.aws)
|
|
||||||
- [Microsoft Azure](https://azure.microsoft.com/en-us/pricing/calculator/)
|
|
@@ -1,430 +0,0 @@
|
|||||||
(explanation:concepts)=
|
|
||||||
|
|
||||||
# JupyterHub: A conceptual overview
|
|
||||||
|
|
||||||
```{warning}
|
|
||||||
This page could be missing cross-links to other parts of
|
|
||||||
the documentation. You can help by adding them!
|
|
||||||
```
|
|
||||||
|
|
||||||
JupyterHub is not what you think it is. Most things you think are
|
|
||||||
part of JupyterHub are actually handled by some other component, for
|
|
||||||
example the spawner or notebook server itself, and it's not always
|
|
||||||
obvious how the parts relate. The knowledge contained here hasn't
|
|
||||||
been assembled in one place before, and is essential to understand
|
|
||||||
when setting up a sufficiently complex Jupyter(Hub) setup.
|
|
||||||
|
|
||||||
This document was originally written to assist in debugging: very
|
|
||||||
often, the actual problem is not where one thinks it is and thus
|
|
||||||
people can't easily debug. In order to tell this story, we start at
|
|
||||||
JupyterHub and go all the way down to the fundamental components of
|
|
||||||
Jupyter.
|
|
||||||
|
|
||||||
In this document, we occasionally leave things out or bend the truth
|
|
||||||
where it helps in explanation, and give our explanations in terms of
|
|
||||||
Python even though Jupyter itself is language-neutral. The "(&)"
|
|
||||||
symbol highlights important points where this page leaves out or bends
|
|
||||||
the truth for simplification of explanation, but there is more if you
|
|
||||||
dig deeper.
|
|
||||||
|
|
||||||
This guide is long, but after reading it you will be know of all major
|
|
||||||
components in the Jupyter ecosystem and everything else you read
|
|
||||||
should make sense.
|
|
||||||
|
|
||||||
## What is Jupyter?
|
|
||||||
|
|
||||||
Before we get too far, let's remember what our end goal is. A
|
|
||||||
**Jupyter Notebook** is nothing more than a Python(&) process
|
|
||||||
which is getting commands from a web browser and displaying the output
|
|
||||||
via that browser. What the process actually sees is roughly like
|
|
||||||
getting commands on standard input(&) and writing to standard
|
|
||||||
output(&). There is nothing intrinsically special about this process
|
|
||||||
|
|
||||||
- it can do anything a normal Python process can do, and nothing more.
|
|
||||||
The **Jupyter kernel** handles capturing output and converting things
|
|
||||||
such as graphics to a form usable by the browser.
|
|
||||||
|
|
||||||
Everything we explain below is building up to this, going through many
|
|
||||||
different layers which give you many ways of customizing how this
|
|
||||||
process runs.
|
|
||||||
|
|
||||||
## JupyterHub
|
|
||||||
|
|
||||||
**JupyterHub** is the central piece that provides multi-user
|
|
||||||
login capabilities. Despite this, the end user only briefly interacts with
|
|
||||||
JupyterHub and most of the actual Jupyter session does not relate to
|
|
||||||
the hub at all: the hub mainly handles authentication and creating (JupyterHub calls it "spawning") the
|
|
||||||
single-user server. In short, anything which is related to _starting_
|
|
||||||
the user's workspace/environment is about JupyterHub, anything about
|
|
||||||
_running_ usually isn't.
|
|
||||||
|
|
||||||
If you have problems connecting the authentication, spawning, and the
|
|
||||||
proxy (explained below), the issue is usually with JupyterHub. To
|
|
||||||
debug, JupyterHub has extensive logs which get printed to its console
|
|
||||||
and can be used to discover most problems.
|
|
||||||
|
|
||||||
The main pieces of JupyterHub are:
|
|
||||||
|
|
||||||
### Authenticator
|
|
||||||
|
|
||||||
JupyterHub itself doesn't actually manage your users. It has a
|
|
||||||
database of users, but it is usually connected with some other system
|
|
||||||
that manages the usernames and passwords. When someone tries to log
|
|
||||||
in to JupyteHub, it asks the
|
|
||||||
**authenticator**([basics](authenticators),
|
|
||||||
[reference](../reference/authenticators)) if the
|
|
||||||
username/password is valid(&). The authenticator returns a username(&),
|
|
||||||
which is passed on to the spawner, which has to use it to start that
|
|
||||||
user's environment. The authenticator can also return user
|
|
||||||
groups and admin status of users, so that JupyterHub can do some
|
|
||||||
higher-level management.
|
|
||||||
|
|
||||||
The following authenticators are included with JupyterHub:
|
|
||||||
|
|
||||||
- **PAMAuthenticator** uses the standard Unix/Linux operating system
|
|
||||||
functions to check users. Roughly, if someone already has access to
|
|
||||||
the machine (they can log in by ssh), they will be able to log in to
|
|
||||||
JupyterHub without any other setup. Thus, JupyterHub fills the role
|
|
||||||
of a ssh server, but providing a web-browser based way to access the
|
|
||||||
machine.
|
|
||||||
|
|
||||||
There are [plenty of others to choose from](authenticators-reference).
|
|
||||||
You can connect to almost any other existing service to manage your
|
|
||||||
users. You either use all users from this other service (e.g. your
|
|
||||||
company), or enable only the allowed users (e.g. your group's
|
|
||||||
Github usernames). Some other popular authenticators include:
|
|
||||||
|
|
||||||
- **OAuthenticator** uses the standard OAuth protocol to verify users.
|
|
||||||
For example, you can easily use Github to authenticate your users -
|
|
||||||
people have a "click to login with Github" button. This is often
|
|
||||||
done with a allowlist to only allow certain users.
|
|
||||||
|
|
||||||
- **NativeAuthenticator** actually stores and validates its own
|
|
||||||
usernames and passwords, unlike most other authenticators. Thus,
|
|
||||||
you can manage all your users within JupyterHub only.
|
|
||||||
|
|
||||||
- There are authenticators for LTI (learning management systems),
|
|
||||||
Shibboleth, Kerberos - and so on.
|
|
||||||
|
|
||||||
The authenticator is configured with the
|
|
||||||
`c.JupyterHub.authenticator_class` configuration option in the
|
|
||||||
`jupyterhub_config.py` file.
|
|
||||||
|
|
||||||
The authenticator runs internally to the Hub process but communicates
|
|
||||||
with outside services.
|
|
||||||
|
|
||||||
If you have trouble logging in, this is usually a problem of the
|
|
||||||
authenticator. The authenticator logs are part of the the JupyterHub
|
|
||||||
logs, but there may also be relevant information in whatever external
|
|
||||||
services you are using.
|
|
||||||
|
|
||||||
### Spawner
|
|
||||||
|
|
||||||
The **spawner** ([basics](spawners),
|
|
||||||
[reference](../reference/spawners)) is the real core of
|
|
||||||
JupyterHub: when someone wants a notebook server, the spawner allocates
|
|
||||||
resources and starts the server. The notebook server could run on the
|
|
||||||
same machine as JupyterHub, on another machine, on some cloud service,
|
|
||||||
or more. Administrators can limit resources (CPU, memory) or isolate users
|
|
||||||
from each other - if the spawner supports it. They can also do no
|
|
||||||
limiting and allow any user to access any other user's files if they
|
|
||||||
are not configured properly.
|
|
||||||
|
|
||||||
Some basic spawners included in JupyterHub are:
|
|
||||||
|
|
||||||
- **LocalProcessSpawner** is built into JupyterHub. Upon launch it tries
|
|
||||||
to switch users to the given username (`su` (&)) and start the
|
|
||||||
notebook server. It requires that the hub be run as root (because
|
|
||||||
only root has permission to start processes as other user IDs).
|
|
||||||
LocalProcessSpawner is no different than a user logging in with
|
|
||||||
something like `ssh` and running `jupyter notebook`. PAMAuthenticator and
|
|
||||||
LocalProcessSpawner is the most basic way of using JupyterHub (and
|
|
||||||
what it does out of the box) and makes the hub not too dissimilar to
|
|
||||||
an advanced ssh server.
|
|
||||||
|
|
||||||
There are [many more advanced spawners](/reference/spawners), and to
|
|
||||||
show the diversity of spawning strategys some are listed below:
|
|
||||||
|
|
||||||
- **SudoSpawner** is like LocalProcessSpawner but lets you run
|
|
||||||
JupyterHub without root. `sudo` has to be configured to allow the
|
|
||||||
hub's user to run processes under other user IDs.
|
|
||||||
|
|
||||||
- **SystemdSpawner** uses Systemd to start other processes. It can
|
|
||||||
isolate users from each other and provide resource limiting.
|
|
||||||
|
|
||||||
- **DockerSpawner** runs stuff in Docker, a containerization system.
|
|
||||||
This lets you fully isolate users, limit CPU, memory, and provide
|
|
||||||
other container images to fully customize the environment.
|
|
||||||
|
|
||||||
- **KubeSpawner** runs on the Kubernetes, a cloud orchestration
|
|
||||||
system. The spawner can easily limit users and provide cloud
|
|
||||||
scaling - but the spawner doesn't actually do that, Kubernetes
|
|
||||||
does. The spawner just tells Kubernetes what to do. If you want to
|
|
||||||
get KubeSpawner to do something, first you would figure out how to
|
|
||||||
do it in Kubernetes, then figure out how to tell KubeSpawner to tell
|
|
||||||
Kubernetes that. Actually... this is true for most spawners.
|
|
||||||
|
|
||||||
- **BatchSpawner** runs on computer clusters with batch job scheduling
|
|
||||||
systems (e.g Slurm, HTCondor, PBS, etc). The user processes are run
|
|
||||||
as batch jobs, having access to all the data and software that the
|
|
||||||
users normally will.
|
|
||||||
|
|
||||||
In short, spawners are the interface to the rest of the operating
|
|
||||||
system, and to configure them right you need to know a bit about how
|
|
||||||
the corresponding operating system service works.
|
|
||||||
|
|
||||||
The spawner is responsible for the environment of the single-user
|
|
||||||
notebook servers (described in the next section). In the end, it just
|
|
||||||
makes a choice about how to start these processes: for example, the
|
|
||||||
Docker spawner starts a normal Docker container and runs the right
|
|
||||||
command inside of it. Thus, the spawner is responsible for setting
|
|
||||||
what kind of software and data is available to the user.
|
|
||||||
|
|
||||||
The spawner runs internally to the Hub process but communicates with
|
|
||||||
outside services. It is configured by `c.JupyterHub.spawner_class` in
|
|
||||||
`jupyterhub_config.py`.
|
|
||||||
|
|
||||||
If a user tries to launch a notebook server and it doesn't work, the
|
|
||||||
error is usually with the spawner or the notebook server (as described
|
|
||||||
in the next section). Each spawner outputs some logs to the main
|
|
||||||
JupyterHub logs, but may also have logs in other places depending on
|
|
||||||
what services it interacts with (for example, the Docker spawner
|
|
||||||
somehow puts logs in the Docker system services, Kubernetes through
|
|
||||||
the `kubectl` API).
|
|
||||||
|
|
||||||
### Proxy
|
|
||||||
|
|
||||||
The JupyterHub **proxy** relays connections between the users
|
|
||||||
and their single-user notebook servers. What this basically means is
|
|
||||||
that the hub itself can shut down and the proxy can continue to
|
|
||||||
allow users to communicate with their notebook servers. (This
|
|
||||||
further emphasizes that the hub is responsible for starting, not
|
|
||||||
running, the notebooks). By default, the hub starts the proxy
|
|
||||||
automatically
|
|
||||||
and stops the proxy when the hub stops (so that connections get
|
|
||||||
interrupted). But when you [configure the proxy to run
|
|
||||||
separately](howto:separate-proxy),
|
|
||||||
user's connections will continue to work even without the hub.
|
|
||||||
|
|
||||||
The default proxy is **ConfigurableHttpProxy** which is simple but
|
|
||||||
effective. A more advanced option is the [**Traefik Proxy**](https://blog.jupyter.org/introducing-traefikproxy-a-new-jupyterhub-proxy-based-on-traefik-4839e972faf6),
|
|
||||||
which gives you redundancy and high-availability.
|
|
||||||
|
|
||||||
When users "connect to JupyterHub", they _always_ first connect to the
|
|
||||||
proxy and the proxy relays the connection to the hub. Thus, the proxy
|
|
||||||
is responsible for SSL and accepting connections from the rest of the
|
|
||||||
internet. The user uses the hub to authenticate and start the server,
|
|
||||||
and then the hub connects back to the proxy to adjust the proxy routes
|
|
||||||
for the user's server (e.g. the web path `/user/someone` redirects to
|
|
||||||
the server of someone at a certain internal address). The proxy has
|
|
||||||
to be able to internally connect to both the hub and all the
|
|
||||||
single-user servers.
|
|
||||||
|
|
||||||
The proxy always runs as a separate process to JupyterHub (even though
|
|
||||||
JupyterHub can start it for you). JupyterHub has one set of
|
|
||||||
configuration options for the proxy addresses (`bind_url`) and one for
|
|
||||||
the hub (`hub_bind_url`). If `bind_url` is given, it is just passed to
|
|
||||||
the automatic proxy to tell it what to do.
|
|
||||||
|
|
||||||
If you have problems after users are redirected to their single-user
|
|
||||||
notebook servers, or making the first connection to the hub, it is
|
|
||||||
usually caused by the proxy. The ConfigurableHttpProxy's logs are
|
|
||||||
mixed with JupyterHub's logs if it's started through the hub (the
|
|
||||||
default case), otherwise from whatever system runs the proxy (if you
|
|
||||||
do configure it, you'll know).
|
|
||||||
|
|
||||||
### Services
|
|
||||||
|
|
||||||
JupyterHub has the concept of **services** ([basics](tutorial:services),
|
|
||||||
[reference](services-reference)), which are other web services
|
|
||||||
started by the hub, but otherwise are not necessarily related to the
|
|
||||||
hub itself. They are often used to do things related to Jupyter
|
|
||||||
(things that user interacts with, usually not the hub), but could
|
|
||||||
always be run some other way. Running from the hub provides an easy
|
|
||||||
way to get Hub API tokens and authenticate users against the hub. It
|
|
||||||
can also automatically add a proxy route to forward web requests to
|
|
||||||
that service.
|
|
||||||
|
|
||||||
A common example of a service is the [cull idle
|
|
||||||
servers](https://github.com/jupyterhub/jupyterhub-idle-culler)
|
|
||||||
service. When started by the hub, it automatically gets admin API
|
|
||||||
tokens. It uses the API to list all running servers, compare against
|
|
||||||
activity timeouts, and shut down servers exceeding the limits. Even
|
|
||||||
though this is an intrinsic part of JupyterHub, it is only loosely
|
|
||||||
coupled and running as a service provides convenience of
|
|
||||||
authentication - it could be just as well run some other way, with a
|
|
||||||
manually provided API token.
|
|
||||||
|
|
||||||
The configuration option `c.JupyterHub.services` is used to start
|
|
||||||
services from the hub.
|
|
||||||
|
|
||||||
When a service is started from JupyterHub automatically, its logs are
|
|
||||||
included in the JupyterHub logs.
|
|
||||||
|
|
||||||
## Single-user notebook server
|
|
||||||
|
|
||||||
The **single-user notebook server** is the same thing you get by
|
|
||||||
running `jupyter notebook` or `jupyter lab` from the command line -
|
|
||||||
the actual Jupyter user interface for a single person.
|
|
||||||
|
|
||||||
The role of the spawner is to start this server - basically, running
|
|
||||||
the command `jupyter notebook`. Actually it doesn't run that, it runs
|
|
||||||
`jupyterhub-singleuser` which first communicates with the hub to say
|
|
||||||
"I'm alive" before running a completely normal Jupyter server. The
|
|
||||||
single-user server can be JupyterLab or classic notebooks. By this
|
|
||||||
point, the hub is almost completely out of the picture (the web
|
|
||||||
traffic is going through proxy unchanged). Also by this time, the
|
|
||||||
spawner has already decided the environment which this single-user
|
|
||||||
server will have and the single-user server has to deal with that.
|
|
||||||
|
|
||||||
The spawner starts the server using `jupyterhub-singleuser` with some
|
|
||||||
environment variables like `JUPYTERHUB_API_TOKEN` and
|
|
||||||
`JUPYTERHUB_BASE_URL` which tell the single-user server how to connect
|
|
||||||
back to the hub in order to say that it's ready.
|
|
||||||
|
|
||||||
The single-user server options are **JupyterLab** and **classic
|
|
||||||
Jupyter Notebook**. They both run through the same backend server process--the web
|
|
||||||
frontend is an option when it is starting. The spawner can choose the
|
|
||||||
command line when it starts the single-user server. Extensions are a
|
|
||||||
property of the single-user server (in two parts: there can be a part
|
|
||||||
that runs in the Python server process, and parts that run in
|
|
||||||
javascript in lab or notebook).
|
|
||||||
|
|
||||||
If one wants to install software for users, it is not a matter of
|
|
||||||
"installing it for JupyerHub" - it's a matter of installing it for the
|
|
||||||
single-user server, which might be the same environment as the hub,
|
|
||||||
but not necessarily. (see below - it's a matter of the kernels!)
|
|
||||||
|
|
||||||
After the single-user notebook server is started, any errors are only
|
|
||||||
an issue of the single-user notebook server. Sometimes, it seems like
|
|
||||||
the spawner is failing, but really the spawner is working but the
|
|
||||||
single-user notebook server dies right away (in this case, you need to
|
|
||||||
find the problem with the single-user server and adjust the spawner to
|
|
||||||
start it correctly or fix the environment). This can happen, for
|
|
||||||
example, if the spawner doesn't set an environment variable or doesn't
|
|
||||||
provide storage.
|
|
||||||
|
|
||||||
The single-user server's logs are printed to stdout/stderr, and the
|
|
||||||
spawer decides where those streams are directed, so if you
|
|
||||||
notice problems at this phase you need to check your spawner for
|
|
||||||
instructions for accessing the single-user logs. For example, the
|
|
||||||
LocalProcessSpawner logs are just outputted to the same JupyterHub
|
|
||||||
output logs, the SystemdSpawner logs are
|
|
||||||
written to the Systemd journal, Docker and Kubernetes logs are written
|
|
||||||
to Docker and Kubernetes respectively, and batchspawner output goes to
|
|
||||||
the normal output places of batch jobs and is an explicit
|
|
||||||
configuration option of the spawner.
|
|
||||||
|
|
||||||
**(Jupyter) Notebook** is the classic interface, where each notebook
|
|
||||||
opens in a separate tab. It is traditionally started by `jupyter
|
|
||||||
notebook`. Does anything need to be said here?
|
|
||||||
|
|
||||||
**JupyterLab** is the new interface, where multiple notebooks are
|
|
||||||
openable in the same tab in an IDE-like environment. It is
|
|
||||||
traditionally started with `jupyter lab`. Both Notebook and Lab use
|
|
||||||
the same `.ipynb` file format.
|
|
||||||
|
|
||||||
JupyterLab is run thorugh the same server file, but at a path `/lab`
|
|
||||||
instead of `/tree`. Thus, they can be active at the same time in the
|
|
||||||
backend and you can switch between them at runtime by changing your
|
|
||||||
URL path.
|
|
||||||
|
|
||||||
Extensions need to be re-written for JupyterLab (if moving from
|
|
||||||
classic notebooks). But, the server-side of the extensions can be
|
|
||||||
shared by both.
|
|
||||||
|
|
||||||
## Kernel
|
|
||||||
|
|
||||||
The commands you run in the notebook session are not executed in the same process as
|
|
||||||
the notebook itself, but in a separate **Jupyter kernel**. There are [many
|
|
||||||
kernels
|
|
||||||
available](https://github.com/jupyter/jupyter/wiki/Jupyter-kernels).
|
|
||||||
|
|
||||||
As a basic approximation, a **Jupyter kernel** is a process which
|
|
||||||
accepts commands (cells that are run) and returns the output to
|
|
||||||
Jupyter to display. One example is the **IPython Jupyter kernel**,
|
|
||||||
which runs Python. There is nothing special about it, it can be
|
|
||||||
considered a \*normal Python process. The kernel process can be
|
|
||||||
approximated in UNIX terms as a process that takes commands on stdin
|
|
||||||
and returns stuff on stdout(&). Obviously, it's more because it has
|
|
||||||
to be able to disentangle all the possible outputs, such as figures,
|
|
||||||
and present it to the user in a web browser.
|
|
||||||
|
|
||||||
Kernel communication is via the the ZeroMQ protocol on the local
|
|
||||||
computer. Kernels are separate processes from the main single-user
|
|
||||||
notebook server (and thus obviously, different from the JupyterHub
|
|
||||||
process and everything else). By default (and unless you do something
|
|
||||||
special), kernels share the same environment as the notebook server
|
|
||||||
(data, resource limits, permissions, user id, etc.). But they _can_
|
|
||||||
run in a separate Python environment from the single-user server
|
|
||||||
(search `--prefix` in the [ipykernel installation
|
|
||||||
instructions](https://ipython.readthedocs.io/en/stable/install/kernel_install.html))
|
|
||||||
There are also more fancy techniques such as the [Jupyter Kernel
|
|
||||||
Gateway](https://jupyter-kernel-gateway.readthedocs.io/) and [Enterprise
|
|
||||||
Gateway](https://jupyter-enterprise-gateway.readthedocs.io/), which
|
|
||||||
allow you to run the kernels on a different machine and possibly with
|
|
||||||
a different environment.
|
|
||||||
|
|
||||||
A kernel doesn't just execute it's language - cell magics such as `%`,
|
|
||||||
`%%`, and `!` are a property of the kernel - in particular, these are
|
|
||||||
IPython kernel commands and don't necessarily work in any other
|
|
||||||
kernel unless they specifically support them.
|
|
||||||
|
|
||||||
Kernels are yet _another_ layer of configurability.
|
|
||||||
Each kernel can run a different programming language, with different
|
|
||||||
software, and so on. By default, they would run in the same
|
|
||||||
environment as the single-user notebook server, and the most common
|
|
||||||
other way they are configured is by
|
|
||||||
running in different Python virtual environments or conda
|
|
||||||
environments. They can be started and killed independently (there is
|
|
||||||
normally one per notebook you have open). The kernel uses
|
|
||||||
most of your memory and CPU when running Jupyter - the rest of the web
|
|
||||||
interface has a small footprint.
|
|
||||||
|
|
||||||
You can list your installed kernels with `jupyter kernelspec list`.
|
|
||||||
If you look at one of `kernel.json` files in those directories, you
|
|
||||||
will see exactly what command is run. These are normally
|
|
||||||
automatically made by the kernels, but can be edited as needed. [The
|
|
||||||
spec](https://jupyter-client.readthedocs.io/en/stable/kernels.html)
|
|
||||||
tells you even more.
|
|
||||||
|
|
||||||
The kernel normally has to be reachable by the single-user notebook server
|
|
||||||
but the gateways mentioned above can get around that limitation.
|
|
||||||
|
|
||||||
If you get problems with "Kernel died" or some other error in a single
|
|
||||||
notebook but the single-user notebook server stays working, it is
|
|
||||||
usually a problem with the kernel. It could be that you are trying to
|
|
||||||
use more resources than you are allowed and the symptom is the kernel
|
|
||||||
getting killed. It could be that it crashes for some other reason.
|
|
||||||
In these cases, you need to find the kernel logs and investigate.
|
|
||||||
|
|
||||||
The debug logs for the kernel are normally mixed in with the
|
|
||||||
single-user notebook server logs.
|
|
||||||
|
|
||||||
## JupyterHub distributions
|
|
||||||
|
|
||||||
There are several "distributions" which automatically install all of
|
|
||||||
the things above and configure them for a certain purpose. They are
|
|
||||||
good ways to get started, but if you have custom needs, eventually it
|
|
||||||
may become hard to adapt them to your requirements.
|
|
||||||
|
|
||||||
- [**Zero to JupyterHub with
|
|
||||||
Kubernetes**](https://zero-to-jupyterhub.readthedocs.io/) installs
|
|
||||||
an entire scaleable system using Kubernetes. Uses KubeSpawner,
|
|
||||||
....Authenticator, ....
|
|
||||||
|
|
||||||
- [**The Littlest JupyterHub**](https://tljh.jupyter.org/) installs JupyterHub on a single system
|
|
||||||
using SystemdSpawner and NativeAuthenticator (which manages users
|
|
||||||
itself).
|
|
||||||
|
|
||||||
- [**JupyterHub the hard way**](https://github.com/jupyterhub/jupyterhub-the-hard-way/blob/master/docs/installation-guide-hard.md)
|
|
||||||
takes you through everything yourself. It is a natural companion to
|
|
||||||
this guide, since you get to experience every little bit.
|
|
||||||
|
|
||||||
## What's next?
|
|
||||||
|
|
||||||
Now you know everything. Well, you know how everything relates, but
|
|
||||||
there are still plenty of details, implementations, and exceptions.
|
|
||||||
When setting up JupyterHub, the first step is to consider the above
|
|
||||||
layers, decide the right option for each of them, then begin putting
|
|
||||||
everything together.
|
|
@@ -1,186 +0,0 @@
|
|||||||
(explanation:hub-database)=
|
|
||||||
|
|
||||||
# The Hub's Database
|
|
||||||
|
|
||||||
JupyterHub uses a database to store information about users, services, and other data needed for operating the Hub.
|
|
||||||
This is the **state** of the Hub.
|
|
||||||
|
|
||||||
## Why does JupyterHub have a database?
|
|
||||||
|
|
||||||
JupyterHub is a **stateful** application (more on that 'state' later).
|
|
||||||
Updating JupyterHub's configuration or upgrading the version of JupyterHub requires restarting the JupyterHub process to apply the changes.
|
|
||||||
We want to minimize the disruption caused by restarting the Hub process, so it can be a mundane, frequent, routine activity.
|
|
||||||
Storing state information outside the process for later retrieval is necessary for this, and one of the main thing databases are for.
|
|
||||||
|
|
||||||
A lot of the operations in JupyterHub are also **relationships**, which is exactly what SQL databases are great at.
|
|
||||||
For example:
|
|
||||||
|
|
||||||
- Given an API token, what user is making the request?
|
|
||||||
- Which users don't have running servers?
|
|
||||||
- Which servers belong to user X?
|
|
||||||
- Which users have not been active in the last 24 hours?
|
|
||||||
|
|
||||||
Finally, a database allows us to have more information stored without needing it all loaded in memory,
|
|
||||||
e.g. supporting a large number (several thousands) of inactive users.
|
|
||||||
|
|
||||||
## What's in the database?
|
|
||||||
|
|
||||||
The short answer of what's in the JupyterHub database is "everything."
|
|
||||||
JupyterHub's **state** lives in the database.
|
|
||||||
That is, everything JupyterHub needs to be aware of to function that _doesn't_ come from the configuration files, such as
|
|
||||||
|
|
||||||
- users, roles, role assignments
|
|
||||||
- state, urls of running servers
|
|
||||||
- Hashed API tokens
|
|
||||||
- Short-lived state related to OAuth flow
|
|
||||||
- Timestamps for when users, tokens, and servers were last used
|
|
||||||
|
|
||||||
### What's _not_ in the database
|
|
||||||
|
|
||||||
Not _quite_ all of JupyterHub's state is in the database.
|
|
||||||
This mostly involves transient state, such as the 'pending' transitions of Spawners (starting, stopping, etc.).
|
|
||||||
Anything not in the database must be reconstructed on Hub restart, and the only sources of information to do that are the database and JupyterHub configuration file(s).
|
|
||||||
|
|
||||||
## How does JupyterHub use the database?
|
|
||||||
|
|
||||||
JupyterHub makes some _unusual_ choices in how it connects to the database.
|
|
||||||
These choices represent trade-offs favoring single-process simplicity and performance at the expense of horizontal scalability (multiple Hub instances).
|
|
||||||
|
|
||||||
We often say that the Hub 'owns' the database.
|
|
||||||
This ownership means that we assume the Hub is the only process that will talk to the database.
|
|
||||||
This assumption enables us to make several caching optimizations that dramatically improve JupyterHub's performance (i.e. data written recently to the database can be read from memory instead of fetched again from the database) that would not work if multiple processes could be interacting with the database at the same time.
|
|
||||||
|
|
||||||
Database operations are also synchronous, so while JupyterHub is waiting on a database operation, it cannot respond to other requests.
|
|
||||||
This allows us to avoid complex locking mechanisms, because transaction races can only occur during an `await`, so we only need to make sure we've completed any given transaction before the next `await` in a given request.
|
|
||||||
|
|
||||||
:::{note}
|
|
||||||
We are slowly working to remove these assumptions, and moving to a more traditional db session per-request pattern.
|
|
||||||
This will enable multiple Hub instances and enable scaling JupyterHub, but will significantly reduce the number of active users a single Hub instance can serve.
|
|
||||||
:::
|
|
||||||
|
|
||||||
### Database performance in a typical request
|
|
||||||
|
|
||||||
Most authenticated requests to JupyterHub involve a few database transactions:
|
|
||||||
|
|
||||||
1. look up the authenticated user (e.g. look up token by hash, then resolve owner and permissions)
|
|
||||||
2. record activity
|
|
||||||
3. perform any relevant changes involved in processing the request (e.g. create the records for a running server when starting one)
|
|
||||||
|
|
||||||
This means that the database is involved in almost every request, but only in quite small, simple queries, e.g.:
|
|
||||||
|
|
||||||
- lookup one token by hash
|
|
||||||
- lookup one user by name
|
|
||||||
- list tokens or servers for one user (typically 1-10)
|
|
||||||
- etc.
|
|
||||||
|
|
||||||
### The database as a limiting factor
|
|
||||||
|
|
||||||
As a result of the above transactions in most requests, database performance is the _leading_ factor in JupyterHub's baseline requests-per-second performance, but that cost does not scale significantly with the number of users, active or otherwise.
|
|
||||||
However, the database is _rarely_ a limiting factor in JupyterHub performance in a practical sense, because the main thing JupyterHub does is start, stop, and monitor whole servers, which take far more time than any small database transaction, no matter how many records you have or how slow your database is (within reason).
|
|
||||||
Additionally, there is usually _very_ little load on the database itself.
|
|
||||||
|
|
||||||
By far the most taxing activity on the database is the 'list all users' endpoint, primarily used by the [idle-culling service](https://github.com/jupyterhub/jupyterhub-idle-culler).
|
|
||||||
Database-based optimizations have been added to make even these operations feasible for large numbers of users:
|
|
||||||
|
|
||||||
1. State filtering on [GET /hub/api/users?state=active](rest-api-get-users),
|
|
||||||
which limits the number of results in the query to only the relevant subset (added in JupyterHub 1.3), rather than all users.
|
|
||||||
2. [Pagination](api-pagination) of all list endpoints, allowing the request of a large number of resources to be more fairly balanced with other Hub activities across multiple requests (added in 2.0).
|
|
||||||
|
|
||||||
:::{note}
|
|
||||||
It's important to note when discussing performance and limiting factors and that all of this only applies to requests to `/hub/...`.
|
|
||||||
The Hub and its database are not involved in most requests to single-user servers (`/user/...`), which is by design, and largely motivated by the fact that the Hub itself doesn't _need_ to be fast because its operations are infrequent and large.
|
|
||||||
:::
|
|
||||||
|
|
||||||
## Database backends
|
|
||||||
|
|
||||||
JupyterHub supports a variety of database backends via [SQLAlchemy][].
|
|
||||||
The default is sqlite, which works great for many cases, but you should be able to use many backends supported by SQLAlchemy.
|
|
||||||
Usually, this will mean PostgreSQL or MySQL, both of which are officially supported and well tested with JupyterHub, but others may work as well.
|
|
||||||
See [SQLAlchemy's docs][sqlalchemy-dialect] for how to connect to different database backends.
|
|
||||||
Doing so generally involves:
|
|
||||||
|
|
||||||
1. installing a Python package that provides a client implementation, and
|
|
||||||
2. setting [](JupyterHub.db_url) to connect to your database with the specified implementation
|
|
||||||
|
|
||||||
[sqlalchemy-dialect]: https://docs.sqlalchemy.org/en/20/dialects/
|
|
||||||
[sqlalchemy]: https://www.sqlalchemy.org
|
|
||||||
|
|
||||||
### Default backend: SQLite
|
|
||||||
|
|
||||||
The default database backend for JupyterHub is [SQLite](https://sqlite.org).
|
|
||||||
We have chosen SQLite as JupyterHub's default because it's simple (the 'database' is a single file), ubiquitous (it is in the Python standard library), and it does not require maintaining a separate database server.
|
|
||||||
|
|
||||||
The main disadvantage of SQLite is it does not support remote backup tools or replication.
|
|
||||||
You should backup your database by taking snapshots of the file (`jupyterhub.sqlite`).
|
|
||||||
|
|
||||||
SQLite is ideal for testing, small deployments, workshops, and production servers where you do not require remote backup or replication.
|
|
||||||
|
|
||||||
### Picking your database backend (PostgreSQL, MySQL)
|
|
||||||
|
|
||||||
The sqlite documentation provides a helpful page about [when to use SQLite and
|
|
||||||
where traditional RDBMS may be a better choice](https://sqlite.org/whentouse.html).
|
|
||||||
|
|
||||||
In general, you select your database backend with [](JupyterHub.db_url), and can further configure it (usually not necessary) with [](JupyterHub.db_kwargs).
|
|
||||||
|
|
||||||
## Notes and Tips
|
|
||||||
|
|
||||||
### Upgrading the JupyterHub database
|
|
||||||
|
|
||||||
[Upgrading JupyterHub to a new major release](howto:upgrading-jupyterhub) often requires an upgrade to the database schema.
|
|
||||||
|
|
||||||
- `jupyterhub upgrade-db` will execute a schema upgrade. You should backup your database before running this.
|
|
||||||
- `jupyterhub downgrade-db` may be able to revert a schema upgrade on PostgreSQL and MySQL, but this is not guaranteed to work, and is not supported.
|
|
||||||
|
|
||||||
### SQLite
|
|
||||||
|
|
||||||
The SQLite database should not be used on NFS. SQLite uses reader/writer locks
|
|
||||||
to control access to the database. This locking mechanism might not work
|
|
||||||
correctly if the database file is kept on an NFS filesystem. This is because
|
|
||||||
`fcntl()` file locking is broken on many NFS implementations. Therefore, you
|
|
||||||
should avoid putting SQLite database files on NFS since it will not handle well
|
|
||||||
multiple processes which might try to access the file at the same time.
|
|
||||||
|
|
||||||
### PostgreSQL
|
|
||||||
|
|
||||||
We recommend using PostgreSQL for production if you are unsure whether to use
|
|
||||||
MySQL or PostgreSQL or if you do not have a strong preference.
|
|
||||||
There is additional configuration required for MySQL that is not needed for PostgreSQL.
|
|
||||||
|
|
||||||
For example, to connect to a PostgreSQL database with psycopg2:
|
|
||||||
|
|
||||||
1. install psycopg2: `pip install psycopg2` (or `psycopg2-binary` to avoid compilation, which is [not recommended for production][psycopg2-binary])
|
|
||||||
2. set authentication via environment variables `PGUSER` and `PGPASSWORD`
|
|
||||||
3. configure [](JupyterHub.db_url):
|
|
||||||
|
|
||||||
```python
|
|
||||||
c.JupyterHub.db_url = "postgresql+psycopg2://my-postgres-server:5432/my-db-name"
|
|
||||||
```
|
|
||||||
|
|
||||||
[psycopg2-binary]: https://www.psycopg.org/docs/install.html#psycopg-vs-psycopg-binary
|
|
||||||
|
|
||||||
### MySQL / MariaDB
|
|
||||||
|
|
||||||
- You should probably use the `pymysql` or `mysqlclient` sqlalchemy provider, or another backend [recommended by sqlalchemy](https://docs.sqlalchemy.org/en/20/dialects/mysql.html#dialect-mysql)
|
|
||||||
- You also need to set `pool_recycle` to some value (typically 60 - 300, JupyterHub will default to 60)
|
|
||||||
which depends on your MySQL setup. This is necessary since MySQL kills
|
|
||||||
connections serverside if they've been idle for a while, and the connection
|
|
||||||
from the hub will be idle for longer than most connections. This behavior
|
|
||||||
will lead to frustrating 'the connection has gone away' errors from
|
|
||||||
sqlalchemy if `pool_recycle` is not set.
|
|
||||||
- If you use `utf8mb4` collation with MySQL earlier than 5.7.7 or MariaDB
|
|
||||||
earlier than 10.2.1 you may get an `1709, Index column size too large` error.
|
|
||||||
To fix this you need to set `innodb_large_prefix` to enabled and
|
|
||||||
`innodb_file_format` to `Barracuda` to allow for the index sizes jupyterhub
|
|
||||||
uses. `row_format` will be set to `DYNAMIC` as long as those options are set
|
|
||||||
correctly. Later versions of MariaDB and MySQL should set these values by
|
|
||||||
default, as well as have a default `DYNAMIC` `row_format` and pose no trouble
|
|
||||||
to users.
|
|
||||||
|
|
||||||
For example, to connect to a mysql database with mysqlclient:
|
|
||||||
|
|
||||||
1. install mysqlclient: `pip install mysqlclient`
|
|
||||||
2. configure [](JupyterHub.db_url):
|
|
||||||
|
|
||||||
```python
|
|
||||||
c.JupyterHub.db_url = "mysql+mysqldb://myuser:mypassword@my-sql-server:3306/my-db-name"
|
|
||||||
```
|
|
@@ -1,17 +0,0 @@
|
|||||||
(explanation)=
|
|
||||||
|
|
||||||
# Explanation
|
|
||||||
|
|
||||||
_Explanation_ documentation provide big-picture descriptions of how JupyterHub works. This section is meant to build your understanding of particular topics.
|
|
||||||
|
|
||||||
```{toctree}
|
|
||||||
:maxdepth: 1
|
|
||||||
|
|
||||||
concepts
|
|
||||||
capacity-planning
|
|
||||||
database
|
|
||||||
websecurity
|
|
||||||
oauth
|
|
||||||
singleuser
|
|
||||||
../rbac/index
|
|
||||||
```
|
|
@@ -1,109 +0,0 @@
|
|||||||
(explanation:singleuser)=
|
|
||||||
|
|
||||||
# The JupyterHub single-user server
|
|
||||||
|
|
||||||
When a user logs into JupyterHub, they get a 'server', which we usually call the **single-user server**, because it's a server that's meant for a single JupyterHub user.
|
|
||||||
Each JupyterHub user gets a different one (or more than one!).
|
|
||||||
|
|
||||||
A single-user server is a process running somewhere that is:
|
|
||||||
|
|
||||||
1. accessible over http[s],
|
|
||||||
2. authenticated via JupyterHub using OAuth 2.0,
|
|
||||||
3. started by a [Spawner](spawners), and
|
|
||||||
4. 'owned' by a single JupyterHub user
|
|
||||||
|
|
||||||
## The single-user server command
|
|
||||||
|
|
||||||
The Spawner's default single-user server startup command, `jupyterhub-singleuser`, launches `jupyter-server`, the same program used when you run `jupyter lab` on your laptop.
|
|
||||||
(_It can also launch the legacy `jupyter-notebook` server_).
|
|
||||||
That's why JupyterHub looks familiar to folks who are already using Jupyter at home or elsewhere.
|
|
||||||
It's the same!
|
|
||||||
`jupyterhub-singleuser` _customizes_ that program to change (approximately) one thing: **authenticate requests with JupyterHub**.
|
|
||||||
|
|
||||||
(singleuser-auth)=
|
|
||||||
|
|
||||||
## Single-user server authentication
|
|
||||||
|
|
||||||
Implementation-wise, JupyterHub single-user servers are a special-case of {ref}`services-reference`
|
|
||||||
and as such use the same (OAuth) authentication mechanism (more on OAuth in JupyterHub at [](oauth)).
|
|
||||||
This is primarily implemented in the {class}`~.HubOAuth` class.
|
|
||||||
|
|
||||||
This code resides in `jupyterhub.singleuser` subpackage of JupyterHub.
|
|
||||||
The main task of this code is to:
|
|
||||||
|
|
||||||
1. resolve a JupyterHub token to a JupyterHub user (authenticate)
|
|
||||||
2. check permissions (`access:servers`) for the token to make sure the request should be allowed (authorize)
|
|
||||||
3. if not authorized, begin the OAuth process with a redirect to the Hub
|
|
||||||
4. after login, store OAuth tokens in a cookie only used by this single-user server
|
|
||||||
5. implement logout to clear the cookie
|
|
||||||
|
|
||||||
Most of this is implemented in the {class}`~.HubOAuth` class. `jupyterhub.singleuser` is responsible for _adapting_ the base Jupyter Server to use HubOAuth for these tasks.
|
|
||||||
|
|
||||||
### JupyterHub authentication extension
|
|
||||||
|
|
||||||
By default, `jupyter-server` uses its own cookie to authenticate.
|
|
||||||
If that cookie is not present, the server redirects you a login page and asks you to enter a password or token.
|
|
||||||
|
|
||||||
Jupyter Server 2.0 introduces two new _APIs_ for customizing authentication: the [IdentityProvider](inv:jupyter-server#jupyter_server.auth.IdentityProvider) and the [Authorizer](inv:jupyter-server#jupyter_server.auth.Authorizer).
|
|
||||||
More information can be found in the [Jupyter Server documentation](https://jupyter-server.readthedocs.io).
|
|
||||||
|
|
||||||
JupyterHub implements these APIs in `jupyterhub.singleuser.extension`.
|
|
||||||
|
|
||||||
The IdentityProvider is responsible for _authenticating_ requests.
|
|
||||||
In JupyterHub, that means extracting OAuth tokens from the request and resolving them to a JupyterHub user.
|
|
||||||
|
|
||||||
The Authorizer is a _separate_ API for _authorizing_ actions on particular resources.
|
|
||||||
Because the JupyterHub IdentityProvider only allows _authenticating_ users who already have the necessary `access:servers` permission to access the server, the default Authorizer only contains a redundant check for this same permission, and ignores the resource inputs.
|
|
||||||
However, specifying a _custom_ Authorizer allows for granular permissions, such as read-only access to subsets of a shared server.
|
|
||||||
|
|
||||||
### JupyterHub authentication via subclass
|
|
||||||
|
|
||||||
Prior to Jupyter Server 2 (i.e. Jupyter Server 1.x or the legacy `jupyter-notebook` server), JupyterHub authentication is applied via _subclass_.
|
|
||||||
Originally a subclass of `NotebookApp`,
|
|
||||||
this approach works with both `jupyter-server` and `jupyter-notebook`.
|
|
||||||
Instead of using the extension mechanisms above,
|
|
||||||
the server application is _subclassed_. This worked well in the `jupyter-notebook` days,
|
|
||||||
but doesn't fit well with Jupyter Server's extension-based architecture.
|
|
||||||
|
|
||||||
### Selecting jupyterhub-singleuser implementation
|
|
||||||
|
|
||||||
Using the JupyterHub singleuser-server extension is the default behavior of JupyterHub 4 and Jupyter Server 2, otherwise the subclass approach is taken.
|
|
||||||
|
|
||||||
You can opt-out of the extension by setting the environment variable `JUPYTERHUB_SINGLEUSER_EXTENSION=0`:
|
|
||||||
|
|
||||||
```python
|
|
||||||
c.Spawner.environment.update(
|
|
||||||
{
|
|
||||||
"JUPYTERHUB_SINGLEUSER_EXTENSION": "0",
|
|
||||||
}
|
|
||||||
)
|
|
||||||
```
|
|
||||||
|
|
||||||
The subclass approach will also be taken if you've opted to use the classic notebook server with:
|
|
||||||
|
|
||||||
```
|
|
||||||
JUPYTERHUB_SINGLEUSER_APP=notebook
|
|
||||||
```
|
|
||||||
|
|
||||||
which was introduced in JupyterHub 2.
|
|
||||||
|
|
||||||
## Other customizations
|
|
||||||
|
|
||||||
`jupyterhub-singleuser` makes other small customizations to how the single-user server behaves:
|
|
||||||
|
|
||||||
1. logs activity on the single-user server, used in [idle-culling](https://github.com/jupyterhub/jupyterhub-idle-culler).
|
|
||||||
2. disables some features that don't make sense in JupyterHub (trash, retrying ports)
|
|
||||||
3. loading options such as URLs and SSL configuration from the environment
|
|
||||||
4. customize logging for consistency with JupyterHub logs
|
|
||||||
|
|
||||||
## Running a single-user server that's not `jupyterhub-singleuser`
|
|
||||||
|
|
||||||
By default, `jupyterhub-singleuser` is the same `jupyter-server` used by JupyterLab, Jupyter notebook (>= 7), etc.
|
|
||||||
But technically, all JupyterHub cares about is that it is:
|
|
||||||
|
|
||||||
1. an http server at the prescribed URL, accessible from the Hub and proxy, and
|
|
||||||
2. authenticated via [OAuth](oauth) with the Hub (it doesn't even have to do this, if you want to do your own authentication, as is done in BinderHub)
|
|
||||||
|
|
||||||
which means that you can customize JupyterHub to launch _any_ web application that meets these criteria, by following the specifications in {ref}`services-reference`.
|
|
||||||
|
|
||||||
Most of the time, though, it's easier to use [jupyter-server-proxy](https://jupyter-server-proxy.readthedocs.io) if you want to launch additional web applications in JupyterHub.
|
|
@@ -1,273 +0,0 @@
|
|||||||
(explanation:security)=
|
|
||||||
|
|
||||||
# Security Overview
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
This overview also helps you obtain a deeper understanding of how JupyterHub
|
|
||||||
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 can also be suitable for serving **untrusted** users,
|
|
||||||
but **is not suitable for untrusted users** in its default configuration.
|
|
||||||
|
|
||||||
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
|
|
||||||
[_proxy_][configurable-http-proxy]. If the Hub is serving untrusted
|
|
||||||
users, many of the web's cross-site protections are not applied between
|
|
||||||
single-user servers and the Hub, or between single-user servers and each
|
|
||||||
other, since browsers see the whole thing (proxy, Hub, and single user
|
|
||||||
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. 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.
|
|
||||||
|
|
||||||
To protect all users from each other, JupyterHub administrators must
|
|
||||||
ensure that:
|
|
||||||
|
|
||||||
- A user **does not have permission** to modify their single-user notebook server,
|
|
||||||
including:
|
|
||||||
- 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).
|
|
||||||
- unrestricted selection of the base environment (e.g. the image used in container-based Spawners)
|
|
||||||
|
|
||||||
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_
|
|
||||||
to any user that lacks authentication as the author of a file.
|
|
||||||
|
|
||||||
### Sharing access to servers
|
|
||||||
|
|
||||||
Because sharing access to servers (via `access:servers` scopes or the sharing feature in JupyterHub 5) by definition means users can serve each other files, enabling sharing is not suitable for untrusted users without also enabling per-user domains.
|
|
||||||
|
|
||||||
JupyterHub does not enable any sharing by default.
|
|
||||||
|
|
||||||
## Mitigate security issues
|
|
||||||
|
|
||||||
The several approaches to mitigating security issues with configuration
|
|
||||||
options provided by JupyterHub include:
|
|
||||||
|
|
||||||
(subdomains)=
|
|
||||||
|
|
||||||
### Enable user subdomains
|
|
||||||
|
|
||||||
JupyterHub provides the ability to run single-user servers on their own
|
|
||||||
domains. This means the cross-origin protections between servers has the
|
|
||||||
desired effect, and user servers and the Hub are protected from each other.
|
|
||||||
|
|
||||||
**Subdomains are the only way to reliably isolate user servers from each other.**
|
|
||||||
|
|
||||||
To enable subdomains, set:
|
|
||||||
|
|
||||||
```python
|
|
||||||
c.JupyterHub.subdomain_host = "https://jupyter.example.org"
|
|
||||||
```
|
|
||||||
|
|
||||||
When subdomains are enabled, each user's single-user server will be at e.g. `https://username.jupyter.example.org`.
|
|
||||||
This also requires all user subdomains to point to the same address,
|
|
||||||
which is most easily accomplished with wildcard DNS, where a single A record points to your server and a wildcard CNAME record points to your A record:
|
|
||||||
|
|
||||||
```
|
|
||||||
A jupyter.example.org 192.168.1.123
|
|
||||||
CNAME *.jupyter.example.org jupyter.example.org
|
|
||||||
```
|
|
||||||
|
|
||||||
Since this spreads the service across multiple domains, you will likely need wildcard SSL as well,
|
|
||||||
matching `*.jupyter.example.org`.
|
|
||||||
|
|
||||||
Unfortunately, for many institutional domains, wildcard DNS and SSL may not be available.
|
|
||||||
|
|
||||||
We also **strongly encourage** serving JupyterHub and user content on a domain that is _not_ a subdomain of any sensitive content.
|
|
||||||
For reasoning, see [GitHub's discussion of moving user content to github.io from \*.github.com](https://github.blog/engineering/yummy-cookies-across-domains/).
|
|
||||||
|
|
||||||
**If you do plan to serve untrusted users, enabling subdomains is highly encouraged**,
|
|
||||||
as it resolves many security issues, which are difficult to unavoidable when JupyterHub is on a single-domain.
|
|
||||||
|
|
||||||
:::{important}
|
|
||||||
JupyterHub makes no guarantees about protecting users from each other unless subdomains are enabled.
|
|
||||||
|
|
||||||
If you want to protect users from each other, you **_must_** enable per-user domains.
|
|
||||||
:::
|
|
||||||
|
|
||||||
### Disable user config
|
|
||||||
|
|
||||||
If subdomains are unavailable or undesirable, JupyterHub provides a
|
|
||||||
configuration option `Spawner.disable_user_config = True`, which can be set to prevent
|
|
||||||
the user-owned configuration files from being loaded. After implementing this
|
|
||||||
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 it's important that
|
|
||||||
the Spawner should _not_ evaluate shell configuration files prior to launching the server.
|
|
||||||
|
|
||||||
### Isolate packages in a read-only environment
|
|
||||||
|
|
||||||
The user must not have permission to install packages into the environment where the singleuser-server runs.
|
|
||||||
On a shared system, package isolation is most easily handled by running the single-user server in
|
|
||||||
a root-owned virtualenv with disabled system-site-packages.
|
|
||||||
The user must not have permission to install packages into this environment.
|
|
||||||
The same principle extends to the images used by container-based deployments.
|
|
||||||
If users can select the images in which their servers run, they can disable all security for their own servers.
|
|
||||||
|
|
||||||
It is important to note that the control over the environment is only required for the
|
|
||||||
single-user server, and not the environment(s) in which the users' kernel(s)
|
|
||||||
may run. Installing additional packages in the kernel environment does not
|
|
||||||
pose additional risk to the web application's security.
|
|
||||||
|
|
||||||
### Encrypt internal connections with SSL/TLS
|
|
||||||
|
|
||||||
By default, all communications within JupyterHub—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** 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
|
|
||||||
Unix permissions to the communication sockets thereby restricting
|
|
||||||
communication to the socket owner. The `internal_ssl` option will eventually
|
|
||||||
extend to securing the `tcp` sockets as well.
|
|
||||||
|
|
||||||
### Mitigating same-origin deployments
|
|
||||||
|
|
||||||
While per-user domains are **required** for robust protection of users from each other,
|
|
||||||
you can mitigate many (but not all) cross-user issues.
|
|
||||||
First, it is critical that users cannot modify their server environments, as described above.
|
|
||||||
Second, it is important that users do not have `access:servers` permission to any server other than their own.
|
|
||||||
|
|
||||||
If users can access each others' servers, additional security measures must be enabled, some of which come with distinct user-experience costs.
|
|
||||||
|
|
||||||
Without the [Same-Origin Policy] (SOP) protecting user servers from each other,
|
|
||||||
each user server is considered a trusted origin for requests to each other user server (and the Hub itself).
|
|
||||||
Servers _cannot_ meaningfully distinguish requests originating from other user servers,
|
|
||||||
because SOP implies a great deal of trust, losing many restrictions applied to cross-origin requests.
|
|
||||||
|
|
||||||
That means pages served from each user server can:
|
|
||||||
|
|
||||||
1. arbitrarily modify the path in the Referer
|
|
||||||
2. make fully authorized requests with cookies
|
|
||||||
3. access full page contents served from the hub or other servers via popups
|
|
||||||
|
|
||||||
JupyterHub uses distinct xsrf tokens stored in cookies on each server path to attempt to limit requests across.
|
|
||||||
This has limitations because not all requests are protected by these XSRF tokens,
|
|
||||||
and unless additional measures are taken, the XSRF tokens from other user prefixes may be retrieved.
|
|
||||||
|
|
||||||
[Same-Origin Policy]: https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy
|
|
||||||
|
|
||||||
For example:
|
|
||||||
|
|
||||||
- `Content-Security-Policy` header must prohibit popups and iframes from the same origin.
|
|
||||||
The following Content-Security-Policy rules are _insecure_ and readily enable users to access each others' servers:
|
|
||||||
- `frame-ancestors: 'self'`
|
|
||||||
- `frame-ancestors: '*'`
|
|
||||||
- `sandbox allow-popups`
|
|
||||||
|
|
||||||
- Ideally, pages should use the strictest `Content-Security-Policy: sandbox` available,
|
|
||||||
but this is not feasible in general for JupyterLab pages, which need at least `sandbox allow-same-origin allow-scripts` to work.
|
|
||||||
|
|
||||||
The default Content-Security-Policy for single-user servers is
|
|
||||||
|
|
||||||
```
|
|
||||||
frame-ancestors: 'none'
|
|
||||||
```
|
|
||||||
|
|
||||||
which prohibits iframe embedding, but not pop-ups.
|
|
||||||
|
|
||||||
A more secure Content-Security-Policy that has some costs to user experience is:
|
|
||||||
|
|
||||||
```
|
|
||||||
frame-ancestors: 'none'; sandbox allow-same-origin allow-scripts
|
|
||||||
```
|
|
||||||
|
|
||||||
`allow-popups` is not disabled by default because disabling it breaks legitimate functionality, like "Open this in a new tab", and the "JupyterHub Control Panel" menu item.
|
|
||||||
To reiterate, the right way to avoid these issues is to enable per-user domains, where none of these concerns come up.
|
|
||||||
|
|
||||||
Note: even this level of protection requires administrators maintaining full control over the user server environment.
|
|
||||||
If users can modify their server environment, these methods are ineffective, as users can readily disable them.
|
|
||||||
|
|
||||||
### Cookie tossing
|
|
||||||
|
|
||||||
Cookie tossing is a technique where another server on a subdomain or peer subdomain can set a cookie
|
|
||||||
which will be read on another domain.
|
|
||||||
This is not relevant unless there are other user-controlled servers on a peer domain.
|
|
||||||
|
|
||||||
"Domain-locked" cookies avoid this issue, but have their own restrictions:
|
|
||||||
|
|
||||||
- JupyterHub must be served over HTTPS
|
|
||||||
- All secure cookies must be set on `/`, not on sub-paths, which means they are shared by all JupyterHub components in a single-domain deployment.
|
|
||||||
|
|
||||||
As a result, this option is only recommended when per-user subdomains are enabled,
|
|
||||||
to prevent sending all jupyterhub cookies to all user servers.
|
|
||||||
|
|
||||||
To enable domain-locked cookies, set:
|
|
||||||
|
|
||||||
```python
|
|
||||||
c.JupyterHub.cookie_host_prefix_enabled = True
|
|
||||||
```
|
|
||||||
|
|
||||||
```{versionadded} 4.1
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
### Forced-login
|
|
||||||
|
|
||||||
Jupyter servers can share links with `?token=...`.
|
|
||||||
JupyterHub prior to 5.0 will accept this request and persist the token for future requests.
|
|
||||||
This is useful for enabling admins to create 'fully authenticated' links bypassing login.
|
|
||||||
However, it also means users can share their own links that will log other users into their own servers,
|
|
||||||
enabling them to serve each other notebooks and other arbitrary HTML, depending on server configuration.
|
|
||||||
|
|
||||||
```{versionadded} 4.1
|
|
||||||
Setting environment variable `JUPYTERHUB_ALLOW_TOKEN_IN_URL=0` in the single-user environment can opt out of accepting token auth in URL parameters.
|
|
||||||
```
|
|
||||||
|
|
||||||
```{versionadded} 5.0
|
|
||||||
Accepting tokens in URLs is disabled by default, and `JUPYTERHUB_ALLOW_TOKEN_IN_URL=1` environment variable must be set to _allow_ token auth in URL parameters.
|
|
||||||
```
|
|
||||||
|
|
||||||
## Security audits
|
|
||||||
|
|
||||||
We recommend that you do periodic reviews of your deployment's security. It's
|
|
||||||
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).
|
|
||||||
|
|
||||||
[configurable-http-proxy]: https://github.com/jupyterhub/configurable-http-proxy
|
|
||||||
|
|
||||||
## Vulnerability reporting
|
|
||||||
|
|
||||||
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
|
|
||||||
key](https://jupyter.org/assets/ipython_security.asc).
|
|
@@ -1,78 +0,0 @@
|
|||||||
(faq)=
|
|
||||||
|
|
||||||
# Frequently asked questions
|
|
||||||
|
|
||||||
## How do I share links to notebooks?
|
|
||||||
|
|
||||||
Sharing links to notebooks is a common activity,
|
|
||||||
and can look different depending on what you mean by 'share.'
|
|
||||||
Your first instinct might be to copy the URL you see in the browser,
|
|
||||||
e.g. `jupyterhub.example/user/yourname/notebooks/coolthing.ipynb`,
|
|
||||||
but this usually won't work, depending on the permissions of the person you share the link with.
|
|
||||||
|
|
||||||
Unfortunately, 'share' means at least a few things to people in a JupyterHub context.
|
|
||||||
We'll cover 3 common cases here, when they are applicable, and what assumptions they make:
|
|
||||||
|
|
||||||
1. sharing links that will open the same file on the visitor's own server
|
|
||||||
2. sharing links that will bring the visitor to _your_ server (e.g. for real-time collaboration, or RTC)
|
|
||||||
3. publishing notebooks and sharing links that will download the notebook into the user's server
|
|
||||||
|
|
||||||
### link to the same file on the visitor's server
|
|
||||||
|
|
||||||
This is for the case where you have JupyterHub on a shared (or sufficiently similar) filesystem, where you want to share a link that will cause users to login and start their _own_ server, to view or edit the file.
|
|
||||||
|
|
||||||
**Assumption:** the same path on someone else's server is valid and points to the same file
|
|
||||||
|
|
||||||
This is useful in e.g. classes where you know students have certain files in certain locations, or collaborations where you know you have a shared filesystem where everyone has access to the same files.
|
|
||||||
|
|
||||||
A link should look like `https://jupyterhub.example/hub/user-redirect/lab/tree/foo.ipynb`.
|
|
||||||
You can hand-craft these URLs from the URL you are looking at, where you see `/user/name/lab/tree/foo.ipynb` use `/hub/user-redirect/lab/tree/foo.ipynb` (replace `/user/name/` with `/hub/user-redirect/`).
|
|
||||||
Or you can use JupyterLab's "copy shareable link" in the context menu in the file browser:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
which will produce a correct URL with `/hub/user-redirect/` in it.
|
|
||||||
|
|
||||||
### link to the file on your server
|
|
||||||
|
|
||||||
This is for the case where you want to both be using _your_ server, e.g. for real-time collaboration (RTC).
|
|
||||||
|
|
||||||
**Assumption:** the user has (or should have) access to your server.
|
|
||||||
|
|
||||||
**Assumption:** your server is running _or_ the user has permission to start it.
|
|
||||||
|
|
||||||
By default, JupyterHub users don't have access to each other's servers, but JupyterHub 2.0 administrators can grant users limited access permissions to each other's servers.
|
|
||||||
If the visitor doesn't have access to the server, these links will result in a 403 Permission Denied error.
|
|
||||||
|
|
||||||
In many cases, for this situation you can copy the link in your URL bar (`/user/yourname/lab`), or you can add `/tree/path/to/specific/notebook.ipynb` to open a specific file.
|
|
||||||
|
|
||||||
The [jupyterlab-link-share] JupyterLab extension generates these links, and even can _grant_ other users access to your server.
|
|
||||||
|
|
||||||
[jupyterlab-link-share]: https://github.com/jupyterlab-contrib/jupyterlab-link-share
|
|
||||||
|
|
||||||
:::{warning}
|
|
||||||
Note that the way the extension _grants_ access is handing over credentials to allow the other user to **_BECOME YOU_**.
|
|
||||||
This is usually not appropriate in JupyterHub.
|
|
||||||
:::
|
|
||||||
|
|
||||||
### link to a published copy
|
|
||||||
|
|
||||||
Another way to 'share' notebooks is to publish copies, e.g. pushing the notebook to a git repository and sharing a download link.
|
|
||||||
This way is especially useful for course materials,
|
|
||||||
where no assumptions are necessary about the user's environment,
|
|
||||||
except for having one package installed.
|
|
||||||
|
|
||||||
**Assumption:** The [nbgitpuller](inv:nbgitpuller#index) server extension is installed
|
|
||||||
|
|
||||||
Unlike the other two methods, nbgitpuller doesn't provide an extension to copy a shareable link for the document you're currently looking at,
|
|
||||||
but it does provide a [link generator](inv:nbgitpuller#link),
|
|
||||||
which uses the `user-redirect` approach above.
|
|
||||||
|
|
||||||
When visiting an nbgitpuller link:
|
|
||||||
|
|
||||||
- The visitor will be directed to their own server
|
|
||||||
- Your repo will be cloned (or updated if it's already been cloned)
|
|
||||||
- and then the file opened when it's ready
|
|
||||||
|
|
||||||
[nbgitpuller]: https://nbgitpuller.readthedocs.io
|
|
||||||
[nbgitpuller-link]: https://nbgitpuller.readthedocs.io/en/latest/link.html
|
|
@@ -1,11 +0,0 @@
|
|||||||
# FAQs
|
|
||||||
|
|
||||||
Find answers to some of the most frequently-asked questions around JupyterHub and how it works.
|
|
||||||
|
|
||||||
```{toctree}
|
|
||||||
:maxdepth: 2
|
|
||||||
|
|
||||||
faq
|
|
||||||
institutional-faq
|
|
||||||
troubleshooting
|
|
||||||
```
|
|
@@ -1,5 +1,3 @@
|
|||||||
(gallery-of-deployments)=
|
|
||||||
|
|
||||||
# A Gallery of JupyterHub Deployments
|
# A Gallery of JupyterHub Deployments
|
||||||
|
|
||||||
**A JupyterHub Community Resource**
|
**A JupyterHub Community Resource**
|
||||||
@@ -16,13 +14,19 @@ Please submit pull requests to update information or to add new institutions or
|
|||||||
|
|
||||||
- [BIDS - Berkeley Institute for Data Science](https://bids.berkeley.edu/)
|
- [BIDS - Berkeley Institute for Data Science](https://bids.berkeley.edu/)
|
||||||
|
|
||||||
- [Data 8](https://www.data8.org/)
|
- [Teaching with Jupyter notebooks and JupyterHub](https://bids.berkeley.edu/resources/videos/teaching-ipythonjupyter-notebooks-and-jupyterhub)
|
||||||
|
|
||||||
|
- [Data 8](http://data8.org/)
|
||||||
|
|
||||||
- [GitHub organization](https://github.com/data-8)
|
- [GitHub organization](https://github.com/data-8)
|
||||||
|
|
||||||
- [NERSC](https://www.nersc.gov/)
|
- [NERSC](http://www.nersc.gov/)
|
||||||
|
|
||||||
- [Research IT](https://research-it.berkeley.edu)
|
- [Press release on Jupyter and Cori](http://www.nersc.gov/news-publications/nersc-news/nersc-center-news/2016/jupyter-notebooks-will-open-up-new-possibilities-on-nerscs-cori-supercomputer/)
|
||||||
- [JupyterHub server supports campus research computation](https://research-it.berkeley.edu/news/free-fully-loaded-jupyterhub-server-supports-campus-research-computation)
|
- [Moving and sharing data](https://www.nersc.gov/assets/Uploads/03-MovingAndSharingData-Cholia.pdf)
|
||||||
|
|
||||||
|
- [Research IT](http://research-it.berkeley.edu)
|
||||||
|
- [JupyterHub server supports campus research computation](http://research-it.berkeley.edu/blog/17/01/24/free-fully-loaded-jupyterhub-server-supports-campus-research-computation)
|
||||||
|
|
||||||
### University of California Davis
|
### University of California Davis
|
||||||
|
|
||||||
@@ -57,15 +61,6 @@ easy to do with RStudio too.
|
|||||||
|
|
||||||
- [jupyterhub-deploy-teaching](https://github.com/jupyterhub/jupyterhub-deploy-teaching) based on work by Brian Granger for Cal Poly's Data Science 301 Course
|
- [jupyterhub-deploy-teaching](https://github.com/jupyterhub/jupyterhub-deploy-teaching) based on work by Brian Granger for Cal Poly's Data Science 301 Course
|
||||||
|
|
||||||
### CERN
|
|
||||||
|
|
||||||
[CERN](https://home.cern/), also known as the European Organization for Nuclear Research, is a world-renowned scientific research centre and the home of the Large Hadron Collider (LHC).
|
|
||||||
|
|
||||||
Within CERN, there are two noteworthy JupyterHub deployments in operation:
|
|
||||||
|
|
||||||
- [SWAN](https://swan.web.cern.ch/swan/), which stands for Service for Web based Analysis, serves as an interactive data analysis platform primarily utilized at CERN.
|
|
||||||
- [VRE](https://vre-hub.github.io/), which stands for Virtual Research Environment, is an analysis platform developed within the [EOSC Project](https://eoscfuture.eu/) to cater to the needs of scientific communities involved in European projects.
|
|
||||||
|
|
||||||
### Chameleon
|
### Chameleon
|
||||||
|
|
||||||
[Chameleon](https://www.chameleoncloud.org) is a NSF-funded configurable experimental environment for large-scale computer science systems research with [bare metal reconfigurability](https://chameleoncloud.readthedocs.io/en/latest/technical/baremetal.html). Chameleon users utilize JupyterHub to document and reproduce their complex CISE and networking experiments.
|
[Chameleon](https://www.chameleoncloud.org) is a NSF-funded configurable experimental environment for large-scale computer science systems research with [bare metal reconfigurability](https://chameleoncloud.readthedocs.io/en/latest/technical/baremetal.html). Chameleon users utilize JupyterHub to document and reproduce their complex CISE and networking experiments.
|
||||||
@@ -76,19 +71,25 @@ Within CERN, there are two noteworthy JupyterHub deployments in operation:
|
|||||||
### Clemson University
|
### Clemson University
|
||||||
|
|
||||||
- Advanced Computing
|
- Advanced Computing
|
||||||
- [Palmetto cluster and JupyterHub](https://citi.sites.clemson.edu/2016/08/18/JupyterHub-for-Palmetto-Cluster.html)
|
- [Palmetto cluster and JupyterHub](http://citi.sites.clemson.edu/2016/08/18/JupyterHub-for-Palmetto-Cluster.html)
|
||||||
|
|
||||||
### ETH Zurich
|
### University of Colorado Boulder
|
||||||
|
|
||||||
[ETH Zurich](https://ethz.ch/en.html), (Federal Institute of Technology Zurich), is a public research university in Zürich, Switzerland, with focus on science, technology, engineering, and mathematics, although its 16 departments span a variety of disciplines and subjects.
|
- (CU Research Computing) CURC
|
||||||
|
|
||||||
The [Educational Development and Technology](https://ethz.ch/en/the-eth-zurich/organisation/departments/teaching-and-learning.html) unit provides JupyterHub exclusively for teaching and learning, integrated in the learning management system [Moodle](https://ethz.ch/staffnet/en/teaching/academic-support/it-services-teaching/teaching-applications/moodle-service.html). Each course gets its individually configured JupyterHub environment deployed on a on-premise Kubernetes cluster.
|
- [JupyterHub User Guide](https://www.rc.colorado.edu/support/user-guide/jupyterhub.html)
|
||||||
|
- Slurm job dispatched on Crestone compute cluster
|
||||||
|
- log troubleshooting
|
||||||
|
- Profiles in IPython Clusters tab
|
||||||
|
- [Parallel Processing with JupyterHub tutorial](https://www.rc.colorado.edu/support/examples-and-tutorials/parallel-processing-with-jupyterhub.html)
|
||||||
|
- [Parallel Programming with JupyterHub document](https://www.rc.colorado.edu/book/export/html/833)
|
||||||
|
|
||||||
- [ETH JupyterHub](https://ethz.ch/staffnet/en/teaching/academic-support/it-services-teaching/teaching-applications/jupyterhub.html) for teaching and learning
|
- Earth Lab at CU
|
||||||
|
- [Tutorial on Parallel R on JupyterHub](https://earthdatascience.org/tutorials/parallel-r-on-jupyterhub/)
|
||||||
|
|
||||||
### George Washington University
|
### George Washington University
|
||||||
|
|
||||||
- [JupyterHub](https://go.gwu.edu/jupyter) with university single-sign-on. Deployed early 2017.
|
- [Jupyter Hub](http://go.gwu.edu/jupyter) with university single-sign-on. Deployed early 2017.
|
||||||
|
|
||||||
### HTCondor
|
### HTCondor
|
||||||
|
|
||||||
@@ -96,11 +97,11 @@ The [Educational Development and Technology](https://ethz.ch/en/the-eth-zurich/o
|
|||||||
|
|
||||||
### University of Illinois
|
### University of Illinois
|
||||||
|
|
||||||
- https://datascience.business.illinois.edu (currently down; checked 10/26/22)
|
- https://datascience.business.illinois.edu (currently down; checked 04/26/19)
|
||||||
|
|
||||||
### IllustrisTNG Simulation Project
|
### IllustrisTNG Simulation Project
|
||||||
|
|
||||||
- [JupyterHub/Lab-based analysis platform, part of the TNG public data release](https://www.tng-project.org/data/)
|
- [JupyterHub/Lab-based analysis platform, part of the TNG public data release](http://www.tng-project.org/data/)
|
||||||
|
|
||||||
### MIT and Lincoln Labs
|
### MIT and Lincoln Labs
|
||||||
|
|
||||||
@@ -120,16 +121,21 @@ The [Educational Development and Technology](https://ethz.ch/en/the-eth-zurich/o
|
|||||||
|
|
||||||
### Paderborn University
|
### Paderborn University
|
||||||
|
|
||||||
- [Data Science (DICE) group](https://dice-research.org)
|
- [Data Science (DICE) group](https://dice.cs.uni-paderborn.de/)
|
||||||
- [JavaOnlineExercises](https://github.com/dice-group/JavaOnlineExercises): Use JupyterHub + nbgrader + iJava kernel for online Java exercises. Used in lecture Statistical Natural Language Processing.
|
- [nbgraderutils](https://github.com/dice-group/nbgraderutils): Use JupyterHub + nbgrader + iJava kernel for online Java exercises. Used in lecture Statistical Natural Language Processing.
|
||||||
|
|
||||||
### Penn State University
|
### Penn State University
|
||||||
|
|
||||||
- [Press release](https://www.psu.edu/news/academics/story/new-open-source-web-apps-available-students-and-faculty): "New open-source web apps available for students and faculty"
|
- [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)
|
||||||
|
|
||||||
|
### University of Rochester CIRC
|
||||||
|
|
||||||
|
- [JupyterHub Userguide](https://info.circ.rochester.edu/Web_Applications/JupyterHub.html) - Slurm, beehive
|
||||||
|
|
||||||
### University of California San Diego
|
### University of California San Diego
|
||||||
|
|
||||||
- San Diego Supercomputer Center - Andrea Zonca
|
- San Diego Supercomputer Center - Andrea Zonca
|
||||||
|
|
||||||
- [Deploy JupyterHub on a Supercomputer with SSH](https://zonca.github.io/2017/05/jupyterhub-hpc-batchspawner-ssh.html)
|
- [Deploy JupyterHub on a Supercomputer with SSH](https://zonca.github.io/2017/05/jupyterhub-hpc-batchspawner-ssh.html)
|
||||||
- [Run Jupyterhub on a Supercomputer](https://zonca.github.io/2015/04/jupyterhub-hpc.html)
|
- [Run Jupyterhub on a Supercomputer](https://zonca.github.io/2015/04/jupyterhub-hpc.html)
|
||||||
- [Deploy JupyterHub on a VM for a Workshop](https://zonca.github.io/2016/04/jupyterhub-sdsc-cloud.html)
|
- [Deploy JupyterHub on a VM for a Workshop](https://zonca.github.io/2016/04/jupyterhub-sdsc-cloud.html)
|
||||||
@@ -138,7 +144,7 @@ The [Educational Development and Technology](https://ethz.ch/en/the-eth-zurich/o
|
|||||||
- [Sample deployment of Jupyterhub in HPC on SDSC Comet](https://zonca.github.io/2017/02/sample-deployment-jupyterhub-hpc.html)
|
- [Sample deployment of Jupyterhub in HPC on SDSC Comet](https://zonca.github.io/2017/02/sample-deployment-jupyterhub-hpc.html)
|
||||||
|
|
||||||
- Educational Technology Services - Paul Jamason
|
- Educational Technology Services - Paul Jamason
|
||||||
- [datahub.ucsd.edu](https://datahub.ucsd.edu)
|
- [jupyterhub.ucsd.edu](https://jupyterhub.ucsd.edu)
|
||||||
|
|
||||||
### TACC University of Texas
|
### TACC University of Texas
|
||||||
|
|
||||||
@@ -149,14 +155,14 @@ The [Educational Development and Technology](https://ethz.ch/en/the-eth-zurich/o
|
|||||||
|
|
||||||
### Elucidata
|
### Elucidata
|
||||||
|
|
||||||
- What's new in Jupyter Notebooks @[Elucidata](https://www.elucidata.io/):
|
- 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
|
## Service Providers
|
||||||
|
|
||||||
### AWS
|
### AWS
|
||||||
|
|
||||||
- [Run Jupyter Notebook and JupyterHub on Amazon EMR](https://aws.amazon.com/blogs/big-data/running-jupyter-notebook-and-jupyterhub-on-amazon-emr/)
|
- [running-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
|
### Google Cloud Platform
|
||||||
|
|
||||||
@@ -169,33 +175,27 @@ The [Educational Development and Technology](https://ethz.ch/en/the-eth-zurich/o
|
|||||||
|
|
||||||
### Microsoft Azure
|
### Microsoft Azure
|
||||||
|
|
||||||
- [Azure Data Science Virtual Machine release notes](https://learn.microsoft.com/en-us/azure/machine-learning/machine-learning-data-science-linux-dsvm-intro)
|
- https://docs.microsoft.com/en-us/azure/machine-learning/machine-learning-data-science-linux-dsvm-intro
|
||||||
|
|
||||||
### Rackspace Carina
|
### Rackspace Carina
|
||||||
|
|
||||||
- https://getcarina.com/blog/learning-how-to-whale/
|
- https://getcarina.com/blog/learning-how-to-whale/
|
||||||
- https://carolynvanslyck.com/talk/carina/jupyterhub/#/ (but carolynvanslyck is currently down; checked 10/26/22)
|
- http://carolynvanslyck.com/talk/carina/jupyterhub/#/
|
||||||
|
|
||||||
### Hadoop
|
### Hadoop
|
||||||
|
|
||||||
- [Deploying JupyterHub on Hadoop](https://jupyterhub-on-hadoop.readthedocs.io)
|
- [Deploying JupyterHub on Hadoop](https://jupyterhub-on-hadoop.readthedocs.io)
|
||||||
|
|
||||||
### Sirepo
|
|
||||||
|
|
||||||
- Sirepo is an online Computer-Aided Engineering gateway that contains a JupyterHub instance. Sirepo is provided at no cost for community use, but users must request login access.
|
|
||||||
- [Sirepo.com](https://www.sirepo.com)
|
|
||||||
- [Sirepo Jupyter](https://www.sirepo.com/jupyter)
|
|
||||||
|
|
||||||
## Miscellaneous
|
## Miscellaneous
|
||||||
|
|
||||||
- https://medium.com/@ybarraud/setting-up-jupyterhub-with-sudospawner-and-anaconda-844628c0dbee#.rm3yt87e1
|
- https://medium.com/@ybarraud/setting-up-jupyterhub-with-sudospawner-and-anaconda-844628c0dbee#.rm3yt87e1
|
||||||
- [Mailing list UT deployment](https://groups.google.com/g/jupyter/c/nkPSEeMr8c0)
|
- https://groups.google.com/forum/#!topic/jupyter/nkPSEeMr8c0 Mailing list UT deployment
|
||||||
- [JupyterHub setup on Centos](https://gist.github.com/johnrc/604971f7d41ebf12370bf5729bf3e0a4)
|
- JupyterHub setup on Centos https://gist.github.com/johnrc/604971f7d41ebf12370bf5729bf3e0a4
|
||||||
- [Deploy JupyterHub to Docker Swarm](https://jupyterhub.surge.sh)
|
- Deploy JupyterHub to Docker Swarm https://jupyterhub.surge.sh/#/welcome
|
||||||
- https://www.laketide.com/building-your-lab-part-3/
|
- http://www.laketide.com/building-your-lab-part-3/
|
||||||
- https://estrellita.hatenablog.com/entry/2015/07/31/083202
|
- http://estrellita.hatenablog.com/entry/2015/07/31/083202
|
||||||
- https://www.walkingrandomly.com/?p=5734
|
- http://www.walkingrandomly.com/?p=5734
|
||||||
- https://wrdrd.com/docs/consulting/education-technology
|
- https://wrdrd.com/docs/consulting/education-technology
|
||||||
- https://bitbucket.org/jackhale/fenics-jupyter
|
- https://bitbucket.org/jackhale/fenics-jupyter
|
||||||
- [LinuxCluster blog](https://thelinuxcluster.com/category/application/jupyterhub/)
|
- [LinuxCluster blog](https://linuxcluster.wordpress.com/category/application/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/)
|
131
docs/source/getting-started/authenticators-users-basics.md
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
# Authentication and User Basics
|
||||||
|
|
||||||
|
The default Authenticator uses [PAM][] 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
|
||||||
|
|
||||||
|
You can restrict which users are allowed to login with a set,
|
||||||
|
`Authenticator.allowed_users`:
|
||||||
|
|
||||||
|
```python
|
||||||
|
c.Authenticator.allowed_users = {'mal', 'zoe', 'inara', 'kaylee'}
|
||||||
|
```
|
||||||
|
|
||||||
|
Users in the `allowed_users` set are added to the Hub database when the Hub is
|
||||||
|
started.
|
||||||
|
|
||||||
|
```{warning}
|
||||||
|
If this configuration value is not set, then **all authenticated users will be allowed into your hub**.
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configure admins (`admin_users`)
|
||||||
|
|
||||||
|
```{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
|
||||||
|
with only the scopes they require.
|
||||||
|
```
|
||||||
|
|
||||||
|
Admin users of JupyterHub, `admin_users`, can add and remove users from
|
||||||
|
the user `allowed_users` set. `admin_users` can take actions on other users'
|
||||||
|
behalf, such as stopping and restarting their servers.
|
||||||
|
|
||||||
|
A set of initial admin users, `admin_users` can be configured as follows:
|
||||||
|
|
||||||
|
```python
|
||||||
|
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
|
||||||
|
`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:
|
||||||
|
|
||||||
|
```python
|
||||||
|
c.PAMAuthenticator.admin_groups = {'wheel'}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Give admin access to other users' notebook servers (`admin_access`)
|
||||||
|
|
||||||
|
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
|
||||||
|
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
|
||||||
|
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,
|
||||||
|
as the users will be loaded from the database.
|
||||||
|
|
||||||
|
After starting the Hub once, it is not sufficient to **remove** a user
|
||||||
|
from the allowed users set in your config file. You must also remove the user
|
||||||
|
from the Hub's database, either by deleting the user from JupyterHub's
|
||||||
|
admin page, or you can clear the `jupyterhub.sqlite` database and start
|
||||||
|
fresh.
|
||||||
|
|
||||||
|
## Use LocalAuthenticator to create system users
|
||||||
|
|
||||||
|
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
|
||||||
|
file is:
|
||||||
|
|
||||||
|
```python
|
||||||
|
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
|
||||||
|
launching the service. This approach is not recommended when running
|
||||||
|
JupyterHub in situations where JupyterHub users map directly onto the
|
||||||
|
system's UNIX users.
|
||||||
|
|
||||||
|
## Use OAuthenticator to support OAuth with popular service providers
|
||||||
|
|
||||||
|
JupyterHub's [OAuthenticator][] currently supports the following
|
||||||
|
popular services:
|
||||||
|
|
||||||
|
- Auth0
|
||||||
|
- Azure AD
|
||||||
|
- Bitbucket
|
||||||
|
- CILogon
|
||||||
|
- GitHub
|
||||||
|
- GitLab
|
||||||
|
- Globus
|
||||||
|
- Google
|
||||||
|
- MediaWiki
|
||||||
|
- Okpy
|
||||||
|
- OpenShift
|
||||||
|
|
||||||
|
A generic implementation, 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
|
||||||
|
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:
|
||||||
|
|
||||||
|
```python
|
||||||
|
c.DummyAuthenticator.password = "some_password"
|
||||||
|
```
|
||||||
|
|
||||||
|
[pam]: https://en.wikipedia.org/wiki/Pluggable_authentication_module
|
||||||
|
[oauthenticator]: https://github.com/jupyterhub/oauthenticator
|
@@ -1,7 +1,7 @@
|
|||||||
# Configuration Basics
|
# Configuration Basics
|
||||||
|
|
||||||
This section contains basic information about configuring settings for a JupyterHub
|
The section contains basic information about configuring settings for a JupyterHub
|
||||||
deployment. The [Technical Reference](reference-index)
|
deployment. The [Technical Reference](../reference/index)
|
||||||
documentation provides additional details.
|
documentation provides additional details.
|
||||||
|
|
||||||
This section will help you learn how to:
|
This section will help you learn how to:
|
||||||
@@ -11,8 +11,6 @@ This section will help you learn how to:
|
|||||||
- configure JupyterHub using command line options
|
- configure JupyterHub using command line options
|
||||||
- find information and examples for some common deployments
|
- find information and examples for some common deployments
|
||||||
|
|
||||||
(generate-config-file)=
|
|
||||||
|
|
||||||
## Generate a default config file
|
## Generate a default config file
|
||||||
|
|
||||||
On startup, JupyterHub will look by default for a configuration file,
|
On startup, JupyterHub will look by default for a configuration file,
|
||||||
@@ -46,12 +44,12 @@ jupyterhub -f /etc/jupyterhub/jupyterhub_config.py
|
|||||||
```
|
```
|
||||||
|
|
||||||
The IPython documentation provides additional information on the
|
The IPython documentation provides additional information on the
|
||||||
[config system](https://ipython.readthedocs.io/en/stable/development/config.html)
|
[config system](http://ipython.readthedocs.io/en/stable/development/config.html)
|
||||||
that Jupyter uses.
|
that Jupyter uses.
|
||||||
|
|
||||||
## Configure using command line options
|
## Configure using command line options
|
||||||
|
|
||||||
To display all command line options that are available for configuration run the following command:
|
To display all command line options that are available for configuration:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
jupyterhub --help-all
|
jupyterhub --help-all
|
||||||
@@ -79,11 +77,11 @@ jupyterhub --Spawner.notebook_dir='~/assignments'
|
|||||||
## Configure for various deployment environments
|
## Configure for various deployment environments
|
||||||
|
|
||||||
The default authentication and process spawning mechanisms can be replaced, and
|
The default authentication and process spawning mechanisms can be replaced, and
|
||||||
specific [authenticators](authenticators-users-basics) and
|
specific [authenticators](./authenticators-users-basics) and
|
||||||
[spawners](spawners-basics) can be set in the configuration file.
|
[spawners](./spawners-basics) can be set in the configuration file.
|
||||||
This enables JupyterHub to be used with a variety of authentication methods or
|
This enables JupyterHub to be used with a variety of authentication methods or
|
||||||
process control and deployment environments. [Some examples](config-examples),
|
process control and deployment environments. [Some examples](../reference/config-examples),
|
||||||
meant as illustrations, are:
|
meant as illustration, are:
|
||||||
|
|
||||||
- Using GitHub OAuth instead of PAM with [OAuthenticator](https://github.com/jupyterhub/oauthenticator)
|
- 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)
|
- Spawning single-user servers with Docker, using the [DockerSpawner](https://github.com/jupyterhub/dockerspawner)
|
||||||
@@ -99,4 +97,4 @@ maintenance, re-configuration, etc.), then user connections are not
|
|||||||
interrupted. For simplicity, by default the hub starts the proxy
|
interrupted. For simplicity, by default the hub starts the proxy
|
||||||
automatically, so if the hub restarts, the proxy restarts, and user
|
automatically, so if the hub restarts, the proxy restarts, and user
|
||||||
connections are interrupted. It is easy to run the proxy separately,
|
connections are interrupted. It is easy to run the proxy separately,
|
||||||
for information see [the separate proxy page](howto:separate-proxy).
|
for information see [the separate proxy page](../reference/separate-proxy).
|
35
docs/source/getting-started/faq.md
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# Frequently asked questions
|
||||||
|
|
||||||
|
## How do I share links to notebooks?
|
||||||
|
|
||||||
|
In short, where you see `/user/name/notebooks/foo.ipynb` use `/hub/user-redirect/notebooks/foo.ipynb` (replace `/user/name` with `/hub/user-redirect`).
|
||||||
|
|
||||||
|
Sharing links to notebooks is a common activity,
|
||||||
|
and can look different based on what you mean.
|
||||||
|
Your first instinct might be to copy the URL you see in the browser,
|
||||||
|
e.g. `hub.jupyter.org/user/yourname/notebooks/coolthing.ipynb`.
|
||||||
|
However, let's break down what this URL means:
|
||||||
|
|
||||||
|
`hub.jupyter.org/user/yourname/` is the URL prefix handled by _your server_,
|
||||||
|
which means that sharing this URL is asking the person you share the link with
|
||||||
|
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?
|
||||||
|
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).
|
||||||
|
Typically, what folks want when they do sharing like this
|
||||||
|
is for each visitor to open the same file _on their own server_,
|
||||||
|
so Breq would open `/user/breq/notebooks/foo.ipynb` and
|
||||||
|
Seivarden would open `/user/seivarden/notebooks/foo.ipynb`, etc.
|
||||||
|
|
||||||
|
JupyterHub has a special URL that does exactly this!
|
||||||
|
It's called `/hub/user-redirect/...`.
|
||||||
|
So if you replace `/user/yourname` in your URL bar
|
||||||
|
with `/hub/user-redirect` any visitor should get the same
|
||||||
|
URL on their own server, rather than visiting yours.
|
||||||
|
|
||||||
|
In JupyterLab 2.0, this should also be the result of the "Copy Shareable Link"
|
||||||
|
action in the file browser.
|
19
docs/source/getting-started/index.rst
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
Get Started
|
||||||
|
===========
|
||||||
|
|
||||||
|
This section covers how to configure and customize JupyterHub for your
|
||||||
|
needs. It contains information about authentication, networking, security, and
|
||||||
|
other topics that are relevant to individuals or organizations deploying their
|
||||||
|
own JupyterHub.
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 2
|
||||||
|
|
||||||
|
config-basics
|
||||||
|
networking-basics
|
||||||
|
security-basics
|
||||||
|
authenticators-users-basics
|
||||||
|
spawners-basics
|
||||||
|
services-basics
|
||||||
|
faq
|
||||||
|
institutional-faq
|
@@ -1,5 +1,3 @@
|
|||||||
(faq:institutional)=
|
|
||||||
|
|
||||||
# Institutional FAQ
|
# Institutional FAQ
|
||||||
|
|
||||||
This page contains common questions from users of JupyterHub,
|
This page contains common questions from users of JupyterHub,
|
||||||
@@ -10,16 +8,10 @@ broken down by their roles within organizations.
|
|||||||
### Is it appropriate for adoption within a larger institutional context?
|
### Is it appropriate for adoption within a larger institutional context?
|
||||||
|
|
||||||
Yes! JupyterHub has been used at-scale for large pools of users, as well
|
Yes! JupyterHub has been used at-scale for large pools of users, as well
|
||||||
as complex and high-performance computing.
|
as complex and high-performance computing. For example, UC Berkeley uses
|
||||||
For example,
|
|
||||||
|
|
||||||
- UC Berkeley uses
|
|
||||||
JupyterHub for its Data Science Education Program courses (serving over
|
JupyterHub for its Data Science Education Program courses (serving over
|
||||||
3,000 students).
|
3,000 students). The Pangeo project uses JupyterHub to provide access
|
||||||
- The Pangeo project uses JupyterHub to provide access
|
to scalable cloud computing with Dask. JupyterHub is stable and customizable
|
||||||
to scalable cloud computing with Dask.
|
|
||||||
|
|
||||||
JupyterHub is stable and customizable
|
|
||||||
to the use-cases of large organizations.
|
to the use-cases of large organizations.
|
||||||
|
|
||||||
### I keep hearing about Jupyter Notebook, JupyterLab, and now JupyterHub. What’s the difference?
|
### I keep hearing about Jupyter Notebook, JupyterLab, and now JupyterHub. What’s the difference?
|
||||||
@@ -34,7 +26,7 @@ Here is a quick breakdown of these three tools:
|
|||||||
has several extensions that are tailored for using Jupyter Notebooks, as well as extensions
|
has several extensions that are tailored for using Jupyter Notebooks, as well as extensions
|
||||||
for other parts of the data science stack.
|
for other parts of the data science stack.
|
||||||
- **JupyterHub** is an application that manages interactive computing sessions for **multiple users**.
|
- **JupyterHub** is an application that manages interactive computing sessions for **multiple users**.
|
||||||
It also connects users with infrastructure they wish to access. It can provide
|
It also connects them with infrastructure those users wish to access. It can provide
|
||||||
remote access to Jupyter Notebooks and JupyterLab for many people.
|
remote access to Jupyter Notebooks and JupyterLab for many people.
|
||||||
|
|
||||||
## For management
|
## For management
|
||||||
@@ -43,7 +35,7 @@ Here is a quick breakdown of these three tools:
|
|||||||
|
|
||||||
JupyterHub provides a shared platform for data science and collaboration.
|
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,
|
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 gives administrators
|
the R tidyverse, and Jupyter Notebooks) on institutional infrastructure. It also allows administrators
|
||||||
some control over access to resources, security, environments, and authentication.
|
some control over access to resources, security, environments, and authentication.
|
||||||
|
|
||||||
### Is JupyterHub mature? Why should we trust it?
|
### Is JupyterHub mature? Why should we trust it?
|
||||||
@@ -66,14 +58,14 @@ industry, and government research labs. It is most-commonly used by two kinds of
|
|||||||
Here is a sample of organizations that use JupyterHub:
|
Here is a sample of organizations that use JupyterHub:
|
||||||
|
|
||||||
- **Universities and colleges**: UC Berkeley, UC San Diego, Cal Poly SLO, Harvard University, University of Chicago,
|
- **Universities and colleges**: UC Berkeley, UC San Diego, Cal Poly SLO, Harvard University, University of Chicago,
|
||||||
University of Oslo, University of Sheffield, Université Paris Sud, University of Versailles, University of Portland
|
University of Oslo, University of Sheffield, Université Paris Sud, University of Versailles
|
||||||
- **Research laboratories**: NASA, NCAR, NOAA, the Large Synoptic Survey Telescope, Brookhaven National Lab,
|
- **Research laboratories**: NASA, NCAR, NOAA, the Large Synoptic Survey Telescope, Brookhaven National Lab,
|
||||||
Minnesota Supercomputing Institute, ALCF, CERN, Lawrence Livermore National Laboratory, HUNT
|
Minnesota Supercomputing Institute, ALCF, CERN, Lawrence Livermore National Laboratory
|
||||||
- **Online communities**: Pangeo, Quantopian, mybinder.org, MathHub, Open Humans
|
- **Online communities**: Pangeo, Quantopian, mybinder.org, MathHub, Open Humans
|
||||||
- **Computing infrastructure providers**: NERSC, San Diego Supercomputing Center, Compute Canada
|
- **Computing infrastructure providers**: NERSC, San Diego Supercomputing Center, Compute Canada
|
||||||
- **Companies**: Capital One, SANDVIK code, Globus
|
- **Companies**: Capital One, SANDVIK code, Globus
|
||||||
|
|
||||||
See the [Gallery of JupyterHub deployments](gallery-of-deployments) for
|
See the [Gallery of JupyterHub deployments](../gallery-jhub-deployments.md) for
|
||||||
a more complete list of JupyterHub deployments at institutions.
|
a more complete list of JupyterHub deployments at institutions.
|
||||||
|
|
||||||
### How does JupyterHub compare with hosted products, like Google Colaboratory, RStudio.cloud, or Anaconda Enterprise?
|
### How does JupyterHub compare with hosted products, like Google Colaboratory, RStudio.cloud, or Anaconda Enterprise?
|
||||||
@@ -86,7 +78,7 @@ gives administrators more control over their setup and hardware.
|
|||||||
|
|
||||||
Because JupyterHub is an open-source, community-driven tool, it can be extended and
|
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
|
modified to fit an institution's needs. It plays nicely with the open source data science
|
||||||
stack, and can serve a variety of computing environments, user interfaces, and
|
stack, and can serve a variety of computing enviroments, user interfaces, and
|
||||||
computational hardware. It can also be deployed anywhere - on enterprise cloud infrastructure, on
|
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
|
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.
|
is not possible with most other tools for shared interactive computing.
|
||||||
@@ -107,12 +99,12 @@ that we currently suggest are:
|
|||||||
guide that runs on Kubernetes. Better for larger or dynamic user groups (50-10,000) or more complex
|
guide that runs on Kubernetes. Better for larger or dynamic user groups (50-10,000) or more complex
|
||||||
compute/data needs.
|
compute/data needs.
|
||||||
- [The Littlest JupyterHub](https://tljh.jupyter.org) is a lightweight JupyterHub that runs on a single
|
- [The Littlest JupyterHub](https://tljh.jupyter.org) is a lightweight JupyterHub that runs on a single
|
||||||
machine (in the cloud or under your desk). Better for smaller user groups (4-80) or more
|
single machine (in the cloud or under your desk). Better for smaller user groups (4-80) or more
|
||||||
lightweight computational resources.
|
lightweight computational resources.
|
||||||
|
|
||||||
### Does JupyterHub run well in the cloud?
|
### 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
|
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
|
deployment with a number of other cloud-native services so that users have access to other resources from
|
||||||
their interactive computing sessions.
|
their interactive computing sessions.
|
||||||
@@ -126,15 +118,14 @@ as more resources are needed - allowing you to utilize the benefits of a flexibl
|
|||||||
|
|
||||||
### Is JupyterHub secure?
|
### Is JupyterHub secure?
|
||||||
|
|
||||||
The short answer: yes.
|
The short answer: yes. JupyterHub as a standalone application has been battle-tested at an institutional
|
||||||
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
|
level for several years, and makes a number of "default" security decisions that are reasonable for most
|
||||||
users.
|
users.
|
||||||
|
|
||||||
- For security considerations in the base JupyterHub application,
|
- For security considerations in the base JupyterHub application,
|
||||||
[see the JupyterHub security page](explanation:security).
|
[see the JupyterHub security page](https://jupyterhub.readthedocs.io/en/stable/reference/websecurity.html).
|
||||||
- For security considerations when deploying JupyterHub on Kubernetes, see the
|
- For security considerations when deploying JupyterHub on Kubernetes, see the
|
||||||
[JupyterHub on Kubernetes security page](https://z2jh.jupyter.org/en/latest/security.html).
|
[JupyterHub on Kubernetes security page](https://zero-to-jupyterhub.readthedocs.io/en/latest/security.html).
|
||||||
|
|
||||||
The longer answer: it depends on your deployment. Because JupyterHub is very flexible, it can be used
|
The longer answer: it depends on your deployment. Because JupyterHub is very flexible, it can be used
|
||||||
in a variety of deployment setups. This often entails connecting your JupyterHub to **other** infrastructure
|
in a variety of deployment setups. This often entails connecting your JupyterHub to **other** infrastructure
|
||||||
@@ -142,12 +133,12 @@ in a variety of deployment setups. This often entails connecting your JupyterHub
|
|||||||
in these cases, and the security of your JupyterHub deployment will often depend on these decisions.
|
in these cases, and the security of your JupyterHub deployment will often depend on these decisions.
|
||||||
|
|
||||||
If you are worried about security, don't hesitate to reach out to the JupyterHub community in the
|
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/10). This community of practice has many
|
[Jupyter Community Forum](https://discourse.jupyter.org/c/jupyterhub). This community of practice has many
|
||||||
individuals with experience running secure JupyterHub deployments and will be very glad to help you out.
|
individuals with experience running secure JupyterHub deployments.
|
||||||
|
|
||||||
### Does JupyterHub provide computing or data infrastructure?
|
### 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,
|
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
|
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.
|
(again, either locally or remotely) for use within interactive computing sessions.
|
||||||
@@ -200,7 +191,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
|
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
|
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
|
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 computing or data resources, you may increase the
|
to serve as a gateway to high-performance compute or data resources, you may increase the
|
||||||
resources available on user machines, or connect them with computing infrastructures elsewhere.
|
resources available on user machines, or connect them with computing infrastructures elsewhere.
|
||||||
|
|
||||||
### Can I customize the look and feel of a JupyterHub?
|
### Can I customize the look and feel of a JupyterHub?
|
@@ -41,9 +41,9 @@ port.
|
|||||||
|
|
||||||
## Set the Proxy's REST API communication URL (optional)
|
## Set the Proxy's REST API communication URL (optional)
|
||||||
|
|
||||||
By default, the proxy's REST API listens on port 8081 of `localhost` only.
|
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 Hub service talks to the proxy via a REST API on a secondary port. The
|
||||||
The REST API URL (hostname and port) can be configured separately and override the default settings.
|
API URL can be configured separately to override the default settings.
|
||||||
|
|
||||||
### Set api_url
|
### Set api_url
|
||||||
|
|
261
docs/source/getting-started/security-basics.rst
Normal file
@@ -0,0 +1,261 @@
|
|||||||
|
Security settings
|
||||||
|
=================
|
||||||
|
|
||||||
|
.. important::
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
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
|
||||||
|
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
|
||||||
|
is still a good idea to revoke existing tokens.
|
||||||
|
|
||||||
|
.. _ssl-encryption:
|
||||||
|
|
||||||
|
Enabling SSL encryption
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
Since JupyterHub includes authentication and allows arbitrary code execution,
|
||||||
|
you should not run it without SSL (HTTPS).
|
||||||
|
|
||||||
|
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``
|
||||||
|
configuration file as follows:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
c.JupyterHub.ssl_key = '/path/to/my.key'
|
||||||
|
c.JupyterHub.ssl_cert = '/path/to/my.cert'
|
||||||
|
|
||||||
|
|
||||||
|
Some cert files also contain the key, in which case only the cert is needed. It
|
||||||
|
is important that these files be put in a secure location on your server, where
|
||||||
|
they are not readable by regular users.
|
||||||
|
|
||||||
|
If you are using a **chain certificate**, see also chained certificate for SSL
|
||||||
|
in the JupyterHub `Troubleshooting FAQ <../troubleshooting.html>`_.
|
||||||
|
|
||||||
|
Using letsencrypt
|
||||||
|
~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
It is also possible to use `letsencrypt <https://letsencrypt.org/>`_ to obtain
|
||||||
|
a free, trusted SSL certificate. If you run letsencrypt using the default
|
||||||
|
options, the needed configuration is (replace ``mydomain.tld`` by your fully
|
||||||
|
qualified domain name):
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
c.JupyterHub.ssl_key = '/etc/letsencrypt/live/{mydomain.tld}/privkey.pem'
|
||||||
|
c.JupyterHub.ssl_cert = '/etc/letsencrypt/live/{mydomain.tld}/fullchain.pem'
|
||||||
|
|
||||||
|
If the fully qualified domain name (FQDN) is ``example.com``, the following
|
||||||
|
would be the needed configuration:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
c.JupyterHub.ssl_key = '/etc/letsencrypt/live/example.com/privkey.pem'
|
||||||
|
c.JupyterHub.ssl_cert = '/etc/letsencrypt/live/example.com/fullchain.pem'
|
||||||
|
|
||||||
|
|
||||||
|
If SSL termination happens outside of the Hub
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
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).
|
||||||
|
|
||||||
|
.. _authentication-token:
|
||||||
|
|
||||||
|
Proxy authentication token
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
The Hub authenticates its requests to the Proxy using a secret token that
|
||||||
|
the Hub and Proxy agree upon. Note that this applies to the default
|
||||||
|
``ConfigurableHTTPProxy`` implementation. Not all proxy implementations
|
||||||
|
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
|
||||||
|
|
||||||
|
Generating and storing token in the configuration file
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
You can set the value in the configuration file, ``jupyterhub_config.py``:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
c.ConfigurableHTTPProxy.api_token = 'abc123...' # any random string
|
||||||
|
|
||||||
|
Generating and storing as an environment variable
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
You can pass this value of the proxy authentication token to the Hub and Proxy
|
||||||
|
using the ``CONFIGPROXY_AUTH_TOKEN`` environment variable:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
export CONFIGPROXY_AUTH_TOKEN=$(openssl rand -hex 32)
|
||||||
|
|
||||||
|
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
|
||||||
|
restart the Proxy**. If the proxy is a subprocess of the Hub, this should happen
|
||||||
|
automatically (this is the default configuration).
|
||||||
|
|
||||||
|
.. _cookie-secret:
|
||||||
|
|
||||||
|
Cookie secret
|
||||||
|
-------------
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
openssl rand -hex 32 > /srv/jupyterhub/jupyterhub_cookie_secret
|
||||||
|
|
||||||
|
In most deployments of JupyterHub, you should point this to a secure location on
|
||||||
|
the file system, such as ``/srv/jupyterhub/jupyterhub_cookie_secret``.
|
||||||
|
|
||||||
|
The location of the ``jupyterhub_cookie_secret`` file can be specified in the
|
||||||
|
``jupyterhub_config.py`` file as follows:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
c.JupyterHub.cookie_secret_file = '/srv/jupyterhub/jupyterhub_cookie_secret'
|
||||||
|
|
||||||
|
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
|
||||||
|
for the cookie secret file are ``600`` (owner-only rw).
|
||||||
|
|
||||||
|
Generating and storing as an environment variable
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
If you would like to avoid the need for files, the value can be loaded in the
|
||||||
|
Hub process from the ``JPY_COOKIE_SECRET`` environment variable, which is a
|
||||||
|
hex-encoded string. You can set it this way:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
export JPY_COOKIE_SECRET=$(openssl rand -hex 32)
|
||||||
|
|
||||||
|
For security reasons, this environment variable should only be visible to the
|
||||||
|
Hub. If you set it dynamically as above, all users will be logged out each time
|
||||||
|
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:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
c.JupyterHub.cookie_secret = bytes.fromhex('64 CHAR HEX STRING')
|
||||||
|
|
||||||
|
|
||||||
|
.. important::
|
||||||
|
|
||||||
|
If the cookie secret value changes for the Hub, all single-user notebook
|
||||||
|
servers must also be restarted.
|
||||||
|
|
||||||
|
.. _cookies:
|
||||||
|
|
||||||
|
Cookies used by JupyterHub authentication
|
||||||
|
-----------------------------------------
|
||||||
|
|
||||||
|
The following cookies are used by the Hub for handling user authentication.
|
||||||
|
|
||||||
|
This section was created based on this post_ from Discourse.
|
||||||
|
|
||||||
|
.. _post: https://discourse.jupyter.org/t/how-to-force-re-login-for-users/1998/6
|
||||||
|
|
||||||
|
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.
|
||||||
|
If this cookie is set, then the user is logged in.
|
||||||
|
|
||||||
|
Resetting the Hub cookie secret effectively revokes this cookie.
|
||||||
|
|
||||||
|
This cookie is restricted to the path ``/hub/``.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
Effectively the same as ``jupyterhub-hub-login``, but for the
|
||||||
|
single-user server instead of the Hub. It contains an OAuth access token,
|
||||||
|
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.
|
||||||
|
|
||||||
|
Resetting the Hub cookie secret effectively revokes this cookie.
|
||||||
|
|
||||||
|
This cookie is restricted to the path ``/user/<username>``, so that
|
||||||
|
only the user’s server receives it.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
This cookie is set to ``/`` so all endpoints can receive it, or clear it, etc.
|
||||||
|
|
||||||
|
jupyterhub-user-<username>-oauth-state
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
A short-lived cookie, used solely to store and validate OAuth state.
|
||||||
|
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,
|
||||||
|
with an expiration date shorter than ``jupyterhub-hub-login`` or
|
||||||
|
``jupyterhub-user-<username>``.
|
||||||
|
|
||||||
|
This cookie should not exist after you have successfully logged in.
|
||||||
|
|
||||||
|
This cookie is restricted to the path ``/user/<username>``, so that only
|
||||||
|
the user’s server receives it.
|
@@ -1,5 +1,3 @@
|
|||||||
(tutorial:services)=
|
|
||||||
|
|
||||||
# External services
|
# External services
|
||||||
|
|
||||||
When working with JupyterHub, a **Service** is defined as a process
|
When working with JupyterHub, a **Service** is defined as a process
|
||||||
@@ -16,7 +14,7 @@ document will:
|
|||||||
|
|
||||||
- explain some basic information about API tokens
|
- explain some basic information about API tokens
|
||||||
- clarify that API tokens can be used to authenticate to
|
- clarify that API tokens can be used to authenticate to
|
||||||
single-user servers as of [version 0.8.0](changelog)
|
single-user servers as of [version 0.8.0](../changelog)
|
||||||
- show how the [jupyterhub_idle_culler][] script can be:
|
- show how the [jupyterhub_idle_culler][] script can be:
|
||||||
- used in a Hub-managed service
|
- used in a Hub-managed service
|
||||||
- run as a standalone script
|
- run as a standalone script
|
||||||
@@ -26,31 +24,31 @@ Hub via the REST API.
|
|||||||
|
|
||||||
## API Token basics
|
## API Token basics
|
||||||
|
|
||||||
### Step 1: Generate an API token
|
### Create an API token
|
||||||
|
|
||||||
To run such an external service, an API token must be created and
|
To run such an external service, an API token must be created and
|
||||||
provided to the service.
|
provided to the service.
|
||||||
|
|
||||||
As of [version 0.6.0](changelog), the preferred way of doing
|
As of [version 0.6.0](../changelog), the preferred way of doing
|
||||||
this is to first generate an API token:
|
this is to first generate an API token:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
openssl rand -hex 32
|
openssl rand -hex 32
|
||||||
```
|
```
|
||||||
|
|
||||||
In [version 0.8.0](changelog), a TOKEN request page for
|
In [version 0.8.0](../changelog), a TOKEN request page for
|
||||||
generating an API token is available from the JupyterHub user interface:
|
generating an API token is available from the JupyterHub user interface:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### Step 2: Pass environment variable with token to the Hub
|
### Pass environment variable with token to the Hub
|
||||||
|
|
||||||
In the case of `cull_idle_servers`, it is passed as the environment
|
In the case of `cull_idle_servers`, it is passed as the environment
|
||||||
variable called `JUPYTERHUB_API_TOKEN`.
|
variable called `JUPYTERHUB_API_TOKEN`.
|
||||||
|
|
||||||
### Step 3: Use API tokens for services and tasks that require external access
|
### Use API tokens for services and tasks that require external access
|
||||||
|
|
||||||
While API tokens are often associated with a specific user, API tokens
|
While API tokens are often associated with a specific user, API tokens
|
||||||
can be used by services that require external access for activities
|
can be used by services that require external access for activities
|
||||||
@@ -64,12 +62,12 @@ c.JupyterHub.services = [
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 4: Restart JupyterHub
|
### Restart JupyterHub
|
||||||
|
|
||||||
Upon restarting JupyterHub, you should see a message like below in the
|
Upon restarting JupyterHub, you should see a message like below in the
|
||||||
logs:
|
logs:
|
||||||
|
|
||||||
```none
|
```
|
||||||
Adding API token for <username>
|
Adding API token for <username>
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -80,15 +78,16 @@ single-user servers, and only cookies can be used for authentication.
|
|||||||
0.8 supports using JupyterHub API tokens to authenticate to single-user
|
0.8 supports using JupyterHub API tokens to authenticate to single-user
|
||||||
servers.
|
servers.
|
||||||
|
|
||||||
## How to configure the idle culler to run as a Hub-Managed Service
|
## Configure the idle culler to run as a Hub-Managed Service
|
||||||
|
|
||||||
### Step 1: Install the idle culler:
|
Install the idle culler:
|
||||||
|
|
||||||
```
|
```
|
||||||
pip install jupyterhub-idle-culler
|
pip install jupyterhub-idle-culler
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 2: In `jupyterhub_config.py`, add the following dictionary for the `idle-culler` Service to the `c.JupyterHub.services` list:
|
In `jupyterhub_config.py`, add the following dictionary for the
|
||||||
|
`idle-culler` Service to the `c.JupyterHub.services` list:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
c.JupyterHub.services = [
|
c.JupyterHub.services = [
|
||||||
@@ -128,7 +127,7 @@ It now needs the scopes:
|
|||||||
- `admin:servers` to start/stop servers
|
- `admin:servers` to start/stop servers
|
||||||
```
|
```
|
||||||
|
|
||||||
## How to run `cull-idle` manually as a standalone script
|
## Run `cull-idle` manually as a standalone script
|
||||||
|
|
||||||
Now you can run your script by providing it
|
Now you can run your script by providing it
|
||||||
the API token and it will authenticate through the REST API to
|
the API token and it will authenticate through the REST API to
|
@@ -1,14 +1,12 @@
|
|||||||
(spawners)=
|
|
||||||
|
|
||||||
# Spawners and single-user notebook servers
|
# Spawners and single-user notebook servers
|
||||||
|
|
||||||
A Spawner starts each single-user notebook server. Since the single-user server is an instance of `jupyter notebook`, an entire separate
|
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
|
multi-process application, there are many aspects of that server that can be configured, and a lot
|
||||||
of ways to express that configuration.
|
of ways to express that configuration.
|
||||||
|
|
||||||
At the JupyterHub level, you can set some values on the Spawner. The simplest of these is
|
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
|
`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
|
dashboard. In this example, the root notebook directory is set to `~/notebooks`, where `~` is
|
||||||
expanded to the user's home directory.
|
expanded to the user's home directory.
|
||||||
|
|
||||||
@@ -22,7 +20,7 @@ You can also specify extra command line arguments to the notebook server with:
|
|||||||
c.Spawner.args = ['--debug', '--profile=PHYS131']
|
c.Spawner.args = ['--debug', '--profile=PHYS131']
|
||||||
```
|
```
|
||||||
|
|
||||||
This could be used to set the user's default page for the single-user server:
|
This could be used to set the users default page for the single user server:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
c.Spawner.args = ['--NotebookApp.default_url=/notebooks/Welcome.ipynb']
|
c.Spawner.args = ['--NotebookApp.default_url=/notebooks/Welcome.ipynb']
|
@@ -1,265 +0,0 @@
|
|||||||
(howto:config:user-env)=
|
|
||||||
|
|
||||||
# Configuring user environments
|
|
||||||
|
|
||||||
To deploy JupyterHub means you are providing Jupyter notebook environments for
|
|
||||||
multiple users. Often, this includes a desire to configure the user
|
|
||||||
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`.
|
|
||||||
|
|
||||||
**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, which includes the following:
|
|
||||||
|
|
||||||
- [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 will typically install packages system-wide or in a shared environment.
|
|
||||||
|
|
||||||
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 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 Python installation on your system, use the following command:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo python3 -m pip install numpy
|
|
||||||
```
|
|
||||||
|
|
||||||
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. 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
|
|
||||||
|
|
||||||
[Jupyter](https://jupyter-notebook.readthedocs.io/en/stable/configuring/config_overview.html)
|
|
||||||
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, 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}`
|
|
||||||
- **env-wide** (environment wide) in `{sys.prefix}/etc/{jupyter|ipython}`.
|
|
||||||
|
|
||||||
### Jupyter environment configuration priority
|
|
||||||
|
|
||||||
When Jupyter runs in an environment (conda or virtualenv), it prefers to load configuration from the environment over each user's own configuration (e.g. in `~/.jupyter`).
|
|
||||||
This may cause issues if you use a _shared_ conda environment or virtualenv for users, because e.g. jupyterlab may try to write information like workspaces or settings to the environment instead of the user's own directory.
|
|
||||||
This could fail with something like `Permission denied: $PREFIX/etc/jupyter/lab`.
|
|
||||||
|
|
||||||
To avoid this issue, set `JUPYTER_PREFER_ENV_PATH=0` in the user environment:
|
|
||||||
|
|
||||||
```python
|
|
||||||
c.Spawner.environment.update(
|
|
||||||
{
|
|
||||||
"JUPYTER_PREFER_ENV_PATH": "0",
|
|
||||||
}
|
|
||||||
)
|
|
||||||
```
|
|
||||||
|
|
||||||
which tells Jupyter to prefer _user_ configuration paths (e.g. in `~/.jupyter`) to configuration set in the environment.
|
|
||||||
|
|
||||||
### 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`:
|
|
||||||
|
|
||||||
```python
|
|
||||||
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.
|
|
||||||
|
|
||||||
If you are using the classing Jupyter Notebook server,
|
|
||||||
the same things should work,
|
|
||||||
with the following substitutions:
|
|
||||||
|
|
||||||
- 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:
|
|
||||||
|
|
||||||
```python
|
|
||||||
# shutdown the server after no activity for an hour
|
|
||||||
c.ServerApp.shutdown_no_activity_timeout = 60 * 60
|
|
||||||
# shutdown kernels after no activity for 20 minutes
|
|
||||||
c.MappingKernelManager.cull_idle_timeout = 20 * 60
|
|
||||||
# check for idle kernels every two minutes
|
|
||||||
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
|
|
||||||
itself.
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
To see where your kernelspecs are, you can use the following command:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
jupyter kernelspec list
|
|
||||||
```
|
|
||||||
|
|
||||||
### Example: Installing kernels system-wide
|
|
||||||
|
|
||||||
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
|
|
||||||
/path/to/python2 -m ipykernel install --prefix=/usr/local
|
|
||||||
```
|
|
||||||
|
|
||||||
## Multi-user hosts vs. Containers
|
|
||||||
|
|
||||||
There are two broad categories of user environments that depend on what
|
|
||||||
Spawner you choose:
|
|
||||||
|
|
||||||
- Multi-user hosts (shared system)
|
|
||||||
- Container-based
|
|
||||||
|
|
||||||
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, 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`
|
|
||||||
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 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, thereby making it difficult for admins to update later.
|
|
||||||
|
|
||||||
## Named servers
|
|
||||||
|
|
||||||
By default, in a JupyterHub deployment, each user has one server only.
|
|
||||||
|
|
||||||
JupyterHub can, however, have multiple servers per user.
|
|
||||||
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, include this code snippet in your config file:
|
|
||||||
|
|
||||||
```python
|
|
||||||
c.JupyterHub.allow_named_servers = True
|
|
||||||
```
|
|
||||||
|
|
||||||
Named servers were implemented in the REST API in JupyterHub 0.8,
|
|
||||||
and JupyterHub 1.0 introduces UI for managing named servers via the user home page:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
as well as the admin page:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
Named servers can be accessed, created, started, stopped, and deleted
|
|
||||||
from these pages. Activity tracking is now per server as well.
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
When using named servers, Spawners may need additional configuration to take the `servername` into account. Whilst `KubeSpawner` takes the `servername` into account by default in [`pod_name_template`](https://jupyterhub-kubespawner.readthedocs.io/en/latest/spawner.html#kubespawner.KubeSpawner.pod_name_template), other Spawners may not. Check the documentation for the specific Spawner to see how singleuser servers are named, for example in `DockerSpawner` this involves modifying the [`name_template`](https://jupyterhub-dockerspawner.readthedocs.io/en/latest/api/index.html) setting to include `servername`, eg. `"{prefix}-{username}-{servername}"`.
|
|
||||||
|
|
||||||
(classic-notebook-ui)=
|
|
||||||
|
|
||||||
## Switching back to the classic notebook
|
|
||||||
|
|
||||||
By default, the single-user server launches JupyterLab,
|
|
||||||
which is based on [Jupyter Server][].
|
|
||||||
|
|
||||||
This is the default server when running JupyterHub ≥ 2.0.
|
|
||||||
To switch to using the legacy Jupyter Notebook server (notebook < 7.0), you can set the `JUPYTERHUB_SINGLEUSER_APP` environment variable
|
|
||||||
(in the single-user environment) to:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
export JUPYTERHUB_SINGLEUSER_APP='notebook.notebookapp.NotebookApp'
|
|
||||||
```
|
|
||||||
|
|
||||||
:::{note}
|
|
||||||
|
|
||||||
```
|
|
||||||
JUPYTERHUB_SINGLEUSER_APP='notebook.notebookapp.NotebookApp'
|
|
||||||
```
|
|
||||||
|
|
||||||
is only valid for notebook < 7. notebook v7 is based on jupyter-server,
|
|
||||||
and the default jupyter-server application must be used.
|
|
||||||
Selecting the new notebook UI is no longer a matter of selecting the server app to launch,
|
|
||||||
but only the default URL for users to visit.
|
|
||||||
To use notebook v7 with JupyterHub, leave the default singleuser app config alone (or specify `JUPYTERHUB_SINGLEUSER_APP=jupyter-server`) and set the default _URL_ for user servers:
|
|
||||||
|
|
||||||
```python
|
|
||||||
c.Spawner.default_url = '/tree/'
|
|
||||||
```
|
|
||||||
|
|
||||||
:::
|
|
||||||
|
|
||||||
[jupyter server]: https://jupyter-server.readthedocs.io
|
|
||||||
[jupyter notebook]: https://jupyter-notebook.readthedocs.io
|
|
||||||
|
|
||||||
:::{versionchanged} 2.0
|
|
||||||
|
|
||||||
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 the Jupyter server could be selected by specifying the following:
|
|
||||||
|
|
||||||
```python
|
|
||||||
# jupyterhub_config.py
|
|
||||||
c.Spawner.cmd = ["jupyter-labhub"]
|
|
||||||
```
|
|
||||||
|
|
||||||
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'
|
|
||||||
```
|
|
||||||
|
|
||||||
:::
|
|
@@ -1,130 +0,0 @@
|
|||||||
# Logging users in via URL
|
|
||||||
|
|
||||||
Sometimes, JupyterHub is integrated into an existing application that has already handled user login, etc..
|
|
||||||
It is often preferable in these applications to be able to link users to their running JupyterHub server without _prompting_ the user to login again with the Hub when the Hub should really be an implementation detail,
|
|
||||||
and not part of the user experience.
|
|
||||||
|
|
||||||
One way to do this has been to use [API only mode](#howto:api-only), issue tokens for users, and redirect users to a URL like `/users/name/?token=abc123`.
|
|
||||||
This is [disabled by default](#HubAuth.allow_token_in_url) in JupyterHub 5, because it presents a vulnerability for users to craft links that let _other_ users login as them, which can lead to inter-user attacks.
|
|
||||||
|
|
||||||
But that leaves the question: how do I as an _application developer_ embedding JupyterHub link users to their own running server without triggering another login prompt?
|
|
||||||
|
|
||||||
The problem with `?token=...` in the URL is specifically that _users_ can get and create these tokens, and share URLs.
|
|
||||||
This wouldn't be an issue if only authorized applications could issue tokens that behave this way.
|
|
||||||
The single-user server doesn't exactly have the hooks to manage this easily, but the [Authenticator](#Authenticator) API does.
|
|
||||||
|
|
||||||
## Problem statement
|
|
||||||
|
|
||||||
We want our external application to be able to:
|
|
||||||
|
|
||||||
1. authenticate users
|
|
||||||
2. (maybe) create JupyterHub users
|
|
||||||
3. start JupyterHub servers
|
|
||||||
4. redirect users into running servers _without_ any login prompts/loading pages from JupyterHub, and without any prior JupyterHub credentials
|
|
||||||
|
|
||||||
Step 1 is up to the application and not JupyterHub's problem.
|
|
||||||
Step 2 and 3 use the JupyterHub [REST API](#jupyterhub-rest-API).
|
|
||||||
The service would need the scopes:
|
|
||||||
|
|
||||||
```
|
|
||||||
admin:users # creating users
|
|
||||||
servers # start/stop servers
|
|
||||||
```
|
|
||||||
|
|
||||||
That leaves the last step: sending users to their running server with credentials, without prompting login.
|
|
||||||
This is where things can get tricky!
|
|
||||||
|
|
||||||
### Ideal case: oauth
|
|
||||||
|
|
||||||
_Ideally_, the best way to set this up is with the external service as an OAuth provider,
|
|
||||||
though in some cases it works best to use proxy-based authentication like Shibboleth / [REMOTE_USER](https://github.com/cwaldbieser/jhub_remote_user_authenticator).
|
|
||||||
The main things to know are:
|
|
||||||
|
|
||||||
- Links to `/hub/user-redirect/some/path` will ultimately land users at `/users/theirserver/some/path` after completing login, ensuring the server is running, etc.
|
|
||||||
- Setting `Authenticator.auto_login = True` allows beginning the login process without JupyterHub's "Login with..." prompt
|
|
||||||
|
|
||||||
_If_ your OAuth provider allows logging in to external services via your oauth provider without prompting, this is enough.
|
|
||||||
Not all do, though.
|
|
||||||
|
|
||||||
If you've already ensured the server is running, this will _appear_ to the user as if they are being sent directly to their running server.
|
|
||||||
But what _actually_ happens is quite a series of redirects, state checks, and cookie-setting:
|
|
||||||
|
|
||||||
1. visiting `/hub/user-redirect/some/path` checks if the user is logged in
|
|
||||||
1. if not, begin the login process (`/hub/login?next=/hub/user-redirect/...`)
|
|
||||||
2. redirects to your oauth provider to authenticate the user
|
|
||||||
3. redirects back to `/hub/oauth_callback` to complete login
|
|
||||||
4. redirects back to `/hub/user-redirect/...`
|
|
||||||
2. once authenticated, checks that the user's server is running
|
|
||||||
1. if not running, begins launch of the server
|
|
||||||
2. redirects to `/hub/spawn-pending/?next=...`
|
|
||||||
3. once the server is running, redirects to the actual user server `/users/username/some/path`
|
|
||||||
|
|
||||||
Now we're done, right? Actually, no, because the browser doesn't have credentials for their user server!
|
|
||||||
This sequence of redirects happens all the time in JupyterHub launch, and is usually totally transparent.
|
|
||||||
|
|
||||||
4. at the user server, check for a token in cookie
|
|
||||||
1. if not present or not valid, begin oauth with the Hub (redirect to `/hub/api/oauth2/authorize/...`)
|
|
||||||
2. hub redirects back to `/users/user/oauth_callback` to complete oauth
|
|
||||||
3. redirect again to the URL that started this internal oauth
|
|
||||||
5. finally, arrive at `/users/username/some/path`, the ultimate destination, with valid JupyterHub credentials
|
|
||||||
|
|
||||||
The steps that will show users something other than the page you want them to are:
|
|
||||||
|
|
||||||
- Step 1.1 will be a prompt e.g. with "Login with..." unless you set `c.Authenticator.auto_login = True`
|
|
||||||
- Step 1.2 _may_ be a prompt from your oauth provider. This isn't controlled by JupyterHub, and may not be avoidable.
|
|
||||||
- Step 2.2 will show the spawn pending page only if the server is not already running
|
|
||||||
|
|
||||||
Otherwise, this is all transparent redirects to the final destination.
|
|
||||||
|
|
||||||
#### Using an authentication proxy (REMOTE_USER)
|
|
||||||
|
|
||||||
If you use an Authentication proxy like Shibboleth that sets e.g. the REMOTE_USER header,
|
|
||||||
you can use an Authenticator like [RemoteUserAuthenticator](https://github.com/cwaldbieser/jhub_remote_user_authenticator) to automatically login users based on headers in the request.
|
|
||||||
The same process will work, but instead of step 1.1 redirecting to the oauth provider, it logs in immediately.
|
|
||||||
If you do support an auth proxy, you also need to be extremely sure that requests only come from the auth proxy, and don't accept any requests setting the REMOTE_USER header coming from other sources.
|
|
||||||
|
|
||||||
### Custom case
|
|
||||||
|
|
||||||
But let's say you can't use OAuth or REMOTE_USER, and you still want to hide JupyterHub implementation details.
|
|
||||||
All you really want is a way to write a URL that will take users to their servers without any login prompts.
|
|
||||||
|
|
||||||
You can do this if you create an Authenticator with `auto_login=True` that logs users in based on something in the _request_, e.g. a query parameter.
|
|
||||||
|
|
||||||
We have an _example_ in the JupyterHub repo in `examples/forced-login` that does this.
|
|
||||||
It is a sample 'external service' where you type in a username and a destination path.
|
|
||||||
When you 'login' with this username:
|
|
||||||
|
|
||||||
1. a token is issued
|
|
||||||
2. the token is stored and associated with the username
|
|
||||||
3. redirect to `/hub/login?login_token=...&next=/hub/user-redirect/destination/path`
|
|
||||||
|
|
||||||
Then on the JupyterHub side, there is the `ForcedLoginAuthenticator`.
|
|
||||||
This class implements `authenticate`, which:
|
|
||||||
|
|
||||||
1. has `auto_login = True` so visiting `/hub/login` calls `authenticate()` directly instead of serving a page
|
|
||||||
2. gets the token from the `login_token` URL parameter
|
|
||||||
3. makes a POST request to the external application with the token, requesting a username
|
|
||||||
4. the external application returns the username and deletes the token, so it cannot be re-used
|
|
||||||
5. Authenticator returns the username
|
|
||||||
|
|
||||||
This doesn't _bypass_ JupyterHub authentication, as some deployments have done, but it does _hide_ it.
|
|
||||||
If your service launches servers via the API, you could run this in [API only mode](#howto:api-only) by adding `/hub/login` as well:
|
|
||||||
|
|
||||||
```python
|
|
||||||
c.JupyterHub.hub_routespec = "/hub/api/"
|
|
||||||
c.Proxy.additional_routes = {"/hub/login": "http://hub:8080"}
|
|
||||||
```
|
|
||||||
|
|
||||||
```{literalinclude} ../../../examples/forced-login/jupyterhub_config.py
|
|
||||||
:language: python
|
|
||||||
:start-at: class ForcedLoginAuthenticator
|
|
||||||
:end-before: c = get_config()
|
|
||||||
```
|
|
||||||
|
|
||||||
**Why does this work?**
|
|
||||||
|
|
||||||
This is still logging in with a token in the URL, right?
|
|
||||||
Yes, but the key difference is that users cannot issue these tokens.
|
|
||||||
The sample application is still technically vulnerable, because the token link should really be non-transferrable, even if it can only be used once.
|
|
||||||
The only defense the sample application has against this is rapidly expiring tokens (they expire after 30 seconds).
|
|
||||||
You can use state cookies, etc. to manage that more rigorously, as done in OAuth (at which point, maybe implement OAuth itself, why not?).
|
|
@@ -1,34 +0,0 @@
|
|||||||
# How-to
|
|
||||||
|
|
||||||
The _How-to_ guides provide practical step-by-step details to help you achieve a particular goal. They are useful when you are trying to get something done but require you to understand and adapt the steps to your specific usecase.
|
|
||||||
|
|
||||||
Use the following guides when:
|
|
||||||
|
|
||||||
```{toctree}
|
|
||||||
:maxdepth: 1
|
|
||||||
|
|
||||||
api-only
|
|
||||||
proxy
|
|
||||||
rest
|
|
||||||
separate-proxy
|
|
||||||
templates
|
|
||||||
upgrading
|
|
||||||
log-messages
|
|
||||||
forced-login
|
|
||||||
```
|
|
||||||
|
|
||||||
(config-examples)=
|
|
||||||
|
|
||||||
## Configuration
|
|
||||||
|
|
||||||
The following guides provide examples, including configuration files and tips, for the
|
|
||||||
following:
|
|
||||||
|
|
||||||
```{toctree}
|
|
||||||
:maxdepth: 1
|
|
||||||
|
|
||||||
configuration/config-user-env
|
|
||||||
configuration/config-ghoauth
|
|
||||||
configuration/config-proxy
|
|
||||||
configuration/config-sudo
|
|
||||||
```
|
|
@@ -1,144 +0,0 @@
|
|||||||
(howto:upgrading-v5)=
|
|
||||||
|
|
||||||
# Upgrading to JupyterHub 5
|
|
||||||
|
|
||||||
This document describes the specific considerations.
|
|
||||||
For general upgrading tips, see the [docs on upgrading jupyterhub](upgrading).
|
|
||||||
|
|
||||||
You can see the [changelog](changelog) for more detailed information.
|
|
||||||
|
|
||||||
## Python version
|
|
||||||
|
|
||||||
JupyterHub 5 requires Python 3.8.
|
|
||||||
Make sure you have at least Python 3.8 in your user and hub environments before upgrading.
|
|
||||||
|
|
||||||
## Database upgrades
|
|
||||||
|
|
||||||
JupyterHub 5 does have a database schema upgrade,
|
|
||||||
so you should backup your database and run `jupyterhub upgrade-db` after upgrading and before starting JupyterHub.
|
|
||||||
The updated schema only adds some columns, so is one that should be not too disruptive to roll back if you need to.
|
|
||||||
|
|
||||||
## User subdomains
|
|
||||||
|
|
||||||
All JupyterHub deployments which care about protecting users from each other are encouraged to enable per-user domains, if possible,
|
|
||||||
as this provides the best isolation between user servers.
|
|
||||||
|
|
||||||
To enable subdomains, set:
|
|
||||||
|
|
||||||
```python
|
|
||||||
c.JupyterHub.subdomain_host = "https://myjupyterhub.example.org"
|
|
||||||
```
|
|
||||||
|
|
||||||
If you were using subdomains before, some user servers and all services will be on different hosts in the default configuration.
|
|
||||||
|
|
||||||
JupyterHub 5 allows complete customization of the subdomain scheme via the new {attr}`.JupyterHub.subdomain_hook`,
|
|
||||||
and changes the default subdomain scheme.
|
|
||||||
.
|
|
||||||
|
|
||||||
You can provide a completely custom subdomain scheme, or select one of two default implementations by name: `idna` or `legacy`. `idna` is the default.
|
|
||||||
|
|
||||||
The new default behavior can be selected explicitly via:
|
|
||||||
|
|
||||||
```python
|
|
||||||
c.JupyterHub.subdomain_hook = "idna"
|
|
||||||
```
|
|
||||||
|
|
||||||
Or to delay any changes to URLs for your users, you can opt-in to the pre-5.0 behavior with:
|
|
||||||
|
|
||||||
```python
|
|
||||||
c.JupyterHub.subdomain_hook = "legacy"
|
|
||||||
```
|
|
||||||
|
|
||||||
The key differences of the new `idna` scheme:
|
|
||||||
|
|
||||||
- It should always produce valid domains, regardless of username (not true for the legacy scheme when using characters that might need escaping or usernames that are long)
|
|
||||||
- each Service gets its own subdomain on `service--` rather than sharing `services.`
|
|
||||||
|
|
||||||
Below is a table of examples of users and services with their domains with the old and new scheme, assuming the configuration:
|
|
||||||
|
|
||||||
```python
|
|
||||||
c.JupyterHub.subdomain_host = "https://jupyter.example.org"
|
|
||||||
```
|
|
||||||
|
|
||||||
| kind | name | legacy | idna |
|
|
||||||
| ------- | ------------------ | ---------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
|
|
||||||
| user | laudna | `laudna.jupyter.example.org` | `laudna.jupyter.example.org` |
|
|
||||||
| service | bells | `services.jupyter.example.org` | `bells--service.jupyter.example.org` |
|
|
||||||
| user | jester@mighty.nein | `jester_40mighty.nein.jupyter.example.org` (may not work!) | `u-jestermi--8037680.jupyter.example.org` (not as pretty, but guaranteed to be valid and not collide) |
|
|
||||||
|
|
||||||
## Tokens in URLs
|
|
||||||
|
|
||||||
JupyterHub 5 does not accept `?token=...` URLs by default in single-user servers.
|
|
||||||
These URLs allow one user to force another to login as them,
|
|
||||||
which can be the start of an inter-user attack.
|
|
||||||
|
|
||||||
There is a valid use case for producing links which allow starting a fully authenticated session,
|
|
||||||
so you may still opt in to this behavior by setting:
|
|
||||||
|
|
||||||
```python
|
|
||||||
c.Spawner.environment.update({"JUPYTERHUB_ALLOW_TOKEN_IN_URL": "1"})
|
|
||||||
```
|
|
||||||
|
|
||||||
if you are not concerned about protecting your users from each other.
|
|
||||||
If you have subdomains enabled, the threat is substantially reduced.
|
|
||||||
|
|
||||||
## Sharing
|
|
||||||
|
|
||||||
The big new feature in JupyterHub 5.0 is sharing.
|
|
||||||
Check it out in [the sharing docs](sharing-tutorial).
|
|
||||||
|
|
||||||
## Authenticator.allow_all and allow_existing_users
|
|
||||||
|
|
||||||
Prior to JupyterHub 5, JupyterHub Authenticators had the _implicit_ default behavior to allow any user who successfully authenticates to login **if no users are explicitly allowed** (i.e. `allowed_users` is empty on the base class).
|
|
||||||
This behavior was considered a too-permissive default in Authenticators that source large user pools like OAuthenticator, which would accept e.g. all users with a Google account by default.
|
|
||||||
As a result, OAuthenticator 16 introduced two configuration options: `allow_all` and `allow_existing_users`.
|
|
||||||
|
|
||||||
JupyterHub 5 adopts these options for all Authenticators:
|
|
||||||
|
|
||||||
1. `Authenticator.allow_all` (default: False)
|
|
||||||
2. `Authenticator.allow_existing_users` (default: True if allowed_users is non-empty, False otherwise)
|
|
||||||
|
|
||||||
having the effect that _some_ allow configuration is required for anyone to be able to login.
|
|
||||||
If you want to preserve the pre-5.0 behavior with no explicit `allow` configuration, set:
|
|
||||||
|
|
||||||
```python
|
|
||||||
c.Authenticator.allow_all = True
|
|
||||||
```
|
|
||||||
|
|
||||||
`allow_existing_users` defaults are meant to be backward-compatible, but you can now _explicitly_ allow or not based on presence in the database by setting `Authenticator.allow_existing_users` to True or False.
|
|
||||||
|
|
||||||
:::{seealso}
|
|
||||||
|
|
||||||
[Authenticator config docs](authenticators) for details on these and other Authenticator options.
|
|
||||||
:::
|
|
||||||
|
|
||||||
## Bootstrap 5
|
|
||||||
|
|
||||||
JupyterHub uses the CSS framework [bootstrap](https://getbootstrap.com), which is upgraded from 3.4 to 5.3.
|
|
||||||
If you don't have any custom HTML templates, you are likely to only see relatively minor aesthetic changes.
|
|
||||||
If you have custom HTML templates or spawner options forms, they may need some updating to look right.
|
|
||||||
|
|
||||||
See the bootstrap documentation. Since we upgraded two major versions, you might need to look at both v4 and v5 documentation for what has changed since 3.x:
|
|
||||||
|
|
||||||
- [migrating to v4](https://getbootstrap.com/docs/4.6/migration/)
|
|
||||||
- [migrating to v5](https://getbootstrap.com/docs/5.3/migration/)
|
|
||||||
|
|
||||||
If you customized the JupyterHub CSS by recompiling from LESS files, bootstrap migrated to SCSS.
|
|
||||||
You can start by autoconverting your LESS to SCSS (it's not that different) with [less2sass](https://github.com/ekryski/less2sass):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm install --global less2scss
|
|
||||||
# converts less/foo.less to scss/foo.scss
|
|
||||||
less2scss --src ./less --dst ./scss
|
|
||||||
```
|
|
||||||
|
|
||||||
Bootstrap also allows configuring things with [CSS variables](https://getbootstrap.com/docs/5.3/customize/css-variables/), so depending on what you have customized, you may be able to get away with just adding a CSS file defining variables without rebuilding the whole SCSS.
|
|
||||||
|
|
||||||
## groups required with Authenticator.manage_groups
|
|
||||||
|
|
||||||
Setting `Authenticator.manage_groups = True` allows the Authenticator to manage group membership by returning `groups` from the authentication model.
|
|
||||||
However, this option is available even on Authenticators that do not support it, which led to confusion.
|
|
||||||
Starting with JupyterHub 5, if `manage_groups` is True `authenticate` _must_ return a groups field, otherwise an error is raised.
|
|
||||||
This prevents confusion when users enable managed groups that is not implemented.
|
|
||||||
|
|
||||||
If an Authenticator _does_ support managing groups but was not providing a `groups` field in order to leave membership unmodified, it must specify `"groups": None` to make this explicit instead of implicit (this is backward-compatible).
|
|
@@ -1,138 +0,0 @@
|
|||||||
(howto:upgrading-jupyterhub)=
|
|
||||||
|
|
||||||
# Upgrading JupyterHub
|
|
||||||
|
|
||||||
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 documentation is
|
|
||||||
for those who have set up their JupyterHub without using a distribution.
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
For specific version migrations:
|
|
||||||
|
|
||||||
```{toctree}
|
|
||||||
:maxdepth: 1
|
|
||||||
|
|
||||||
./upgrading-v5
|
|
||||||
```
|
|
||||||
|
|
||||||
## Read the Changelog
|
|
||||||
|
|
||||||
The [changelog](changelog) 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 the authenticators and spawners you use, so
|
|
||||||
read the changelogs for those too!
|
|
||||||
|
|
||||||
## Notify your users
|
|
||||||
|
|
||||||
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 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 or sign in.
|
|
||||||
|
|
||||||
## Backup database and config
|
|
||||||
|
|
||||||
Before doing an upgrade, it is critical to back up:
|
|
||||||
|
|
||||||
1. 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.
|
|
||||||
2. Your `jupyterhub_config.py` file.
|
|
||||||
3. 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.
|
|
||||||
|
|
||||||
## Shut down JupyterHub
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
## Upgrade JupyterHub packages
|
|
||||||
|
|
||||||
There are two environments where the `jupyterhub` package is installed:
|
|
||||||
|
|
||||||
1. 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.
|
|
||||||
2. 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 the same environment as the hub environment. The hub
|
|
||||||
launched the `jupyterhub-singleuser` command in this environment,
|
|
||||||
which in turn starts the notebook server.
|
|
||||||
|
|
||||||
You need to make sure the version of the `jupyterhub` package matches
|
|
||||||
in both these environments. If you installed `jupyterhub` with pip,
|
|
||||||
you can upgrade it with:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python3 -m pip install --upgrade jupyterhub==<version>
|
|
||||||
```
|
|
||||||
|
|
||||||
Where `<version>` is the version of JupyterHub you are upgrading to.
|
|
||||||
|
|
||||||
If you used `conda` to install `jupyterhub`, you should upgrade it
|
|
||||||
with:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
conda install -c conda-forge jupyterhub==<version>
|
|
||||||
```
|
|
||||||
|
|
||||||
You should also check for new releases of the authenticator and spawner you
|
|
||||||
are using. You might wish to upgrade those packages, too, along with JupyterHub
|
|
||||||
or upgrade them separately.
|
|
||||||
|
|
||||||
## Upgrade JupyterHub database
|
|
||||||
|
|
||||||
Once new packages are installed, you need to upgrade the JupyterHub
|
|
||||||
database. From the hub environment, in the same directory as your
|
|
||||||
`jupyterhub_config.py` file, you should run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
jupyterhub upgrade-db
|
|
||||||
```
|
|
||||||
|
|
||||||
This should find the location of your database, and run the necessary upgrades
|
|
||||||
for it.
|
|
||||||
|
|
||||||
### What happens if I delete my database?
|
|
||||||
|
|
||||||
Losing the Hub database is often not a big deal. Information that
|
|
||||||
resides only in the Hub database includes:
|
|
||||||
|
|
||||||
- active login tokens (user cookies, service tokens)
|
|
||||||
- users added via JupyterHub UI, instead of config files
|
|
||||||
- info about running servers
|
|
||||||
|
|
||||||
If the following conditions are true, you should be fine clearing the
|
|
||||||
Hub database and starting over:
|
|
||||||
|
|
||||||
- users specified in the config file, or login using an external
|
|
||||||
authentication provider (Google, GitHub, LDAP, etc)
|
|
||||||
- user servers are stopped during the upgrade
|
|
||||||
- don't mind causing users to log in again after the upgrade
|
|
||||||
|
|
||||||
## Start JupyterHub
|
|
||||||
|
|
||||||
Once the database upgrade is completed, start the `jupyterhub`
|
|
||||||
process again.
|
|
||||||
|
|
||||||
1. Log in and start the server to make sure things work as
|
|
||||||
expected.
|
|
||||||
2. Check the logs for any errors or deprecation warnings. You
|
|
||||||
might have to update your `jupyterhub_config.py` file to
|
|
||||||
deal with any deprecated options.
|
|
||||||
|
|
||||||
Congratulations, your JupyterHub has been upgraded!
|
|
Before Width: | Height: | Size: 141 KiB |
Before Width: | Height: | Size: 1.1 MiB |
Before Width: | Height: | Size: 81 KiB |
Before Width: | Height: | Size: 1017 KiB |
Before Width: | Height: | Size: 607 KiB |
Before Width: | Height: | Size: 1.8 MiB |
Before Width: | Height: | Size: 8.1 KiB |