jupyterhub config hash
This commit is contained in:
parent
37f78caac4
commit
88ba451f37
@ -13,8 +13,9 @@ c = get_config()
|
|||||||
# Spawn single-user servers as Docker containers
|
# Spawn single-user servers as Docker containers
|
||||||
c.JupyterHub.spawner_class = 'dockerspawner.DockerSpawner'
|
c.JupyterHub.spawner_class = 'dockerspawner.DockerSpawner'
|
||||||
# Spawn containers from this image
|
# Spawn containers from this image
|
||||||
# c.DockerSpawner.container_image = os.environ['DOCKER_NOTEBOOK_IMAGE']
|
c.DockerSpawner.container_image = os.environ['DOCKER_NOTEBOOK_IMAGE']
|
||||||
c.DockerSpawner.container_image = "jupyter/scipy-notebook"
|
# c.DockerSpawner.container_image = "jupyter/scipy-notebook"
|
||||||
|
|
||||||
# JupyterHub requires a single-user instance of the Notebook server, so we
|
# JupyterHub requires a single-user instance of the Notebook server, so we
|
||||||
# default to using the `start-singleuser.sh` script included in the
|
# default to using the `start-singleuser.sh` script included in the
|
||||||
# jupyter/docker-stacks *-notebook images as the Docker run command when
|
# jupyter/docker-stacks *-notebook images as the Docker run command when
|
||||||
@ -22,12 +23,17 @@ c.DockerSpawner.container_image = "jupyter/scipy-notebook"
|
|||||||
# using the DOCKER_SPAWN_CMD environment variable.
|
# using the DOCKER_SPAWN_CMD environment variable.
|
||||||
spawn_cmd = os.environ.get('DOCKER_SPAWN_CMD', "start-singleuser.sh")
|
spawn_cmd = os.environ.get('DOCKER_SPAWN_CMD', "start-singleuser.sh")
|
||||||
c.DockerSpawner.extra_create_kwargs.update({ 'command': spawn_cmd })
|
c.DockerSpawner.extra_create_kwargs.update({ 'command': spawn_cmd })
|
||||||
|
|
||||||
|
# Memory limit
|
||||||
|
c.Spawner.mem_limit = '1G'
|
||||||
|
|
||||||
# Connect containers to this Docker network
|
# Connect containers to this Docker network
|
||||||
network_name = os.environ['DOCKER_NETWORK_NAME']
|
network_name = os.environ['DOCKER_NETWORK_NAME']
|
||||||
c.DockerSpawner.use_internal_ip = True
|
c.DockerSpawner.use_internal_ip = True
|
||||||
c.DockerSpawner.network_name = network_name
|
c.DockerSpawner.network_name = network_name
|
||||||
# Pass the network name as argument to spawned containers
|
# Pass the network name as argument to spawned containers
|
||||||
c.DockerSpawner.extra_host_config = { 'network_mode': network_name }
|
c.DockerSpawner.extra_host_config = { 'network_mode': network_name }
|
||||||
|
|
||||||
# Explicitly set notebook directory because we'll be mounting a host volume to
|
# Explicitly set notebook directory because we'll be mounting a host volume to
|
||||||
# it. Most jupyter/docker-stacks *-notebook images run the Notebook server as
|
# it. Most jupyter/docker-stacks *-notebook images run the Notebook server as
|
||||||
# user `jovyan`, and set the notebook directory to `/home/jovyan/work`.
|
# user `jovyan`, and set the notebook directory to `/home/jovyan/work`.
|
||||||
@ -38,8 +44,8 @@ c.DockerSpawner.notebook_dir = notebook_dir
|
|||||||
# notebook directory in the container
|
# notebook directory in the container
|
||||||
|
|
||||||
# c.DockerSpawner.volumes = { 'jupyterhub-user-{username}': notebook_dir }
|
# c.DockerSpawner.volumes = { 'jupyterhub-user-{username}': notebook_dir }
|
||||||
c.DockerSpawner.volumes = { 'jupyterhub-user-{username}': notebook_dir,
|
c.DockerSpawner.volumes = { 'power-user-{username}': notebook_dir,
|
||||||
'/home/michael/repos/':'/home/jovyan/work/shared/' }
|
'/home/michael/repos/':'/home/shared/' }
|
||||||
|
|
||||||
# volume_driver is no longer a keyword argument to create_container()
|
# volume_driver is no longer a keyword argument to create_container()
|
||||||
# c.DockerSpawner.extra_create_kwargs.update({ 'volume_driver': 'local' })
|
# c.DockerSpawner.extra_create_kwargs.update({ 'volume_driver': 'local' })
|
||||||
@ -57,10 +63,23 @@ c.JupyterHub.hub_ip = 'jupyterhub'
|
|||||||
#c.JupyterHub.ssl_key = os.environ['SSL_KEY']
|
#c.JupyterHub.ssl_key = os.environ['SSL_KEY']
|
||||||
#c.JupyterHub.ssl_cert = os.environ['SSL_CERT']
|
#c.JupyterHub.ssl_cert = os.environ['SSL_CERT']
|
||||||
|
|
||||||
|
### Authentication
|
||||||
# Authenticate users with GitHub OAuth
|
# Authenticate users with GitHub OAuth
|
||||||
c.JupyterHub.authenticator_class = 'oauthenticator.GitHubOAuthenticator'
|
# c.JupyterHub.authenticator_class = 'oauthenticator.GitHubOAuthenticator'
|
||||||
c.GitHubOAuthenticator.oauth_callback_url = os.environ['OAUTH_CALLBACK_URL']
|
# c.GitHubOAuthenticator.oauth_callback_url = os.environ['OAUTH_CALLBACK_URL']
|
||||||
|
|
||||||
|
# Authenticate with thedataincubator/jupyterhub-hashauthenticator
|
||||||
|
c.JupyterHub.authenticator_class = 'hashauthenticator.HashAuthenticator'
|
||||||
|
# You can generate a good "secret key" by running `openssl rand -hex 32` in terminal.
|
||||||
|
# it is recommended to do this from time-to-time to change passwords (including changing their length)
|
||||||
|
c.HashAuthenticator.secret_key = '20a507952405b2e398542c721ce4954c1514ac079c0373e70a517595a43a9013' # Defaults to ''
|
||||||
|
c.HashAuthenticator.password_length = 5 # Defaults to 6
|
||||||
|
# If the `show_logins` option is set to `True`, a CSV file containing
|
||||||
|
#login names and passwords will be served (to admins only) at `/hub/login_list`.
|
||||||
|
c.HashAuthenticator.show_logins = True # Optional, defaults to False
|
||||||
|
|
||||||
|
|
||||||
|
### Database Interaction - cookies, db for jupyterhub
|
||||||
# Persist hub data on volume mounted inside container
|
# Persist hub data on volume mounted inside container
|
||||||
data_dir = os.environ.get('DATA_VOLUME_CONTAINER', '/data')
|
data_dir = os.environ.get('DATA_VOLUME_CONTAINER', '/data')
|
||||||
|
|
||||||
@ -89,3 +108,12 @@ with open(os.path.join(pwd, 'userlist')) as f:
|
|||||||
whitelist.add(name)
|
whitelist.add(name)
|
||||||
if len(parts) > 1 and parts[1] == 'admin':
|
if len(parts) > 1 and parts[1] == 'admin':
|
||||||
admin.add(name)
|
admin.add(name)
|
||||||
|
|
||||||
|
# Run script to automatically stop idle single-user servers as a jupyterhub service.
|
||||||
|
c.JupyterHub.services = [
|
||||||
|
{
|
||||||
|
'name': 'cull_idle',
|
||||||
|
'admin': True,
|
||||||
|
'command': 'python /srv/jupyterhub/cull_idle_servers.py --timeout=3600'.split(),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user