1: 2021-07-11 (日) 23:32:45 iseki |
現: 2021-07-12 (月) 00:03:05 iseki |
- | # cat /usr/local/etc/jupyterhub/jupyterhub_config.py | sed -e "s/^/ /" |sed -e "s/^$/ /" | + | ***最新の実験用 jupyterhub_config.py [#he1cc9b7] |
| + | - 2021 07/12 |
| # Configuration file for jupyterhub. | | # Configuration file for jupyterhub. |
| + | |
| #------------------------------------------------------------------------------ | | #------------------------------------------------------------------------------ |
| # Application(SingletonConfigurable) configuration | | # Application(SingletonConfigurable) configuration |
| #------------------------------------------------------------------------------ | | #------------------------------------------------------------------------------ |
| + | |
| ## This is an application. | | ## This is an application. |
| + | |
| ## The date format used by logging formatters for %(asctime)s | | ## The date format used by logging formatters for %(asctime)s |
| #c.Application.log_datefmt = '%Y-%m-%d %H:%M:%S' | | #c.Application.log_datefmt = '%Y-%m-%d %H:%M:%S' |
| + | |
| ## The Logging format template | | ## The Logging format template |
| #c.Application.log_format = '[%(name)s]%(highlevel)s %(message)s' | | #c.Application.log_format = '[%(name)s]%(highlevel)s %(message)s' |
| + | |
| ## Set the log level by value or name. | | ## Set the log level by value or name. |
| #c.Application.log_level = 30 | | #c.Application.log_level = 30 |
| + | |
| #------------------------------------------------------------------------------ | | #------------------------------------------------------------------------------ |
| # JupyterHub(Application) configuration | | # JupyterHub(Application) configuration |
| #------------------------------------------------------------------------------ | | #------------------------------------------------------------------------------ |
| + | |
| ## An Application for starting a Multi-User Jupyter Notebook server. | | ## An Application for starting a Multi-User Jupyter Notebook server. |
| + | |
| ## Maximum number of concurrent servers that can be active at a time. | | ## Maximum number of concurrent servers that can be active at a time. |
| # | | # |
| # If set to 0, no limit is enforced. | | # If set to 0, no limit is enforced. |
| #c.JupyterHub.active_server_limit = 0 | | #c.JupyterHub.active_server_limit = 0 |
| + | |
| ## Duration (in seconds) to determine the number of active users. | | ## Duration (in seconds) to determine the number of active users. |
| #c.JupyterHub.active_user_window = 1800 | | #c.JupyterHub.active_user_window = 1800 |
| + | |
| ## Resolution (in seconds) for updating activity | | ## Resolution (in seconds) for updating activity |
| # | | # |
| # This avoids too many writes to the Hub database. | | # This avoids too many writes to the Hub database. |
| #c.JupyterHub.activity_resolution = 30 | | #c.JupyterHub.activity_resolution = 30 |
| + | |
| ## Grant admin users permission to access single-user servers. | | ## Grant admin users permission to access single-user servers. |
| # | | # |
| # Users should be properly informed if this is enabled. | | # Users should be properly informed if this is enabled. |
| #c.JupyterHub.admin_access = False | | #c.JupyterHub.admin_access = False |
| + | |
| ## DEPRECATED since version 0.7.2, use Authenticator.admin_users instead. | | ## DEPRECATED since version 0.7.2, use Authenticator.admin_users instead. |
| #c.JupyterHub.admin_users = set() | | #c.JupyterHub.admin_users = set() |
| + | |
| ## Allow named single-user servers per user | | ## Allow named single-user servers per user |
| #c.JupyterHub.allow_named_servers = False | | #c.JupyterHub.allow_named_servers = False |
| + | |
| ## Answer yes to any questions (e.g. confirm overwrite) | | ## Answer yes to any questions (e.g. confirm overwrite) |
| #c.JupyterHub.answer_yes = False | | #c.JupyterHub.answer_yes = False |
| + | |
| ## PENDING DEPRECATION: consider using services | | ## PENDING DEPRECATION: consider using services |
| # | | # |
| # Consider using services for general services that talk to the JupyterHub API. | | # Consider using services for general services that talk to the JupyterHub API. |
| #c.JupyterHub.api_tokens = {} | | #c.JupyterHub.api_tokens = {} |
| + | |
| ## Authentication for prometheus metrics | | ## Authentication for prometheus metrics |
| #c.JupyterHub.authenticate_prometheus = True | | #c.JupyterHub.authenticate_prometheus = True |
| + | |
| ## Class for authenticating users. | | ## Class for authenticating users. |
| # | | # |
| #c.JupyterHub.authenticator_class = 'jupyterhub.auth.PAMAuthenticator' | | #c.JupyterHub.authenticator_class = 'jupyterhub.auth.PAMAuthenticator' |
| #c.PAMAuthenticator.open_sessions = False | | #c.PAMAuthenticator.open_sessions = False |
| + | |
| # for LDAP | | # for LDAP |
| c.JupyterHub.authenticator_class = 'ldapauthenticator.LDAPAuthenticator' | | c.JupyterHub.authenticator_class = 'ldapauthenticator.LDAPAuthenticator' |
| c.LDAPAuthenticator.server_address = '202.26.144.11' | | c.LDAPAuthenticator.server_address = '202.26.144.11' |
| c.LDAPAuthenticator.use_ssl = True | | c.LDAPAuthenticator.use_ssl = True |
| + | |
| ## 大学の AD template 付き | | ## 大学の AD template 付き |
| c.LDAPAuthenticator.lookup_dn = False | | c.LDAPAuthenticator.lookup_dn = False |
| c.LDAPAuthenticator.user_search_base = 'dc=edutuis,dc=local' | | c.LDAPAuthenticator.user_search_base = 'dc=edutuis,dc=local' |
| c.LDAPAuthenticator.user_attribute = 'sAMAccountName' | | c.LDAPAuthenticator.user_attribute = 'sAMAccountName' |
| + | |
| ## 大学の AD template なし | | ## 大学の AD template なし |
| #c.LDAPAuthenticator.lookup_dn = True | | #c.LDAPAuthenticator.lookup_dn = True |
| #c.LDAPAuthenticator.lookup_dn_search_password = '*****' | | #c.LDAPAuthenticator.lookup_dn_search_password = '*****' |
| #c.LDAPAuthenticator.lookup_dn_user_dn_attribute = 'cn' | | #c.LDAPAuthenticator.lookup_dn_user_dn_attribute = 'cn' |
| + | |
| ## NSL: username から dn が探せる場合 | | ## NSL: username から dn が探せる場合 |
| #c.LDAPAuthenticator.lookup_dn = False | | #c.LDAPAuthenticator.lookup_dn = False |
| #c.LDAPAuthenticator.bind_dn_template = 'cn={username},ou=user,dc=nsl,dc=tuis,dc=ac,dc=jp' | | #c.LDAPAuthenticator.bind_dn_template = 'cn={username},ou=user,dc=nsl,dc=tuis,dc=ac,dc=jp' |
| + | |
| ## NSL: ツリーを検索する場合 | | ## NSL: ツリーを検索する場合 |
| #c.LDAPAuthenticator.lookup_dn = True | | #c.LDAPAuthenticator.lookup_dn = True |
| #c.LDAPAuthenticator.lookup_dn_search_password = '*******' | | #c.LDAPAuthenticator.lookup_dn_search_password = '*******' |
| #c.LDAPAuthenticator.lookup_dn_user_dn_attribute = 'cn' | | #c.LDAPAuthenticator.lookup_dn_user_dn_attribute = 'cn' |
| + | |
| ## The base URL of the entire application. | | ## The base URL of the entire application. |
| # | | # |
| # Use JupyterHub.bind_url | | # Use JupyterHub.bind_url |
| #c.JupyterHub.base_url = '/' | | #c.JupyterHub.base_url = '/' |
| + | |
| ## | | ## |
| # My IP Address | | # My IP Address |
| my_ip_addr = '172.22.1.75' | | my_ip_addr = '172.22.1.75' |
| + | |
| ## The public facing URL of the whole JupyterHub application. | | ## The public facing URL of the whole JupyterHub application. |
| # | | # |
| # This is the address on which the proxy will bind. Sets protocol, ip, base_url | | # This is the address on which the proxy will bind. Sets protocol, ip, base_url |
| c.JupyterHub.bind_url = 'http://'+my_ip_addr+':8000' | | c.JupyterHub.bind_url = 'http://'+my_ip_addr+':8000' |
| + | |
| ## Whether to shutdown the proxy when the Hub shuts down. | | ## Whether to shutdown the proxy when the Hub shuts down. |
| # | | # |
| # The Hub should be able to resume from database state. | | # The Hub should be able to resume from database state. |
| #c.JupyterHub.cleanup_proxy = True | | #c.JupyterHub.cleanup_proxy = True |
| + | |
| ## Whether to shutdown single-user servers when the Hub shuts down. | | ## Whether to shutdown single-user servers when the Hub shuts down. |
| # | | # |
| # The Hub should be able to resume from database state. | | # The Hub should be able to resume from database state. |
| #c.JupyterHub.cleanup_servers = True | | #c.JupyterHub.cleanup_servers = True |
| + | |
| ## Maximum number of concurrent users that can be spawning at a time. | | ## Maximum number of concurrent users that can be spawning at a time. |
| # | | # |
| # If set to 0, no limit is enforced. | | # If set to 0, no limit is enforced. |
| #c.JupyterHub.concurrent_spawn_limit = 100 | | #c.JupyterHub.concurrent_spawn_limit = 100 |
| + | |
| ## The config file to load | | ## The config file to load |
| #c.JupyterHub.config_file = 'jupyterhub_config.py' | | #c.JupyterHub.config_file = 'jupyterhub_config.py' |
| ## DEPRECATED: does nothing | | ## DEPRECATED: does nothing |
| #c.JupyterHub.confirm_no_ssl = False | | #c.JupyterHub.confirm_no_ssl = False |
| + | |
| ## Number of days for a login cookie to be valid. Default is two weeks. | | ## Number of days for a login cookie to be valid. Default is two weeks. |
| #c.JupyterHub.cookie_max_age_days = 14 | | #c.JupyterHub.cookie_max_age_days = 14 |
| + | |
| ## The cookie secret to use to encrypt cookies. | | ## The cookie secret to use to encrypt cookies. |
| # | | # |
| # Should be exactly 256 bits (32 bytes). | | # Should be exactly 256 bits (32 bytes). |
| #c.JupyterHub.cookie_secret = b'' | | #c.JupyterHub.cookie_secret = b'' |
| + | |
| ## File in which to store the cookie secret. | | ## File in which to store the cookie secret. |
| #c.JupyterHub.cookie_secret_file = 'jupyterhub_cookie_secret' | | #c.JupyterHub.cookie_secret_file = 'jupyterhub_cookie_secret' |
| + | |
| ## The location of jupyterhub data files (e.g. /usr/local/share/jupyterhub) | | ## The location of jupyterhub data files (e.g. /usr/local/share/jupyterhub) |
| #c.JupyterHub.data_files_path = '/usr/local/anaconda/envs/jupyterhub38/share/jupyterhub' | | #c.JupyterHub.data_files_path = '/usr/local/anaconda/envs/jupyterhub38/share/jupyterhub' |
| + | |
| ## Include any kwargs to pass to the database connection. See | | ## Include any kwargs to pass to the database connection. See |
| # sqlalchemy.create_engine for details. | | # sqlalchemy.create_engine for details. |
| #c.JupyterHub.db_kwargs = {} | | #c.JupyterHub.db_kwargs = {} |
| + | |
| ## url for the database. e.g. `sqlite:///jupyterhub.sqlite` | | ## url for the database. e.g. `sqlite:///jupyterhub.sqlite` |
| c.JupyterHub.db_url = 'sqlite:////var/lib/jupyterhub/jupyterhub.sqlite' | | c.JupyterHub.db_url = 'sqlite:////var/lib/jupyterhub/jupyterhub.sqlite' |
| + | |
| ## log all database transactions. This has A LOT of output | | ## log all database transactions. This has A LOT of output |
| #c.JupyterHub.debug_db = False | | #c.JupyterHub.debug_db = False |
| + | |
| ## DEPRECATED since version 0.8: Use ConfigurableHTTPProxy.debug | | ## DEPRECATED since version 0.8: Use ConfigurableHTTPProxy.debug |
| #c.JupyterHub.debug_proxy = False | | #c.JupyterHub.debug_proxy = False |
| + | |
| ## If named servers are enabled, default name of server to spawn or open, e.g. by | | ## If named servers are enabled, default name of server to spawn or open, e.g. by |
| # user-redirect. | | # user-redirect. |
| #c.JupyterHub.default_server_name = '' | | #c.JupyterHub.default_server_name = '' |
| + | |
| ## The default URL for users when they arrive (e.g. when user directs to "/") | | ## The default URL for users when they arrive (e.g. when user directs to "/") |
| # | | # |
| # By default, redirects users to their own server. | | # By default, redirects users to their own server. |
| #c.JupyterHub.default_url = '' | | #c.JupyterHub.default_url = '' |
| + | |
| ## Dict authority:dict(files). Specify the key, cert, and/or ca file for an | | ## Dict authority:dict(files). Specify the key, cert, and/or ca file for an |
| # authority. This is useful for externally managed proxies that wish to use | | # authority. This is useful for externally managed proxies that wish to use |
| # Use with internal_ssl | | # Use with internal_ssl |
| #c.JupyterHub.external_ssl_authorities = {} | | #c.JupyterHub.external_ssl_authorities = {} |
| + | |
| ## Register extra tornado Handlers for jupyterhub. | | ## Register extra tornado Handlers for jupyterhub. |
| # | | # |
| # The Hub prefix will be added, so `/my-page` will be served at `/hub/my-page`. | | # The Hub prefix will be added, so `/my-page` will be served at `/hub/my-page`. |
| #c.JupyterHub.extra_handlers = [] | | #c.JupyterHub.extra_handlers = [] |
| + | |
| ## DEPRECATED: use output redirection instead, e.g. | | ## DEPRECATED: use output redirection instead, e.g. |
| # | | # |
| # jupyterhub &>> /var/log/jupyterhub.log | | # jupyterhub &>> /var/log/jupyterhub.log |
| #c.JupyterHub.extra_log_file = '' | | #c.JupyterHub.extra_log_file = '' |
| + | |
| ## Extra log handlers to set on JupyterHub logger | | ## Extra log handlers to set on JupyterHub logger |
| #c.JupyterHub.extra_log_handlers = [] | | #c.JupyterHub.extra_log_handlers = [] |
| + | |
| ## Generate certs used for internal ssl | | ## Generate certs used for internal ssl |
| #c.JupyterHub.generate_certs = False | | #c.JupyterHub.generate_certs = False |
| + | |
| ## Generate default config file | | ## Generate default config file |
| #c.JupyterHub.generate_config = False | | #c.JupyterHub.generate_config = False |
| + | |
| ## The URL on which the Hub will listen. This is a private URL for internal | | ## The URL on which the Hub will listen. This is a private URL for internal |
| # communication. Typically set in combination with hub_connect_url. If a unix | | # communication. Typically set in combination with hub_connect_url. If a unix |
| # .. versionadded:: 0.9 | | # .. versionadded:: 0.9 |
| c.JupyterHub.hub_bind_url = 'http://'+my_ip_addr+':8081' | | c.JupyterHub.hub_bind_url = 'http://'+my_ip_addr+':8081' |
| + | |
| ## The ip or hostname for proxies and spawners to use for connecting to the Hub. | | ## The ip or hostname for proxies and spawners to use for connecting to the Hub. |
| # | | # |
| # .. versionadded:: 0.8 | | # .. versionadded:: 0.8 |
| c.JupyterHub.hub_connect_ip = my_ip_addr | | c.JupyterHub.hub_connect_ip = my_ip_addr |
| + | |
| ## DEPRECATED | | ## DEPRECATED |
| # | | # |
| # Use hub_connect_url | | # Use hub_connect_url |
| #c.JupyterHub.hub_connect_port = 0 | | #c.JupyterHub.hub_connect_port = 0 |
| + | |
| ## The URL for connecting to the Hub. Spawners, services, and the proxy will use | | ## The URL for connecting to the Hub. Spawners, services, and the proxy will use |
| # this URL to talk to the Hub. | | # this URL to talk to the Hub. |
| # .. versionadded:: 0.9 | | # .. versionadded:: 0.9 |
| #c.JupyterHub.hub_connect_url = '' | | #c.JupyterHub.hub_connect_url = '' |
| + | |
| ## The ip address for the Hub process to *bind* to. | | ## The ip address for the Hub process to *bind* to. |
| # | | # |
| #c.JupyterHub.hub_ip = '127.0.0.1' | | #c.JupyterHub.hub_ip = '127.0.0.1' |
| c.JupyterHub.hub_ip = '0.0.0.0' | | c.JupyterHub.hub_ip = '0.0.0.0' |
| + | |
| ## The internal port for the Hub process. | | ## The internal port for the Hub process. |
| # | | # |
| # See also `hub_ip` for the ip and `hub_bind_url` for setting the full bind URL. | | # See also `hub_ip` for the ip and `hub_bind_url` for setting the full bind URL. |
| c.JupyterHub.hub_port = 8081 | | c.JupyterHub.hub_port = 8081 |
| + | |
| ## Timeout (in seconds) to wait for spawners to initialize | | ## Timeout (in seconds) to wait for spawners to initialize |
| # | | # |
| # .. versionadded: 1.1.0 | | # .. versionadded: 1.1.0 |
| #c.JupyterHub.init_spawners_timeout = 10 | | #c.JupyterHub.init_spawners_timeout = 10 |
| + | |
| ## The location to store certificates automatically created by JupyterHub. | | ## The location to store certificates automatically created by JupyterHub. |
| # | | # |
| # Use with internal_ssl | | # Use with internal_ssl |
| #c.JupyterHub.internal_certs_location = 'internal-ssl' | | #c.JupyterHub.internal_certs_location = 'internal-ssl' |
| + | |
| ## Enable SSL for all internal communication | | ## Enable SSL for all internal communication |
| # | | # |
| # sign notebook certificates as they're created. | | # sign notebook certificates as they're created. |
| #c.JupyterHub.internal_ssl = False | | #c.JupyterHub.internal_ssl = False |
| + | |
| ## The public facing ip of the whole JupyterHub application (specifically | | ## The public facing ip of the whole JupyterHub application (specifically |
| # referred to as the proxy). | | # referred to as the proxy). |
| # Use JupyterHub.bind_url | | # Use JupyterHub.bind_url |
| #c.JupyterHub.ip = my_ip_addr | | #c.JupyterHub.ip = my_ip_addr |
| + | |
| ## Supply extra arguments that will be passed to Jinja environment. | | ## Supply extra arguments that will be passed to Jinja environment. |
| #c.JupyterHub.jinja_environment_options = {} | | #c.JupyterHub.jinja_environment_options = {} |
| + | |
| ## Interval (in seconds) at which to update last-activity timestamps. | | ## Interval (in seconds) at which to update last-activity timestamps. |
| #c.JupyterHub.last_activity_interval = 300 | | #c.JupyterHub.last_activity_interval = 300 |
| + | |
| ## Dict of 'group': ['usernames'] to load at startup. | | ## Dict of 'group': ['usernames'] to load at startup. |
| # | | # |
| # through the API. | | # through the API. |
| #c.JupyterHub.load_groups = {} | | #c.JupyterHub.load_groups = {} |
| + | |
| ## Specify path to a logo image to override the Jupyter logo in the banner. | | ## Specify path to a logo image to override the Jupyter logo in the banner. |
| #c.JupyterHub.logo_file = '' | | #c.JupyterHub.logo_file = '' |
| + | |
| ## Maximum number of concurrent named servers that can be created by a user at a | | ## Maximum number of concurrent named servers that can be created by a user at a |
| # time. | | # time. |
| # If set to 0, no limit is enforced. | | # If set to 0, no limit is enforced. |
| #c.JupyterHub.named_server_limit_per_user = 0 | | #c.JupyterHub.named_server_limit_per_user = 0 |
| + | |
| ## File to write PID Useful for daemonizing JupyterHub. | | ## File to write PID Useful for daemonizing JupyterHub. |
| c.JupyterHub.pid_file = '/var/run/jupyterhub.pid' | | c.JupyterHub.pid_file = '/var/run/jupyterhub.pid' |
| + | |
| ## The public facing port of the proxy. | | ## The public facing port of the proxy. |
| # | | # |
| # Use JupyterHub.bind_url | | # Use JupyterHub.bind_url |
| #c.JupyterHub.port = 8000 | | #c.JupyterHub.port = 8000 |
| + | |
| ## DEPRECATED since version 0.8 : Use ConfigurableHTTPProxy.api_url | | ## DEPRECATED since version 0.8 : Use ConfigurableHTTPProxy.api_url |
| #c.JupyterHub.proxy_api_ip = '' | | #c.JupyterHub.proxy_api_ip = '' |
| + | |
| ## DEPRECATED since version 0.8 : Use ConfigurableHTTPProxy.api_url | | ## DEPRECATED since version 0.8 : Use ConfigurableHTTPProxy.api_url |
| #c.JupyterHub.proxy_api_port = 0 | | #c.JupyterHub.proxy_api_port = 0 |
| + | |
| ## DEPRECATED since version 0.8: Use ConfigurableHTTPProxy.auth_token | | ## DEPRECATED since version 0.8: Use ConfigurableHTTPProxy.auth_token |
| #c.JupyterHub.proxy_auth_token = '' | | #c.JupyterHub.proxy_auth_token = '' |
| + | |
| ## Interval (in seconds) at which to check if the proxy is running. | | ## Interval (in seconds) at which to check if the proxy is running. |
| #c.JupyterHub.proxy_check_interval = 30 | | #c.JupyterHub.proxy_check_interval = 30 |
| + | |
| ## The class to use for configuring the JupyterHub proxy. | | ## The class to use for configuring the JupyterHub proxy. |
| # | | # |
| # - default: jupyterhub.proxy.ConfigurableHTTPProxy | | # - default: jupyterhub.proxy.ConfigurableHTTPProxy |
| #c.JupyterHub.proxy_class = 'jupyterhub.proxy.ConfigurableHTTPProxy' | | #c.JupyterHub.proxy_class = 'jupyterhub.proxy.ConfigurableHTTPProxy' |
| + | |
| ## DEPRECATED since version 0.8. Use ConfigurableHTTPProxy.command | | ## DEPRECATED since version 0.8. Use ConfigurableHTTPProxy.command |
| #c.JupyterHub.proxy_cmd = [] | | #c.JupyterHub.proxy_cmd = [] |
| + | |
| ## Recreate all certificates used within JupyterHub on restart. | | ## Recreate all certificates used within JupyterHub on restart. |
| # | | # |
| # Use with internal_ssl | | # Use with internal_ssl |
| #c.JupyterHub.recreate_internal_certs = False | | #c.JupyterHub.recreate_internal_certs = False |
| + | |
| ## Redirect user to server (if running), instead of control panel. | | ## Redirect user to server (if running), instead of control panel. |
| #c.JupyterHub.redirect_to_server = True | | #c.JupyterHub.redirect_to_server = True |
| + | |
| ## Purge and reset the database. | | ## Purge and reset the database. |
| #c.JupyterHub.reset_db = False | | #c.JupyterHub.reset_db = False |
| + | |
| # from https://gist.github.com/marufeuille/596cf6f9e26fa6fcb7e304d5b163c7c8 | | # from https://gist.github.com/marufeuille/596cf6f9e26fa6fcb7e304d5b163c7c8 |
| from dockerspawner import SystemUserSpawner | | from dockerspawner import SystemUserSpawner |
| from traitlets import Unicode | | from traitlets import Unicode |
| import pwd, os, grp | | import pwd, os, grp |
| + | |
| class ProjectDockerSpawner(SystemUserSpawner): | | class ProjectDockerSpawner(SystemUserSpawner): |
| + | |
| dobleArguments = False | | dobleArguments = False |
| #dobleArguments = True | | #dobleArguments = True |
- | | + | |
| + | |
| host_homedir_format_string = Unicode( | | host_homedir_format_string = Unicode( |
| "/home/{groupname}/{username}", | | "/home/{groupname}/{username}", |
| config = True, | | config = True, |
| ) | | ) |
| + | |
| image_homedir_format_string = Unicode( | | image_homedir_format_string = Unicode( |
| "/home/{groupname}/{username}", | | "/home/{groupname}/{username}", |
| config = True, | | config = True, |
| ) | | ) |
- | | + | |
| + | |
| @property | | @property |
| def host_homedir(self): | | def host_homedir(self): |
| else: | | else: |
| import pwd | | import pwd |
| + | |
| homedir = pwd.getpwnam(self.user.name).pw_dir | | homedir = pwd.getpwnam(self.user.name).pw_dir |
| return homedir | | return homedir |
- | | + | |
| + | |
| @property | | @property |
| def homedir(self): | | def homedir(self): |