deployment updates

This commit is contained in:
Mathematical Michael 2022-06-24 17:52:42 +00:00
parent 9ab1511bcb
commit 5b055bbd1d
4 changed files with 19 additions and 15 deletions

4
.env
View File

@ -24,7 +24,7 @@ DOCKER_NETWORK_NAME=hub-network
#DOCKER_NOTEBOOK_IMAGE=jupyter/tensorflow-notebook:4d9c9bd9ced0 #DOCKER_NOTEBOOK_IMAGE=jupyter/tensorflow-notebook:4d9c9bd9ced0
# d0bfe4b38f78: tensorflow==2.4.1 python==3.9.2 lab==3.0.15 notebook==6.3.0 hub==1.4.1 # d0bfe4b38f78: tensorflow==2.4.1 python==3.9.2 lab==3.0.15 notebook==6.3.0 hub==1.4.1
# 23ac04200f8f: tensorflow==2.6.0 python==3.9.7 lab==3.2.3 notebook==6.4.5 hub==1.5.0 # 23ac04200f8f: tensorflow==2.6.0 python==3.9.7 lab==3.2.3 notebook==6.4.5 hub==1.5.0
DOCKER_NOTEBOOK_IMAGE=jupyter/tensorflow-notebook:hub-1.5.0 DOCKER_NOTEBOOK_IMAGE=jupyter/scipy-notebook:hub-1.5.0
# the local image we use, after pinning jupyterhub version # the local image we use, after pinning jupyterhub version
#LOCAL_NOTEBOOK_IMAGE=jupyterhub-user #LOCAL_NOTEBOOK_IMAGE=jupyterhub-user
@ -44,6 +44,6 @@ DOCKER_SPAWN_CMD=start-singleuser.sh
# afterwards, you can visit /hub/login_list (if enabled and you are an admin) to see everyone's passwords. # afterwards, you can visit /hub/login_list (if enabled and you are an admin) to see everyone's passwords.
# by default, hub-admin will be an admin user (defined in jupyterhub_config.py). # by default, hub-admin will be an admin user (defined in jupyterhub_config.py).
# you can print the password for this hub-admin user with 'bash show_login.sh' # you can print the password for this hub-admin user with 'bash show_login.sh'
USERNAME=`whoami` USERNAME=mm
PASSWORD_LENGTH=6 PASSWORD_LENGTH=6
HUB_LOC=`pwd` HUB_LOC=`pwd`

View File

@ -6,7 +6,7 @@ FROM jupyterhub/jupyterhub-onbuild:$JUPYTERHUB_VERSION
# Install dockerspawner, oauth, postgres # Install dockerspawner, oauth, postgres
RUN pip install psycopg2-binary~=2.7 && \ RUN pip install psycopg2-binary~=2.7 && \
pip install --no-cache-dir \ pip install --no-cache-dir \
oauthenticator==0.8.* oauthenticator~=14.2.0
RUN pip install jupyterhub-hashauthenticator dockerspawner~=12.0 RUN pip install jupyterhub-hashauthenticator dockerspawner~=12.0
RUN pip install jupyterhub-idle-culler RUN pip install jupyterhub-idle-culler
@ -19,4 +19,4 @@ RUN pip install jupyterhub-idle-culler
#RUN chmod 700 /srv/jupyterhub/secrets && \ #RUN chmod 700 /srv/jupyterhub/secrets && \
# chmod 600 /srv/jupyterhub/secrets/* # chmod 600 /srv/jupyterhub/secrets/*
#COPY ./userlist /srv/jupyterhub/userlist #COPY ./userlist /srv/jupyterhub/userlist

View File

@ -6,7 +6,7 @@ version: "3"
services: services:
hub-db: hub-db:
image: postgres:9.5 image: postgres:14.1
container_name: ${HUB_NAME}-db container_name: ${HUB_NAME}-db
restart: always restart: always
environment: environment:
@ -37,8 +37,8 @@ services:
- ./jupyterhub_config.py:/srv/jupyterhub/jupyterhub_config.py - ./jupyterhub_config.py:/srv/jupyterhub/jupyterhub_config.py
- ./userlist:/srv/jupyterhub/userlist - ./userlist:/srv/jupyterhub/userlist
# - "/tmp/.X11-unix:/tmp/.X11-unix" # - "/tmp/.X11-unix:/tmp/.X11-unix"
ports: # ports:
- "${PORT_NUM}:8000" # - "${PORT_NUM}:8000"
links: links:
- hub-db - hub-db
environment: environment:

View File

@ -118,10 +118,11 @@ class MyDockerSpawner(DockerSpawner):
self.default_url = '/lab' self.default_url = '/lab'
def update_volumes(self, group_list): def update_volumes(self, group_list):
for group_id in group_list: mode = 'rw' if 'admin' in group_list else 'ro'
mode = 'rw' if 'admin' in group_list else 'ro' for group_id in group_list: # do not want "shared-admin" folder.
volume = create_volume_mount(group_id, mode, 'jovyan') if group_id != 'admin':
self.volumes.update(volume) volume = create_volume_mount(group_id, mode, 'jovyan')
self.volumes.update(volume)
def limit_resources(self, mem_limit='8G', cpu_limit=1.0): def limit_resources(self, mem_limit='8G', cpu_limit=1.0):
self.mem_limit = mem_limit self.mem_limit = mem_limit
@ -184,12 +185,13 @@ c.DockerSpawner.debug = True
# User containers will access hub by container name on the Docker network # User containers will access hub by container name on the Docker network
c.JupyterHub.hub_ip = HUB_NAME c.JupyterHub.hub_ip = HUB_NAME
# The hub will be hosted at example.com/HUB_NAME/ # The hub will be hosted at example.com/HUB_NAME/
c.JupyterHub.base_url = u'/%s/'%HUB_NAME #c.JupyterHub.base_url = u'/%s/'%HUB_NAME
c.JupyterHub.base_url = u'/'
#c.JupyterHub.hub_port = 8001 #c.JupyterHub.hub_port = 8001
## Authentication ## Authentication
# Whitlelist users and admins # Whitlelist users and admins
c.Authenticator.allowed_users = whitelist = set() c.Authenticator.allowed_users = allowed_users = set()
c.Authenticator.admin_users = admin = set() c.Authenticator.admin_users = admin = set()
# add default user so that first-time log in is easy. # add default user so that first-time log in is easy.
@ -197,12 +199,14 @@ admin.add('hub-admin')
for name in GROUP_MAP: for name in GROUP_MAP:
if 'admin' in GROUP_MAP[name]: if 'admin' in GROUP_MAP[name]:
admin.add(name) admin.add(name)
else: allowed_users.add(name)
whitelist.add(name)
# 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']
#c.GitHubOAuthenticator.allowed_organizations = {'ml-starter-packs', 'mindthemath', 'mindthegrow'}
#c.GitHubOAuthenticator.scope = ['read:org', 'user:email']
# Authenticate with thedataincubator/jupyterhub-hashauthenticator # Authenticate with thedataincubator/jupyterhub-hashauthenticator
##c.JupyterHub.authenticator_class = 'hashauthenticator.HashAuthenticator' ##c.JupyterHub.authenticator_class = 'hashauthenticator.HashAuthenticator'