jupyterhub-little

 1、环境

    单台虚拟机centos7、docker1.8

2、结构&组件

jupyterhub-little_第1张图片

3、安装
 反向代理:nginx(可以不用,本身它有代理服务)

 验证服务:启动一个容器centos:latest 安装ldap做验证服务器

 元数据库:这里用mariadb

 hub服务:启动一个容器centos:latest 用pip安装jupyterhub

                   spawner用的docker spawner,

                把docker.sock挂进去,就是所谓的docker in docker

                "/var/run/docker.sock:/var/run/docker.sock",
                "/usr/bin/docker:/usr/bin/docker"

                   配置文件jupyterhub_config.py如下

 

c.JupyterHub.db_url = 'mysql+pymysql://{}:{}@{}/{}'.format("root","123456","192.168.56.104:3306","jupyter")

c.JupyterHub.ip = '172.17.0.3'
c.JupyterHub.port = 8000

c.JupyterHub.proxy_api_ip = '172.17.0.3'
c.JupyterHub.proxy_api_port = 8020

c.JupyterHub.base_url = '/'
c.JupyterHub.bind_url = 'http://172.17.0.3:8000'

c.ConfigurableHTTPProxy.should_start=True
c.ConfigurableHTTPProxy.api_url = 'http://172.17.0.3:8020'

c.JupyterHub.hub_ip = '172.17.0.3'
c.JupyterHub.hub_port = 8082


c.Authenticator.admin_users = {'tom','jerry'}

c.Spawner.args = ['--NotebookApp.allow_origin=*']

c.JupyterHub.authenticator_class = 'ldapauthenticator.LDAPAuthenticator'
c.LDAPAuthenticator.use_ssl = False
c.LDAPAuthenticator.server_address = '192.168.56.105'
c.LDAPAuthenticator.server_port = 389
c.LDAPAuthenticator.bind_dn_template = 'userid={username},ou=jupyterhub,dc=tom,dc=com'


c.Spawner.default_url = '/lab'
c.Spawner.environment = { 'JUPYTER_ENABLE_LAB': 'yes' }


import os
#dockerSpawner
c.JupyterHub.spawner_class ='dockerspawner.DockerSpawner'
c.DockerSpawner.image ='jupyter/all-spark-notebook:latest'
notebook_dir = os.environ.get('DOCKER_NOTEBOOK_DIR') or '/home/jovyan/work'
c.DockerSpawner.notebook_dir = notebook_dir
c.DockerSpawner.volumes = { 'jupyterhub-user-{username}': notebook_dir }

c.DockerSpawner.extra_host_config = {'network_mode': 'bridge'}
c.DockerSpawner.use_internal_ip = True
c.DockerSpawner.network_name = 'bridge'

 

 

你可能感兴趣的:(jupyterhub)