v0.14.0
Loading...
Searching...
No Matches
jupyterhub_config.py
Go to the documentation of this file.
1# Configuration file for jupyterhub.
2
3#------------------------------------------------------------------------------
4# Application(SingletonConfigurable) configuration
5#------------------------------------------------------------------------------
6## This is an application.
7
8## The date format used by logging formatters for %(asctime)s
9# Default: '%Y-%m-%d %H:%M:%S'
10# c.Application.log_datefmt = '%Y-%m-%d %H:%M:%S'
11
12## The Logging format template
13# Default: '[%(name)s]%(highlevel)s %(message)s'
14# c.Application.log_format = '[%(name)s]%(highlevel)s %(message)s'
15
16## Set the log level by value or name.
17# Choices: any of [0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL']
18# Default: 30
19# c.Application.log_level = 30
20
21## Instead of starting the Application, dump configuration to stdout
22# Default: False
23# c.Application.show_config = False
24
25## Instead of starting the Application, dump configuration to stdout (as JSON)
26# Default: False
27# c.Application.show_config_json = False
28
29#------------------------------------------------------------------------------
30# JupyterHub(Application) configuration
31#------------------------------------------------------------------------------
32## An Application for starting a Multi-User Jupyter Notebook server.
33
34## Maximum number of concurrent servers that can be active at a time.
35#
36# Setting this can limit the total resources your users can consume.
37#
38# An active server is any server that's not fully stopped. It is considered
39# active from the time it has been requested until the time that it has
40# completely stopped.
41#
42# If this many user servers are active, users will not be able to launch new
43# servers until a server is shutdown. Spawn requests will be rejected with a 429
44# error asking them to try again.
45#
46# If set to 0, no limit is enforced.
47# Default: 0
48c.JupyterHub.active_server_limit = 0
49
50## Duration (in seconds) to determine the number of active users.
51# Default: 1800
52#c.JupyterHub.active_user_window = 1800
53
54## Resolution (in seconds) for updating activity
55#
56# If activity is registered that is less than activity_resolution seconds more
57# recent than the current value, the new value will be ignored.
58#
59# This avoids too many writes to the Hub database.
60# Default: 30
61# c.JupyterHub.activity_resolution = 30
62
63## Grant admin users permission to access single-user servers.
64#
65# Users should be properly informed if this is enabled.
66# Default: False
67c.JupyterHub.admin_access = True
68
69## DEPRECATED since version 0.7.2, use Authenticator.admin_users instead.
70# Default: set()
71
72from jupyterhub.auth import LocalAuthenticator
73from firstuseauthenticator import FirstUseAuthenticator
74class LocalNativeAuthenticator(LocalAuthenticator, FirstUseAuthenticator):
75 pass
76c.JupyterHub.authenticator_class = LocalNativeAuthenticator
77
78c.Authenticator.admin_users = {'mofem'}
79c.FirstUseAuthenticator.add_user_cmd = [
80 'useradd',
81 '-m',
82 '-d', '/mofem_install/jupyter/USERNAME',
83 '-k', '/mofem_install/jupyter/skel/',
84 '-p', 'paN8aiEIonqJE']
85c.FirstUseAuthenticator.create_system_users = True
86c.FirstUseAuthenticator.create_users = False
87
88## Allow named single-user servers per user
89# Default: False
90# c.JupyterHub.allow_named_servers = False
91
92## Answer yes to any questions (e.g. confirm overwrite)
93# Default: False
94# c.JupyterHub.answer_yes = False
95
96## PENDING DEPRECATION: consider using services
97#
98# Dict of token:username to be loaded into the database.
99#
100# Allows ahead-of-time generation of API tokens for use by externally managed
101# services, which authenticate as JupyterHub users.
102#
103# Consider using services for general services that talk to the JupyterHub API.
104# Default: {}
105# c.JupyterHub.api_tokens = {}
106
107## Authentication for prometheus metrics
108# Default: True
109# c.JupyterHub.authenticate_prometheus = True
110
111## Class for authenticating users.
112#
113# This should be a subclass of :class:`jupyterhub.auth.Authenticator`
114#
115# with an :meth:`authenticate` method that:
116#
117# - is a coroutine (asyncio or tornado)
118# - returns username on success, None on failure
119# - takes two arguments: (handler, data),
120# where `handler` is the calling web.RequestHandler,
121# and `data` is the POST form data from the login page.
122#
123# .. versionchanged:: 1.0
124# authenticators may be registered via entry points,
125# e.g. `c.JupyterHub.authenticator_class = 'pam'`
126#
127# Currently installed:
128# - default: jupyterhub.auth.PAMAuthenticator
129# - dummy: jupyterhub.auth.DummyAuthenticator
130# - pam: jupyterhub.auth.PAMAuthenticator
131# Default: 'jupyterhub.auth.PAMAuthenticator'
132#c.JupyterHub.authenticator_class = 'dummyauthenticator.DummyAuthenticator'
133
134## The base URL of the entire application.
135#
136# Add this to the beginning of all JupyterHub URLs. Use base_url to run
137# JupyterHub within an existing website.
138#
139# .. deprecated: 0.9
140# Use JupyterHub.bind_url
141# Default: '/'
142# c.JupyterHub.base_url = '/'
143
144## The public facing URL of the whole JupyterHub application.
145#
146# This is the address on which the proxy will bind. Sets protocol, ip, base_url
147# Default: 'http://:8000'
148# c.JupyterHub.bind_url = 'http://:8000'
149
150## Whether to shutdown the proxy when the Hub shuts down.
151#
152# Disable if you want to be able to teardown the Hub while leaving the proxy
153# running.
154#
155# Only valid if the proxy was starting by the Hub process.
156#
157# If both this and cleanup_servers are False, sending SIGINT to the Hub will
158# only shutdown the Hub, leaving everything else running.
159#
160# The Hub should be able to resume from database state.
161# Default: True
162# c.JupyterHub.cleanup_proxy = True
163
164## Whether to shutdown single-user servers when the Hub shuts down.
165#
166# Disable if you want to be able to teardown the Hub while leaving the single-
167# user servers running.
168#
169# If both this and cleanup_proxy are False, sending SIGINT to the Hub will only
170# shutdown the Hub, leaving everything else running.
171#
172# The Hub should be able to resume from database state.
173# Default: True
174# c.JupyterHub.cleanup_servers = True
175
176## Maximum number of concurrent users that can be spawning at a time.
177#
178# Spawning lots of servers at the same time can cause performance problems for
179# the Hub or the underlying spawning system. Set this limit to prevent bursts of
180# logins from attempting to spawn too many servers at the same time.
181#
182# This does not limit the number of total running servers. See
183# active_server_limit for that.
184#
185# If more than this many users attempt to spawn at a time, their requests will
186# be rejected with a 429 error asking them to try again. Users will have to wait
187# for some of the spawning services to finish starting before they can start
188# their own.
189#
190# If set to 0, no limit is enforced.
191# Default: 100
192c.JupyterHub.concurrent_spawn_limit = 100
193
194## The config file to load
195# Default: 'jupyterhub_config.py'
196# c.JupyterHub.config_file = 'jupyterhub_config.py'
197
198## DEPRECATED: does nothing
199# Default: False
200# c.JupyterHub.confirm_no_ssl = False
201
202## Number of days for a login cookie to be valid. Default is two weeks.
203# Default: 14
204# c.JupyterHub.cookie_max_age_days = 14
205
206## The cookie secret to use to encrypt cookies.
207#
208# Loaded from the JPY_COOKIE_SECRET env variable by default.
209#
210# Should be exactly 256 bits (32 bytes).
211# Default: b''
212# c.JupyterHub.cookie_secret = b''
213
214## File in which to store the cookie secret.
215# Default: 'jupyterhub_cookie_secret'
216# c.JupyterHub.cookie_secret_file = 'jupyterhub_cookie_secret'
217
218## The location of jupyterhub data files (e.g. /usr/local/share/jupyterhub)
219# Default: '/usr/local/share/jupyterhub'
220# c.JupyterHub.data_files_path = '/usr/local/share/jupyterhub'
221
222## Include any kwargs to pass to the database connection. See
223# sqlalchemy.create_engine for details.
224# Default: {}
225# c.JupyterHub.db_kwargs = {}
226
227## url for the database. e.g. `sqlite:///jupyterhub.sqlite`
228# Default: 'sqlite:///jupyterhub.sqlite'
229# c.JupyterHub.db_url = 'sqlite:///jupyterhub.sqlite'
230
231## log all database transactions. This has A LOT of output
232# Default: False
233# c.JupyterHub.debug_db = False
234
235## DEPRECATED since version 0.8: Use ConfigurableHTTPProxy.debug
236# Default: False
237# c.JupyterHub.debug_proxy = False
238
239## If named servers are enabled, default name of server to spawn or open, e.g. by
240# user-redirect.
241# Default: ''
242# c.JupyterHub.default_server_name = ''
243
244## The default URL for users when they arrive (e.g. when user directs to "/")
245#
246# By default, redirects users to their own server.
247#
248# Can be a Unicode string (e.g. '/hub/home') or a callable based on the handler
249# object:
250#
251# ::
252#
253# def default_url_fn(handler):
254# user = handler.current_user
255# if user and user.admin:
256# return '/hub/admin'
257# return '/hub/home'
258#
259# c.JupyterHub.default_url = default_url_fn
260# Default: traitlets.Undefined
261# c.JupyterHub.default_url = traitlets.Undefined
262
263## Dict authority:dict(files). Specify the key, cert, and/or ca file for an
264# authority. This is useful for externally managed proxies that wish to use
265# internal_ssl.
266#
267# The files dict has this format (you must specify at least a cert)::
268#
269# {
270# 'key': '/path/to/key.key',
271# 'cert': '/path/to/cert.crt',
272# 'ca': '/path/to/ca.crt'
273# }
274#
275# The authorities you can override: 'hub-ca', 'notebooks-ca', 'proxy-api-ca',
276# 'proxy-client-ca', and 'services-ca'.
277#
278# Use with internal_ssl
279# Default: {}
280# c.JupyterHub.external_ssl_authorities = {}
281
282## Register extra tornado Handlers for jupyterhub.
283#
284# Should be of the form ``("<regex>", Handler)``
285#
286# The Hub prefix will be added, so `/my-page` will be served at `/hub/my-page`.
287# Default: []
288# c.JupyterHub.extra_handlers = []
289
290## DEPRECATED: use output redirection instead, e.g.
291#
292# jupyterhub &>> /var/log/jupyterhub.log
293# Default: ''
294# c.JupyterHub.extra_log_file = ''
295
296## Extra log handlers to set on JupyterHub logger
297# Default: []
298# c.JupyterHub.extra_log_handlers = []
299
300## Generate certs used for internal ssl
301# Default: False
302# c.JupyterHub.generate_certs = False
303
304## Generate default config file
305# Default: False
306# c.JupyterHub.generate_config = False
307
308## The URL on which the Hub will listen. This is a private URL for internal
309# communication. Typically set in combination with hub_connect_url. If a unix
310# socket, hub_connect_url **must** also be set.
311#
312# For example:
313#
314# "http://127.0.0.1:8081"
315# "unix+http://%2Fsrv%2Fjupyterhub%2Fjupyterhub.sock"
316#
317# .. versionadded:: 0.9
318# Default: ''
319# c.JupyterHub.hub_bind_url = ''
320
321## The ip or hostname for proxies and spawners to use for connecting to the Hub.
322#
323# Use when the bind address (`hub_ip`) is 0.0.0.0, :: or otherwise different
324# from the connect address.
325#
326# Default: when `hub_ip` is 0.0.0.0 or ::, use `socket.gethostname()`, otherwise
327# use `hub_ip`.
328#
329# Note: Some spawners or proxy implementations might not support hostnames.
330# Check your spawner or proxy documentation to see if they have extra
331# requirements.
332#
333# .. versionadded:: 0.8
334# Default: ''
335# c.JupyterHub.hub_connect_ip = ''
336
337## DEPRECATED
338#
339# Use hub_connect_url
340#
341# .. versionadded:: 0.8
342#
343# .. deprecated:: 0.9
344# Use hub_connect_url
345# Default: 0
346# c.JupyterHub.hub_connect_port = 0
347
348## The URL for connecting to the Hub. Spawners, services, and the proxy will use
349# this URL to talk to the Hub.
350#
351# Only needs to be specified if the default hub URL is not connectable (e.g.
352# using a unix+http:// bind url).
353#
354# .. seealso::
355# JupyterHub.hub_connect_ip
356# JupyterHub.hub_bind_url
357#
358# .. versionadded:: 0.9
359# Default: ''
360# c.JupyterHub.hub_connect_url = ''
361
362## The ip address for the Hub process to *bind* to.
363#
364# By default, the hub listens on localhost only. This address must be accessible
365# from the proxy and user servers. You may need to set this to a public ip or ''
366# for all interfaces if the proxy or user servers are in containers or on a
367# different host.
368#
369# See `hub_connect_ip` for cases where the bind and connect address should
370# differ, or `hub_bind_url` for setting the full bind URL.
371# Default: '127.0.0.1'
372# c.JupyterHub.hub_ip = '127.0.0.1'
373
374## The internal port for the Hub process.
375#
376# This is the internal port of the hub itself. It should never be accessed
377# directly. See JupyterHub.port for the public port to use when accessing
378# jupyterhub. It is rare that this port should be set except in cases of port
379# conflict.
380#
381# See also `hub_ip` for the ip and `hub_bind_url` for setting the full bind URL.
382# Default: 8081
383# c.JupyterHub.hub_port = 8081
384
385## Trigger implicit spawns after this many seconds.
386#
387# When a user visits a URL for a server that's not running, they are shown a
388# page indicating that the requested server is not running with a button to
389# spawn the server.
390#
391# Setting this to a positive value will redirect the user after this many
392# seconds, effectively clicking this button automatically for the users,
393# automatically beginning the spawn process.
394#
395# Warning: this can result in errors and surprising behavior when sharing access
396# URLs to actual servers, since the wrong server is likely to be started.
397# Default: 0
398# c.JupyterHub.implicit_spawn_seconds = 0
399
400## Timeout (in seconds) to wait for spawners to initialize
401#
402# Checking if spawners are healthy can take a long time if many spawners are
403# active at hub start time.
404#
405# If it takes longer than this timeout to check, init_spawner will be left to
406# complete in the background and the http server is allowed to start.
407#
408# A timeout of -1 means wait forever, which can mean a slow startup of the Hub
409# but ensures that the Hub is fully consistent by the time it starts responding
410# to requests. This matches the behavior of jupyterhub 1.0.
411#
412# .. versionadded: 1.1.0
413# Default: 10
414# c.JupyterHub.init_spawners_timeout = 10
415
416## The location to store certificates automatically created by JupyterHub.
417#
418# Use with internal_ssl
419# Default: 'internal-ssl'
420# c.JupyterHub.internal_certs_location = 'internal-ssl'
421
422## Enable SSL for all internal communication
423#
424# This enables end-to-end encryption between all JupyterHub components.
425# JupyterHub will automatically create the necessary certificate authority and
426# sign notebook certificates as they're created.
427# Default: False
428# c.JupyterHub.internal_ssl = False
429
430## The public facing ip of the whole JupyterHub application (specifically
431# referred to as the proxy).
432#
433# This is the address on which the proxy will listen. The default is to listen
434# on all interfaces. This is the only address through which JupyterHub should be
435# accessed by users.
436#
437# .. deprecated: 0.9
438# Use JupyterHub.bind_url
439# Default: ''
440# c.JupyterHub.ip = ''
441
442## Supply extra arguments that will be passed to Jinja environment.
443# Default: {}
444# c.JupyterHub.jinja_environment_options = {}
445
446## Interval (in seconds) at which to update last-activity timestamps.
447# Default: 300
448# c.JupyterHub.last_activity_interval = 300
449
450## Dict of 'group': ['usernames'] to load at startup.
451#
452# This strictly *adds* groups and users to groups.
453#
454# Loading one set of groups, then starting JupyterHub again with a different set
455# will not remove users or groups from previous launches. That must be done
456# through the API.
457# Default: {}
458# c.JupyterHub.load_groups = {}
459
460## The date format used by logging formatters for %(asctime)s
461# See also: Application.log_datefmt
462# c.JupyterHub.log_datefmt = '%Y-%m-%d %H:%M:%S'
463
464## The Logging format template
465# See also: Application.log_format
466# c.JupyterHub.log_format = '[%(name)s]%(highlevel)s %(message)s'
467
468## Set the log level by value or name.
469# See also: Application.log_level
470# c.JupyterHub.log_level = 30
471
472## Specify path to a logo image to override the Jupyter logo in the banner.
473# Default: ''
474# c.JupyterHub.logo_file = ''
475
476## Maximum number of concurrent named servers that can be created by a user at a
477# time.
478#
479# Setting this can limit the total resources a user can consume.
480#
481# If set to 0, no limit is enforced.
482# Default: 0
483# c.JupyterHub.named_server_limit_per_user = 0
484
485## File to write PID Useful for daemonizing JupyterHub.
486# Default: ''
487# c.JupyterHub.pid_file = ''
488
489## The public facing port of the proxy.
490#
491# This is the port on which the proxy will listen. This is the only port through
492# which JupyterHub should be accessed by users.
493#
494# .. deprecated: 0.9
495# Use JupyterHub.bind_url
496# Default: 8000
497# c.JupyterHub.port = 8000
498
499## DEPRECATED since version 0.8 : Use ConfigurableHTTPProxy.api_url
500# Default: ''
501# c.JupyterHub.proxy_api_ip = ''
502
503## DEPRECATED since version 0.8 : Use ConfigurableHTTPProxy.api_url
504# Default: 0
505# c.JupyterHub.proxy_api_port = 0
506
507## DEPRECATED since version 0.8: Use ConfigurableHTTPProxy.auth_token
508# Default: ''
509# c.JupyterHub.proxy_auth_token = ''
510
511## Interval (in seconds) at which to check if the proxy is running.
512# Default: 30
513# c.JupyterHub.proxy_check_interval = 30
514
515## The class to use for configuring the JupyterHub proxy.
516#
517# Should be a subclass of :class:`jupyterhub.proxy.Proxy`.
518#
519# .. versionchanged:: 1.0
520# proxies may be registered via entry points,
521# e.g. `c.JupyterHub.proxy_class = 'traefik'`
522#
523# Currently installed:
524# - configurable-http-proxy: jupyterhub.proxy.ConfigurableHTTPProxy
525# - default: jupyterhub.proxy.ConfigurableHTTPProxy
526# Default: 'jupyterhub.proxy.ConfigurableHTTPProxy'
527# c.JupyterHub.proxy_class = 'jupyterhub.proxy.ConfigurableHTTPProxy'
528
529## DEPRECATED since version 0.8. Use ConfigurableHTTPProxy.command
530# Default: []
531# c.JupyterHub.proxy_cmd = []
532
533## Recreate all certificates used within JupyterHub on restart.
534#
535# Note: enabling this feature requires restarting all notebook servers.
536#
537# Use with internal_ssl
538# Default: False
539# c.JupyterHub.recreate_internal_certs = False
540
541## Redirect user to server (if running), instead of control panel.
542# Default: True
543# c.JupyterHub.redirect_to_server = True
544
545## Purge and reset the database.
546# Default: False
547# c.JupyterHub.reset_db = False
548
549## Interval (in seconds) at which to check connectivity of services with web
550# endpoints.
551# Default: 60
552# c.JupyterHub.service_check_interval = 60
553
554## Dict of token:servicename to be loaded into the database.
555#
556# Allows ahead-of-time generation of API tokens for use by externally managed
557# services.
558# Default: {}
559# c.JupyterHub.service_tokens = {}
560
561## List of service specification dictionaries.
562#
563# A service
564#
565# For instance::
566#
567# services = [
568# {
569# 'name': 'cull_idle',
570# 'command': ['/path/to/cull_idle_servers.py'],
571# },
572# {
573# 'name': 'formgrader',
574# 'url': 'http://127.0.0.1:1234',
575# 'api_token': 'super-secret',
576# 'environment':
577# }
578# ]
579# Default: []
580# c.JupyterHub.services = []
581
582## Instead of starting the Application, dump configuration to stdout
583# See also: Application.show_config
584# c.JupyterHub.show_config = False
585
586## Instead of starting the Application, dump configuration to stdout (as JSON)
587# See also: Application.show_config_json
588# c.JupyterHub.show_config_json = False
589
590## Shuts down all user servers on logout
591# Default: False
592# c.JupyterHub.shutdown_on_logout = False
593
594## The class to use for spawning single-user servers.
595#
596# Should be a subclass of :class:`jupyterhub.spawner.Spawner`.
597#
598# .. versionchanged:: 1.0
599# spawners may be registered via entry points,
600# e.g. `c.JupyterHub.spawner_class = 'localprocess'`
601#
602# Currently installed:
603# - default: jupyterhub.spawner.LocalProcessSpawner
604# - localprocess: jupyterhub.spawner.LocalProcessSpawner
605# - simple: jupyterhub.spawner.SimpleLocalProcessSpawner
606# Default: 'jupyterhub.spawner.LocalProcessSpawner'
607# c.JupyterHub.spawner_class = 'jupyterhub.spawner.LocalProcessSpawner'
608
609## Path to SSL certificate file for the public facing interface of the proxy
610#
611# When setting this, you should also set ssl_key
612# Default: ''
613# c.JupyterHub.ssl_cert = ''
614
615## Path to SSL key file for the public facing interface of the proxy
616#
617# When setting this, you should also set ssl_cert
618# Default: ''
619# c.JupyterHub.ssl_key = ''
620
621## Host to send statsd metrics to. An empty string (the default) disables sending
622# metrics.
623# Default: ''
624# c.JupyterHub.statsd_host = ''
625
626## Port on which to send statsd metrics about the hub
627# Default: 8125
628# c.JupyterHub.statsd_port = 8125
629
630## Prefix to use for all metrics sent by jupyterhub to statsd
631# Default: 'jupyterhub'
632# c.JupyterHub.statsd_prefix = 'jupyterhub'
633
634## Run single-user servers on subdomains of this host.
635#
636# This should be the full `https://hub.domain.tld[:port]`.
637#
638# Provides additional cross-site protections for javascript served by single-
639# user servers.
640#
641# Requires `<username>.hub.domain.tld` to resolve to the same host as
642# `hub.domain.tld`.
643#
644# In general, this is most easily achieved with wildcard DNS.
645#
646# When using SSL (i.e. always) this also requires a wildcard SSL certificate.
647# Default: ''
648# c.JupyterHub.subdomain_host = ''
649
650## Paths to search for jinja templates, before using the default templates.
651# Default: []
652c.JupyterHub.template_paths = ['/mofem_install/jupyter/templates']
653
654## Extra variables to be passed into jinja templates
655# Default: {}
656# c.JupyterHub.template_vars = {}
657
658## Extra settings overrides to pass to the tornado application.
659# Default: {}
660# c.JupyterHub.tornado_settings = {}
661
662## Trust user-provided tokens (via JupyterHub.service_tokens) to have good
663# entropy.
664#
665# If you are not inserting additional tokens via configuration file, this flag
666# has no effect.
667#
668# In JupyterHub 0.8, internally generated tokens do not pass through additional
669# hashing because the hashing is costly and does not increase the entropy of
670# already-good UUIDs.
671#
672# User-provided tokens, on the other hand, are not trusted to have good entropy
673# by default, and are passed through many rounds of hashing to stretch the
674# entropy of the key (i.e. user-provided tokens are treated as passwords instead
675# of random keys). These keys are more costly to check.
676#
677# If your inserted tokens are generated by a good-quality mechanism, e.g.
678# `openssl rand -hex 32`, then you can set this flag to True to reduce the cost
679# of checking authentication tokens.
680# Default: False
681# c.JupyterHub.trust_user_provided_tokens = False
682
683## Names to include in the subject alternative name.
684#
685# These names will be used for server name verification. This is useful if
686# JupyterHub is being run behind a reverse proxy or services using ssl are on
687# different hosts.
688#
689# Use with internal_ssl
690# Default: []
691# c.JupyterHub.trusted_alt_names = []
692
693## Downstream proxy IP addresses to trust.
694#
695# This sets the list of IP addresses that are trusted and skipped when
696# processing the `X-Forwarded-For` header. For example, if an external proxy is
697# used for TLS termination, its IP address should be added to this list to
698# ensure the correct client IP addresses are recorded in the logs instead of the
699# proxy server's IP address.
700# Default: []
701# c.JupyterHub.trusted_downstream_ips = []
702
703## Upgrade the database automatically on start.
704#
705# Only safe if database is regularly backed up. Only SQLite databases will be
706# backed up to a local file automatically.
707# Default: False
708# c.JupyterHub.upgrade_db = False
709
710## Callable to affect behavior of /user-redirect/
711#
712# Receives 4 parameters: 1. path - URL path that was provided after /user-
713# redirect/ 2. request - A Tornado HTTPServerRequest representing the current
714# request. 3. user - The currently authenticated user. 4. base_url - The
715# base_url of the current hub, for relative redirects
716#
717# It should return the new URL to redirect to, or None to preserve current
718# behavior.
719# Default: None
720# c.JupyterHub.user_redirect_hook = None
721
722#------------------------------------------------------------------------------
723# Spawner(LoggingConfigurable) configuration
724#------------------------------------------------------------------------------
725## Base class for spawning single-user notebook servers.
726#
727# Subclass this, and override the following methods:
728#
729# - load_state - get_state - start - stop - poll
730#
731# As JupyterHub supports multiple users, an instance of the Spawner subclass is
732# created for each user. If there are 20 JupyterHub users, there will be 20
733# instances of the subclass.
734
735## Extra arguments to be passed to the single-user server.
736#
737# Some spawners allow shell-style expansion here, allowing you to use
738# environment variables here. Most, including the default, do not. Consult the
739# documentation for your spawner to verify!
740# Default: []
741# c.Spawner.args = []
742
743## An optional hook function that you can implement to pass `auth_state` to the
744# spawner after it has been initialized but before it starts. The `auth_state`
745# dictionary may be set by the `.authenticate()` method of the authenticator.
746# This hook enables you to pass some or all of that information to your spawner.
747#
748# Example::
749#
750# def userdata_hook(spawner, auth_state):
751# spawner.userdata = auth_state["userdata"]
752#
753# c.Spawner.auth_state_hook = userdata_hook
754# Default: None
755# c.Spawner.auth_state_hook = None
756
757## The command used for starting the single-user server.
758#
759# Provide either a string or a list containing the path to the startup script
760# command. Extra arguments, other than this path, should be provided via `args`.
761#
762# This is usually set if you want to start the single-user server in a different
763# python environment (with virtualenv/conda) than JupyterHub itself.
764#
765# Some spawners allow shell-style expansion here, allowing you to use
766# environment variables. Most, including the default, do not. Consult the
767# documentation for your spawner to verify!
768# Default: ['jupyterhub-singleuser']
769# c.Spawner.cmd = ['jupyterhub-singleuser']
770
771## Maximum number of consecutive failures to allow before shutting down
772# JupyterHub.
773#
774# This helps JupyterHub recover from a certain class of problem preventing
775# launch in contexts where the Hub is automatically restarted (e.g. systemd,
776# docker, kubernetes).
777#
778# A limit of 0 means no limit and consecutive failures will not be tracked.
779# Default: 0
780# c.Spawner.consecutive_failure_limit = 0
781
782## Minimum number of cpu-cores a single-user notebook server is guaranteed to
783# have available.
784#
785# If this value is set to 0.5, allows use of 50% of one CPU. If this value is
786# set to 2, allows use of up to 2 CPUs.
787#
788# **This is a configuration setting. Your spawner must implement support for the
789# limit to work.** The default spawner, `LocalProcessSpawner`, does **not**
790# implement this support. A custom spawner **must** add support for this setting
791# for it to be enforced.
792# Default: None
793# c.Spawner.cpu_guarantee = None
794
795## Maximum number of cpu-cores a single-user notebook server is allowed to use.
796#
797# If this value is set to 0.5, allows use of 50% of one CPU. If this value is
798# set to 2, allows use of up to 2 CPUs.
799#
800# The single-user notebook server will never be scheduled by the kernel to use
801# more cpu-cores than this. There is no guarantee that it can access this many
802# cpu-cores.
803#
804# **This is a configuration setting. Your spawner must implement support for the
805# limit to work.** The default spawner, `LocalProcessSpawner`, does **not**
806# implement this support. A custom spawner **must** add support for this setting
807# for it to be enforced.
808# Default: None
809# c.Spawner.cpu_limit = None
810
811## Enable debug-logging of the single-user server
812# Default: False
813# c.Spawner.debug = False
814
815## The URL the single-user server should start in.
816#
817# `{username}` will be expanded to the user's username
818#
819# Example uses:
820#
821# - You can set `notebook_dir` to `/` and `default_url` to `/tree/home/{username}` to allow people to
822# navigate the whole filesystem from their notebook server, but still start in their home directory.
823# - Start with `/notebooks` instead of `/tree` if `default_url` points to a notebook instead of a directory.
824# - You can set this to `/lab` to have JupyterLab start by default, rather than Jupyter Notebook.
825# Default: ''
826# c.Spawner.default_url = ''
827
828## Disable per-user configuration of single-user servers.
829#
830# When starting the user's single-user server, any config file found in the
831# user's $HOME directory will be ignored.
832#
833# Note: a user could circumvent this if the user modifies their Python
834# environment, such as when they have their own conda environments / virtualenvs
835# / containers.
836# Default: False
837# c.Spawner.disable_user_config = False
838
839## List of environment variables for the single-user server to inherit from the
840# JupyterHub process.
841#
842# This list is used to ensure that sensitive information in the JupyterHub
843# process's environment (such as `CONFIGPROXY_AUTH_TOKEN`) is not passed to the
844# single-user server's process.
845# Default: ['PATH', 'PYTHONPATH', 'CONDA_ROOT', 'CONDA_DEFAULT_ENV', 'VIRTUAL_ENV', 'LANG', 'LC_ALL', 'JUPYTERHUB_SINGLEUSER_APP']
846c.Spawner.env_keep = ['LD_LIBRARY_PATH', 'PATH', 'PYTHONPATH', 'CONDA_ROOT', 'CONDA_DEFAULT_ENV', 'VIRTUAL_ENV', 'LANG', 'LC_ALL', 'JUPYTERHUB_SINGLEUSER_APP']
847
848## Extra environment variables to set for the single-user server's process.
849#
850# Environment variables that end up in the single-user server's process come from 3 sources:
851# - This `environment` configurable
852# - The JupyterHub process' environment variables that are listed in `env_keep`
853# - Variables to establish contact between the single-user notebook and the hub (such as JUPYTERHUB_API_TOKEN)
854#
855# The `environment` configurable should be set by JupyterHub administrators to
856# add installation specific environment variables. It is a dict where the key is
857# the name of the environment variable, and the value can be a string or a
858# callable. If it is a callable, it will be called with one parameter (the
859# spawner instance), and should return a string fairly quickly (no blocking
860# operations please!).
861#
862# Note that the spawner class' interface is not guaranteed to be exactly same
863# across upgrades, so if you are using the callable take care to verify it
864# continues to work after upgrades!
865#
866# .. versionchanged:: 1.2
867# environment from this configuration has highest priority,
868# allowing override of 'default' env variables,
869# such as JUPYTERHUB_API_URL.
870# Default: {}
871# c.Spawner.environment = {
872# 'DISPLAY' : '99.0',
873# 'JUPYTER_ENABLE_LAB' : 'yes',
874# 'PYVISTA_USE_IPYVTK' : 'true'
875# }
876
877## Timeout (in seconds) before giving up on a spawned HTTP server
878#
879# Once a server has successfully been spawned, this is the amount of time we
880# wait before assuming that the server is unable to accept connections.
881# Default: 30
882# c.Spawner.http_timeout = 30
883
884## The IP address (or hostname) the single-user server should listen on.
885#
886# The JupyterHub proxy implementation should be able to send packets to this
887# interface.
888# Default: ''
889# c.Spawner.ip = ''
890
891## Minimum number of bytes a single-user notebook server is guaranteed to have
892# available.
893#
894# Allows the following suffixes:
895# - K -> Kilobytes
896# - M -> Megabytes
897# - G -> Gigabytes
898# - T -> Terabytes
899#
900# **This is a configuration setting. Your spawner must implement support for the
901# limit to work.** The default spawner, `LocalProcessSpawner`, does **not**
902# implement this support. A custom spawner **must** add support for this setting
903# for it to be enforced.
904# Default: None
905# c.Spawner.mem_guarantee = None
906
907## Maximum number of bytes a single-user notebook server is allowed to use.
908#
909# Allows the following suffixes:
910# - K -> Kilobytes
911# - M -> Megabytes
912# - G -> Gigabytes
913# - T -> Terabytes
914#
915# If the single user server tries to allocate more memory than this, it will
916# fail. There is no guarantee that the single-user notebook server will be able
917# to allocate this much memory - only that it can not allocate more than this.
918#
919# **This is a configuration setting. Your spawner must implement support for the
920# limit to work.** The default spawner, `LocalProcessSpawner`, does **not**
921# implement this support. A custom spawner **must** add support for this setting
922# for it to be enforced.
923# Default: None
924# c.Spawner.mem_limit = None
925
926## Path to the notebook directory for the single-user server.
927#
928# The user sees a file listing of this directory when the notebook interface is
929# started. The current interface does not easily allow browsing beyond the
930# subdirectories in this directory's tree.
931#
932# `~` will be expanded to the home directory of the user, and {username} will be
933# replaced with the name of the user.
934#
935# Note that this does *not* prevent users from accessing files outside of this
936# path! They can do so with many other means.
937# Default: ''
938# c.Spawner.notebook_dir = ''
939
940## An HTML form for options a user can specify on launching their server.
941#
942# The surrounding `<form>` element and the submit button are already provided.
943#
944# For example:
945#
946# .. code:: html
947#
948# Set your key:
949# <input name="key" val="default_key"></input>
950# <br>
951# Choose a letter:
952# <select name="letter" multiple="true">
953# <option value="A">The letter A</option>
954# <option value="B">The letter B</option>
955# </select>
956#
957# The data from this form submission will be passed on to your spawner in
958# `self.user_options`
959#
960# Instead of a form snippet string, this could also be a callable that takes as
961# one parameter the current spawner instance and returns a string. The callable
962# will be called asynchronously if it returns a future, rather than a str. Note
963# that the interface of the spawner class is not deemed stable across versions,
964# so using this functionality might cause your JupyterHub upgrades to break.
965# Default: traitlets.Undefined
966# c.Spawner.options_form = traitlets.Undefined
967
968## Interpret HTTP form data
969#
970# Form data will always arrive as a dict of lists of strings. Override this
971# function to understand single-values, numbers, etc.
972#
973# This should coerce form data into the structure expected by self.user_options,
974# which must be a dict, and should be JSON-serializeable, though it can contain
975# bytes in addition to standard JSON data types.
976#
977# This method should not have any side effects. Any handling of `user_options`
978# should be done in `.start()` to ensure consistent behavior across servers
979# spawned via the API and form submission page.
980#
981# Instances will receive this data on self.user_options, after passing through
982# this function, prior to `Spawner.start`.
983#
984# .. versionchanged:: 1.0
985# user_options are persisted in the JupyterHub database to be reused
986# on subsequent spawns if no options are given.
987# user_options is serialized to JSON as part of this persistence
988# (with additional support for bytes in case of uploaded file data),
989# and any non-bytes non-jsonable values will be replaced with None
990# if the user_options are re-used.
991# Default: traitlets.Undefined
992# c.Spawner.options_from_form = traitlets.Undefined
993
994## Interval (in seconds) on which to poll the spawner for single-user server's
995# status.
996#
997# At every poll interval, each spawner's `.poll` method is called, which checks
998# if the single-user server is still running. If it isn't running, then
999# JupyterHub modifies its own state accordingly and removes appropriate routes
1000# from the configurable proxy.
1001# Default: 30
1002# c.Spawner.poll_interval = 30
1003
1004## The port for single-user servers to listen on.
1005#
1006# Defaults to `0`, which uses a randomly allocated port number each time.
1007#
1008# If set to a non-zero value, all Spawners will use the same port, which only
1009# makes sense if each server is on a different address, e.g. in containers.
1010#
1011# New in version 0.7.
1012# Default: 0
1013# c.Spawner.port = 0
1014
1015## An optional hook function that you can implement to do work after the spawner
1016# stops.
1017#
1018# This can be set independent of any concrete spawner implementation.
1019# Default: None
1020# c.Spawner.post_stop_hook = None
1021
1022## An optional hook function that you can implement to do some bootstrapping work
1023# before the spawner starts. For example, create a directory for your user or
1024# load initial content.
1025#
1026# This can be set independent of any concrete spawner implementation.
1027#
1028# This maybe a coroutine.
1029#
1030# Example::
1031#
1032# from subprocess import check_call
1033# def my_hook(spawner):
1034# username = spawner.user.name
1035# check_call(['./examples/bootstrap-script/bootstrap.sh', username])
1036#
1037# c.Spawner.pre_spawn_hook = my_hook
1038# Default: None
1039# c.Spawner.pre_spawn_hook = None
1040
1041## List of SSL alt names
1042#
1043# May be set in config if all spawners should have the same value(s), or set at
1044# runtime by Spawner that know their names.
1045# Default: []
1046# c.Spawner.ssl_alt_names = []
1047
1048## Whether to include DNS:localhost, IP:127.0.0.1 in alt names
1049# Default: True
1050# c.Spawner.ssl_alt_names_include_local = True
1051
1052## Timeout (in seconds) before giving up on starting of single-user server.
1053#
1054# This is the timeout for start to return, not the timeout for the server to
1055# respond. Callers of spawner.start will assume that startup has failed if it
1056# takes longer than this. start should return when the server process is started
1057# and its location is known.
1058# Default: 60
1059# c.Spawner.start_timeout = 60
1060
1061#------------------------------------------------------------------------------
1062# Authenticator(LoggingConfigurable) configuration
1063#------------------------------------------------------------------------------
1064## Base class for implementing an authentication provider for JupyterHub
1065
1066## Set of users that will have admin rights on this JupyterHub.
1067#
1068# Admin users have extra privileges:
1069# - Use the admin panel to see list of users logged in
1070# - Add / remove users in some authenticators
1071# - Restart / halt the hub
1072# - Start / stop users' single-user servers
1073# - Can access each individual users' single-user server (if configured)
1074#
1075# Admin access should be treated the same way root access is.
1076#
1077# Defaults to an empty set, in which case no user has admin access.
1078# Default: set()
1079# c.Authenticator.admin_users = set()
1080
1081## Set of usernames that are allowed to log in.
1082#
1083# Use this with supported authenticators to restrict which users can log in.
1084# This is an additional list that further restricts users, beyond whatever
1085# restrictions the authenticator has in place.
1086#
1087# If empty, does not perform any additional restriction.
1088#
1089# .. versionchanged:: 1.2
1090# `Authenticator.whitelist` renamed to `allowed_users`
1091# Default: set()
1092# c.Authenticator.allowed_users = set()
1093
1094## The max age (in seconds) of authentication info before forcing a refresh of
1095# user auth info.
1096#
1097# Refreshing auth info allows, e.g. requesting/re-validating auth tokens.
1098#
1099# See :meth:`.refresh_user` for what happens when user auth info is refreshed
1100# (nothing by default).
1101# Default: 300
1102# c.Authenticator.auth_refresh_age = 300
1103
1104## Automatically begin the login process
1105#
1106# rather than starting with a "Login with..." link at `/hub/login`
1107#
1108# To work, `.login_url()` must give a URL other than the default `/hub/login`,
1109# such as an oauth handler or another automatic login handler, registered with
1110# `.get_handlers()`.
1111#
1112# .. versionadded:: 0.8
1113# Default: False
1114# c.Authenticator.auto_login = False
1115
1116## Set of usernames that are not allowed to log in.
1117#
1118# Use this with supported authenticators to restrict which users can not log in.
1119# This is an additional block list that further restricts users, beyond whatever
1120# restrictions the authenticator has in place.
1121#
1122# If empty, does not perform any additional restriction.
1123#
1124# .. versionadded: 0.9
1125#
1126# .. versionchanged:: 1.2
1127# `Authenticator.blacklist` renamed to `blocked_users`
1128# Default: set()
1129# c.Authenticator.blocked_users = set()
1130
1131## Delete any users from the database that do not pass validation
1132#
1133# When JupyterHub starts, `.add_user` will be called on each user in the
1134# database to verify that all users are still valid.
1135#
1136# If `delete_invalid_users` is True, any users that do not pass validation will
1137# be deleted from the database. Use this if users might be deleted from an
1138# external system, such as local user accounts.
1139#
1140# If False (default), invalid users remain in the Hub's database and a warning
1141# will be issued. This is the default to avoid data loss due to config changes.
1142# Default: False
1143# c.Authenticator.delete_invalid_users = False
1144
1145## Enable persisting auth_state (if available).
1146#
1147# auth_state will be encrypted and stored in the Hub's database. This can
1148# include things like authentication tokens, etc. to be passed to Spawners as
1149# environment variables.
1150#
1151# Encrypting auth_state requires the cryptography package.
1152#
1153# Additionally, the JUPYTERHUB_CRYPT_KEY environment variable must contain one
1154# (or more, separated by ;) 32B encryption keys. These can be either base64 or
1155# hex-encoded.
1156#
1157# If encryption is unavailable, auth_state cannot be persisted.
1158#
1159# New in JupyterHub 0.8
1160# Default: False
1161# c.Authenticator.enable_auth_state = False
1162
1163## An optional hook function that you can implement to do some bootstrapping work
1164# during authentication. For example, loading user account details from an
1165# external system.
1166#
1167# This function is called after the user has passed all authentication checks
1168# and is ready to successfully authenticate. This function must return the
1169# authentication dict reguardless of changes to it.
1170#
1171# This maybe a coroutine.
1172#
1173# .. versionadded: 1.0
1174#
1175# Example::
1176#
1177# import os, pwd
1178# def my_hook(authenticator, handler, authentication):
1179# user_data = pwd.getpwnam(authentication['name'])
1180# spawn_data = {
1181# 'pw_data': user_data
1182# 'gid_list': os.getgrouplist(authentication['name'], user_data.pw_gid)
1183# }
1184#
1185# if authentication['auth_state'] is None:
1186# authentication['auth_state'] = {}
1187# authentication['auth_state']['spawn_data'] = spawn_data
1188#
1189# return authentication
1190#
1191# c.Authenticator.post_auth_hook = my_hook
1192# Default: None
1193# c.Authenticator.post_auth_hook = None
1194
1195## Force refresh of auth prior to spawn.
1196#
1197# This forces :meth:`.refresh_user` to be called prior to launching a server, to
1198# ensure that auth state is up-to-date.
1199#
1200# This can be important when e.g. auth tokens that may have expired are passed
1201# to the spawner via environment variables from auth_state.
1202#
1203# If refresh_user cannot refresh the user auth data, launch will fail until the
1204# user logs in again.
1205# Default: False
1206# c.Authenticator.refresh_pre_spawn = False
1207
1208## Dictionary mapping authenticator usernames to JupyterHub users.
1209#
1210# Primarily used to normalize OAuth user names to local users.
1211# Default: {}
1212# c.Authenticator.username_map = {}
1213
1214## Regular expression pattern that all valid usernames must match.
1215#
1216# If a username does not match the pattern specified here, authentication will
1217# not be attempted.
1218#
1219# If not set, allow any username.
1220# Default: ''
1221# c.Authenticator.username_pattern = ''
1222
1223## Deprecated, use `Authenticator.allowed_users`
1224# Default: set()
1225# c.Authenticator.whitelist = set()
1226
1227#------------------------------------------------------------------------------
1228# CryptKeeper(SingletonConfigurable) configuration
1229#------------------------------------------------------------------------------
1230## Encapsulate encryption configuration
1231#
1232# Use via the encryption_config singleton below.
1233
1234# Default: []
1235# c.CryptKeeper.keys = []
1236
1237## The number of threads to allocate for encryption
1238# Default: 4
1239# c.CryptKeeper.n_threads = 4
1240
1241#------------------------------------------------------------------------------
1242# Pagination(Configurable) configuration
1243#------------------------------------------------------------------------------
1244## Default number of entries per page for paginated results.
1245# Default: 100
1246# c.Pagination.default_per_page = 100
1247
1248## Maximum number of entries per page for paginated results.
1249# Default: 250
1250# c.Pagination.max_per_page = 250