diff --git a/jupyterhub_config.py b/jupyterhub_config.py index 10fba88..93735cc 100644 --- a/jupyterhub_config.py +++ b/jupyterhub_config.py @@ -37,6 +37,7 @@ c.DockerSpawner.remove = True # For debugging arguments passed to spawned containers c.DockerSpawner.debug = True +# c.Application.log_level = 'DEBUG' # User containers will access hub by container name on the Docker network c.JupyterHub.hub_ip = 'jupyterhub' @@ -57,6 +58,22 @@ admin = os.environ.get("JUPYTERHUB_ADMIN") if admin: c.Authenticator.admin_users = [admin] +# c.DockerSpawner.extra_create_kwargs.update({ +# "environment": {"JUPYTER_ENABLE_LAB": "yes"} +# }) + +c.DockerSpawner.extra_create_kwargs.update({ + "environment": {"NOTEBOOK_ARGS": "--NotebookApp.allow_origin='*'"} +}) + + +# 要支持正则匹配的域名请求,可以通过设置 allow_origin_pat 参数来实现。这个参数允许你使用正则表达式来匹配允许跨域请求的域名。例如,如果你想允许所有以 .example.com 结尾的域名进行跨域请求,可以在 jupyterhub_config.py 文件中添加如下配置: + +# c.Spawner.environment = { +# 'JUPYTERHUB_CORS': '{"allow_origin_pat": "https?://.*\\.example\\.com"}' +# } + + # GPU 和网络配置 c.DockerSpawner.extra_host_config = { 'runtime': 'nvidia' @@ -65,3 +82,4 @@ c.DockerSpawner.environment = { 'NVIDIA_DRIVER_CAPABILITIES': 'compute,utility', 'NVIDIA_VISIBLE_DEVICES': 'all' } +