diff --git a/docker-compose.yml b/docker-compose.yml index 47bfeab..241b6df 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,6 +35,7 @@ services: # Bind Docker volume on host for JupyterHub database and cookie secrets - "data:${DATA_VOLUME_CONTAINER}" - "./jupyterhub_config.py:/srv/jupyterhub/jupyterhub_config.py" + - "/home/math/:/home/" ports: - "8000:8000" links: diff --git a/jupyterhub_config.py b/jupyterhub_config.py index 8167f45..7c9cf68 100755 --- a/jupyterhub_config.py +++ b/jupyterhub_config.py @@ -3,19 +3,24 @@ # Configuration file for JupyterHub import os +from subprocess import check_call c = get_config() +# Spawner dropdown menu? +enable_options=True # We rely on environment variables to configure JupyterHub so that we # avoid having to rebuild the JupyterHub container every time we change a # configuration parameter. # Spawn single-user servers as Docker containers -c.JupyterHub.spawner_class = 'dockerspawner.DockerSpawner' +c.JupyterHub.spawner_class = spawner = 'dockerspawner.DockerSpawner' + +# define some task to do on startup + # Spawn containers from this image (or a whitelist) -#c.DockerSpawner.container_image = "jupyter/datascience-notebook:7254cdcfa22b" -c.DockerSpawner.container_image = os.environ['DOCKER_NOTEBOOK_IMAGE'] -enable_options=False +#c.DockerSpawner.image = "jupyter/datascience-notebook:7254cdcfa22b" +c.DockerSpawner.image = os.environ['DOCKER_NOTEBOOK_IMAGE'] if enable_options: # if whitelist enabled, the .container_image will be ignored in favor of the options below: c.DockerSpawner.image_whitelist = {'fenics': "jupyterhub-user", @@ -34,7 +39,7 @@ spawn_cmd = os.environ.get('DOCKER_SPAWN_CMD', "start-singleuser.sh") c.DockerSpawner.extra_create_kwargs.update({ 'command': spawn_cmd }) # Memory limit -c.Spawner.mem_limit = '2G' # RAM limit +c.Spawner.mem_limit = '1G' # RAM limit # Connect containers to this Docker network network_name = os.environ['DOCKER_NETWORK_NAME'] @@ -56,7 +61,7 @@ c.DockerSpawner.notebook_dir = notebook_dir c.DockerSpawner.volumes = { 'hub-user-{username}': notebook_dir, 'ro_shared_volume':{"bind": '/home/jovyan/shared_volume_ro', "mode": "ro"}, 'rw_shared_volume':{"bind": '/home/jovyan/shared_volume_rw', "mode": "rw", "propagation": "rshared"}, - '/home/shared/':'/home/jovyan/shared_directory/' } + '/home/math/':'/home/jovyan/shared_directory/' } # volume_driver is no longer a keyword argument to create_container() # c.DockerSpawner.extra_create_kwargs.update({ 'volume_driver': 'local' }) @@ -107,7 +112,8 @@ c.JupyterHub.db_url = 'postgresql://postgres:{password}@{host}/{db}'.format( # Whitlelist users and admins c.Authenticator.whitelist = whitelist = set() c.Authenticator.admin_users = admin = set() -c.JupyterHub.admin_access = True +# Allow admin users to log into other single-user servers (e.g. for debugging, testing)? As a courtesy, you should make sure your users know if admin_access is enabled. +c.JupyterHub.admin_access = True pwd = os.path.dirname(__file__) with open(os.path.join(pwd, 'userlist')) as f: for line in f: @@ -121,6 +127,9 @@ with open(os.path.join(pwd, 'userlist')) as f: if len(parts) > 1 and parts[1] == 'admin': admin.add(name) +# Whitelist test +# c.Authenticator.whitelist = {'pilosovmnet', 'pilosovm', 'michael'} + # Run script to automatically stop idle single-user servers as a jupyterhub service. c.JupyterHub.services = [ { diff --git a/traefik.toml b/traefik.toml deleted file mode 100755 index 69d1d28..0000000 --- a/traefik.toml +++ /dev/null @@ -1,40 +0,0 @@ -logLevel = "DEBUG" -defaultEntryPoints = ["http", "https"] - -[api] -dashboard = true -entrypoint = "webentry" - -[docker] -domain ="consistentbayes.com" -watch = true -exposedbydefault = false -endpoint = "unix:///var/run/docker.sock" - -[entryPoints] - [entryPoints.http] - address = ":80" - [entryPoints.http.redirect] - entryPoint = "https" - [entryPoints.https] - address = ":443" - [entryPoints.https.tls] -[entrypoints.webentry] - address = ":8080" - [entrypoints.webentry.auth] - [entrypoints.webentry.auth.basic] - users = ["admin:$apr1$Wc4H94je$1rkT26mDWGkQ/UVDLc7E9."] - - -[acme] - email="consistentbayes@gmail.com" - storage="secrets/acme.json" - entryPoint="https" - acmeLogging=true - onDemand=false - OnHostRule=true - -[acme.httpChallenge] - entryPoint = "http" - provider = "namecheap" - delayBeforeCheck = 0