Changed: Ngshare as managed Service
This commit is contained in:
@@ -157,69 +157,37 @@ c.JupyterHub.concurrent_spawn_limit = 10
|
|||||||
c.JupyterHub.allow_named_servers = True
|
c.JupyterHub.allow_named_servers = True
|
||||||
c.JupyterHub.named_server_limit_per_user = 3
|
c.JupyterHub.named_server_limit_per_user = 3
|
||||||
|
|
||||||
|
# ngshare service configuration
|
||||||
# ngshare
|
|
||||||
c.JupyterHub.services.append(
|
c.JupyterHub.services.append(
|
||||||
{
|
{
|
||||||
"name": "ngshare",
|
"name": "ngshare",
|
||||||
"url": "http://127.0.0.1:10101",
|
"url": "http://127.0.0.1:10101",
|
||||||
"command": ["python3", "-m", "ngshare", "--admins", "admin"],
|
"command": [
|
||||||
|
"python3",
|
||||||
|
"-m",
|
||||||
|
"ngshare",
|
||||||
|
"--admins",
|
||||||
|
"admin",
|
||||||
|
"--debug" if ds_debug else "",
|
||||||
|
],
|
||||||
|
"environment": {
|
||||||
|
"JUPYTERHUB_SERVICE_URL": "http://127.0.0.1:10101",
|
||||||
|
"JUPYTERHUB_SERVICE_REDIRECT_URL": f"{base_url}services/ngshare/",
|
||||||
|
"JUPYTERHUB_BASE_URL": base_url,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
"""
|
# Additional ngshare configuration
|
||||||
# NBgrader
|
c.JupyterHub.load_roles = [
|
||||||
|
|
||||||
nbgrader_exchange_dir = "/srv/nbgrader/exchange"
|
|
||||||
|
|
||||||
|
|
||||||
c.JupyterHub.services = [
|
|
||||||
{
|
{
|
||||||
"name": "nbgrader-formgrader",
|
"name": "ngshare",
|
||||||
"url": "http://127.0.0.1:9999",
|
"scopes": [
|
||||||
"command": [
|
"admin:servers",
|
||||||
"python",
|
"access:services",
|
||||||
"-m",
|
"list:users",
|
||||||
"nbgrader.apps.formgraderapp",
|
"read:users:activity",
|
||||||
"--FormgradeApp.authenticator_plugin_class=nbgrader.auth.JupyterHubAuthPlugin",
|
|
||||||
"--FormgradeApp.ip=0.0.0.0",
|
|
||||||
"--FormgradeApp.port=9999",
|
|
||||||
f"--FormgradeApp.base_url={base_url}services/nbgrader-formgrader/",
|
|
||||||
],
|
],
|
||||||
"cwd": "/srv/nbgrader/exchange",
|
"services": ["ngshare"],
|
||||||
"environment": {
|
|
||||||
"JUPYTERHUB_API_TOKEN": "", # Will be set automatically
|
|
||||||
"JUPYTERHUB_API_URL": f"http://jupyterhub:{port}{base_url}hub/api",
|
|
||||||
"JUPYTERHUB_SERVICE_PREFIX": "/services/nbgrader-formgrader/",
|
|
||||||
"POSTGRES_USER": p_user,
|
|
||||||
"POSTGRES_PASSWORD": p_pass,
|
|
||||||
"POSTGRES_HOST": p_host,
|
|
||||||
"POSTGRES_DB": p_db,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
c.DockerSpawner.environment = {
|
|
||||||
"JUPYTERHUB_API_TOKEN": "", # Will be populated automatically
|
|
||||||
"JUPYTERHUB_API_URL": f"http://jupyterhub:{port}{base_url}hub/api",
|
|
||||||
"NBGRADER_EXCHANGE_DIRECTORY": nbgrader_exchange_dir,
|
|
||||||
"NBGRADER_CACHE_DIRECTORY": "/home/jovyan/.cache/nbgrader",
|
|
||||||
"NBGRADER_CONFIG_FILE": "/home/jovyan/.jupyter/nbgrader_config.py",
|
|
||||||
}
|
|
||||||
|
|
||||||
# Configure NBgrader to use the same PostgreSQL database
|
|
||||||
c.NbGrader.db_url = f"postgresql://{p_user}:{p_pass}@{p_host}:5432/{p_db}"
|
|
||||||
|
|
||||||
# NBgrader course configuration
|
|
||||||
c.CourseDirectory.root = "/srv/nbgrader"
|
|
||||||
c.CourseDirectory.course_id = os.environ.get("NBGRADER_COURSE_ID", "default_course")
|
|
||||||
|
|
||||||
# Exchange configuration
|
|
||||||
c.Exchange.root = nbgrader_exchange_dir
|
|
||||||
c.Exchange.course_id = os.environ.get("NBGRADER_COURSE_ID", "default_course")
|
|
||||||
|
|
||||||
# Formgrader configuration
|
|
||||||
c.FormgradeApp.authenticator_plugin_class = "nbgrader.auth.JupyterHubAuthPlugin"
|
|
||||||
c.FormgradeApp.base_url = f"{base_url}services/nbgrader-formgrader/"
|
|
||||||
"""
|
|
||||||
|
Reference in New Issue
Block a user