Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
52 lines (44 sloc) 2.11 KB
import os
import everware
import jupyterhub.handlers.pages
import jupyterhub.handlers.base
import dummyauthenticator
# TODO: find a way to change default handlers
# instead of this shit
jupyterhub.handlers.base.UserSpawnHandler.get = everware.UserSpawnHandler.get
jupyterhub.handlers.pages.SpawnHandler.post = everware.SpawnHandler.post
jupyterhub.handlers.pages.SpawnHandler.get = everware.SpawnHandler.get
jupyterhub.handlers.pages.SpawnHandler._spawn = everware.SpawnHandler._spawn
jupyterhub.handlers.pages.HomeHandler.get = everware.HomeHandler.get
c = get_config()
# spawn with custom docker containers
c.JupyterHub.spawner_class = 'everware.CustomDockerSpawner'
#c.JupyterHub.spawner_class = 'everware.CustomSwarmSpawner'
# The docker instances need access to the Hub, so the default loopback port doesn't work:
# (IP addrress setting is overriden by command line argument at Makefile)
# ip_addr = '192.168.0.39'
# c.JupyterHub.hub_ip = ip_addr
# c.JupyterHub.hub_api_ip = ip_addr
authenticator = everware.GitHubOAuthenticator
c.JupyterHub.authenticator_class = '%s.%s' % (authenticator.__module__, authenticator.__name__)
# whitelist_file = 'whitelist.txt'
whitelist_file = os.environ['EVERWARE_WHITELIST']
whitelist_handler = everware.DefaultWhitelistHandler(whitelist_file, c, authenticator)
c.GitHubOAuthenticator.oauth_callback_url = os.environ['OAUTH_CALLBACK_URL']
c.GitHubOAuthenticator.client_id = os.environ['GITHUB_CLIENT_ID']
c.GitHubOAuthenticator.client_secret = os.environ['GITHUB_CLIENT_SECRET']
# c.JupyterHub.authenticator_class = 'dummyauthenticator.DummyAuthenticator'
# c.Spawner.tls = True
# Set to False when running docker directly (i.e. on Linux)
c.Spawner.tls = False
c.Spawner.debug = True
c.Spawner.start_timeout = 1000
c.Spawner.remove_containers = True
c.Spawner.tls_assert_hostname = False
c.Spawner.use_docker_client_env = True
c.JupyterHub.data_files_path = 'share'
c.JupyterHub.template_paths = ['share/static/html']
# change this to the ip that `boot2docker ip` or
# `docker-machine ip <vm_name>`tells you if
# you use boot2docker/a VM, otherwise remove the line
# c.Spawner.container_ip = '192.168.99.100'