Files
docker-jupyterhub/jupyterhub_config.py
2023-12-26 00:00:07 +08:00

61 lines
2.3 KiB
Python

import os
from pathlib import Path
c = get_config()
c.JupyterHub.cookie_secret_file = os.path.expanduser('~/.jupyterhub/jupyterhub_cookie_secret')
db_file = os.path.expanduser('~/.jupyterhub/jupyterhub.sqlite')
c.JupyterHub.db_url = 'sqlite:///{}'.format(db_file)
c.ConfigurableHTTPProxy.pid_file = os.path.expanduser('~/.jupyterhub/jupyterhub-proxy.pid')
c.JupyterHub.authenticator_class = 'jupyterhub.auth.PAMAuthenticator'
c.JupyterHub.ip = '0.0.0.0'
c.JupyterHub.port = 9000
c.JupyterHub.page_title = 'JupyterHub Service'
c.Spawner.ip = '127.0.0.1'
c.Spawner.cmd = ['jupyter-labhub']
# dockerspawner config
#c.JupyterHub.spawner_class=DockerSpawner
# pick a default image to use when none is specified
#c.DockerSpawner.image = "jupyter/base-notebook"
#c.JupyterHub.authenticator_class = "dummy"
# we need the hub to listen on all ips when it is in a container
#c.JupyterHub.hub_ip = '0.0.0.0'
# delete containers when they stop
#c.DockerSpawner.remove = True
# this is usually the hub container's name
# c.JupyterHub.hub_connect_ip = 'jupyterhub'
# tell the user containers to connect to our docker network
# c.DockerSpawner.network_name = 'jupyterhub'
# 设置 Docker 守护进程的地址和端口
# os.environ['DOCKER_HOST'] = 'tcp://192.168.101.50:2376'
# 如果使用 TLS
#os.environ['DOCKER_TLS_VERIFY'] = '1'
#os.environ['DOCKER_CERT_PATH'] = '/path/to/certificates'
#c.DockerSpawner.docker_host = 'tcp://192.168.101.50:2376'
#c.DockerSpawner.remove = True
#c.DockerSpawner.image = 'quay.io/jupyter/scipy-notebook:2023-10-23'
c.Spawner.default_url = '/lab'
c.PAMAuthenticator.encoding = 'utf8'
c.Authenticator.allowed_users = set()
c.LocalAuthenticator.create_system_users = True
c.LocalProcessSpawner.shell_cmd = ["bash", "-l", "-c"]
c.Authenticator.admin_users = set()
c.Spawner.args = ['--allow-root', "--KernelSpecManager.ensure_native_kernel=False", '--NotebookApp.allow_origin_pat=https://.*vscode-cdn\\.net', '--NotebookApp.iopub_data_rate_limit=10000000'] # 增加nglview、vscode的jupyterhub的插件的支持
c.JupyterHub.statsd_prefix = 'jupyterhub'
c.Spawner.notebook_dir = '~'
c.JupyterHub.shutdown_on_logout = False
c.PAMAuthenticator.open_sessions = False
c.Spawner.env_keep.append('ENV1')
c.Spawner.env_keep.append('ENV2')
c.Spawner.env_keep.append('LD_LIBRARY_PATH')
c.Spawner.env_keep.append('PATH')