Jupyterhub - Redirection Error While Openning User Notebook - Too many redirections
mehmetbebek opened this issue · 0 comments
mehmetbebek commented
I am getting 500 internal server error while openning user's notebook
I have create 2 users and also their notebook directories also grant folder permissions. But nano of them is worked
# Configuration file for jupyterhub.
import os
from jupyterhub.spawner import LocalProcessSpawner
from jupyter_client.localinterfaces import public_ips
c = get_config()
data_dir = '~/data'
source_dir = '~/notebooks'
class MySpawner(LocalProcessSpawner):
def start(self):
# Local vars
username = self.user.name
home_dir = '/home/%s/notebooks' %username
cases_dir = home_dir+'/cases'
examples_dir = home_dir+'/examples'
workspace_dir = home_dir+'/workspace'
# Home
os.system("mkdir -p %s" %home_dir)
# Welcome
os.system("cp %s/Welcome.ipynb %s" %(source_dir,home_dir))
# Examples
os.system("rm -rf %s" %examples_dir)
os.system("cp -r %s/examples %s" %(source_dir,home_dir))
# Cases
os.system("rm -rf %s" %cases_dir)
os.system("cp -r %s/cases %s" %(source_dir,home_dir))
# Workspace
os.system("mkdir -p %s" %workspace_dir)
os.system("cp -r %s/workspace-%s/. %s" %(data_dir,username,workspace_dir))
os.system("chown -R %s %s" %(username,workspace_dir))
return super().start()
def stop(self):
# Local vars
username = self.user.name
home_dir = '/home/%s/notebooks' %username
workspace_dir = home_dir+'/workspace'
# Backup workspace
os.system("rsync -avz --delete %s %s/workspace-%s" %(workspace_dir,data_dir,username))
return super().stop()
c.Authenticator.admin_users = set([])
c.JupyterHub.ip = public_ips()[0]
c.JupyterHub.port = 443
c.JupyterHub.admin_access = True
c.JupyterHub.cookie_secret_file = data_dir+'jupyterhub_cookie_secret'
c.JupyterHub.extra_log_file = '/var/log/jupyterhub.log'
c.JupyterHub.spawner_class = MySpawner
c.JupyterHub.hub_ip = public_ips()[0]
c.JupyterHub.hub_port = 1453
c.JupyterHub.services = [{'name': 'cull-idle',
'admin': True,
'command': 'python cull_idle_servers.py --timeout=3600'.split()}]
c.Spawner.debug = False
c.Spawner.notebook_dir = '~/notebooks'
c.Spawner.args = ['--NotebookApp.default_url=%s/Welcome.ipynb' %source_dir]
c.LocalAuthenticator.create_system_users = True
c.Authenticator.whitelist = {'mgnfcnt', 'testuser'}
c.Authenticator.admin_users = {'mgnfcnt'}
c.JupyterHub.ssl_cert = 'jupyterhub.pem'
c.JupyterHub.ssl_key = 'jupyterhub.key'
c.JupyterHub.cookie_secret_file = '/home/jupyterhub_cookie_secret'
c.JupyterHub.proxy_cmd = ['/opt/anaconda3/bin/configurable-http-proxy']