feat: add jupyterhub role
- add nodejs module to use npm package provider - add jupyterhub role - add class to configure the jupyterhub instance - add ldap groups - add nginx simpleproxy
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
# jupyterhub_config.py
|
||||
|
||||
from dockerspawner import DockerSpawner
|
||||
import os
|
||||
|
||||
c = get_config()
|
||||
|
||||
# Basic JupyterHub settings
|
||||
c.JupyterHub.bind_url = 'http://:8000'
|
||||
c.JupyterHub.hub_ip = '0.0.0.0'
|
||||
c.JupyterHub.hub_port = 8081
|
||||
|
||||
# Configure the DockerSpawner
|
||||
c.JupyterHub.spawner_class = DockerSpawner
|
||||
c.DockerSpawner.image = '<%= @docker_image %>'
|
||||
c.DockerSpawner.network_name = '<%= @docker_network %>'
|
||||
|
||||
# Notebook directory and mount location
|
||||
notebook_dir = '/home/jupyter/work'
|
||||
c.DockerSpawner.notebook_dir = notebook_dir
|
||||
|
||||
# Optional: Volume mapping for user data persistence
|
||||
c.DockerSpawner.volumes = {
|
||||
'jupyterhub-user-{username}': notebook_dir
|
||||
}
|
||||
|
||||
# DockerSpawner options
|
||||
c.DockerSpawner.remove = True
|
||||
c.DockerSpawner.debug = True
|
||||
|
||||
# LDAP Authentication
|
||||
c.JupyterHub.authenticator_class = 'ldapauthenticator.LDAPAuthenticator'
|
||||
|
||||
# LDAP Server settings
|
||||
c.LDAPAuthenticator.server_address = '<%= @ldap_server_address %>'
|
||||
c.LDAPAuthenticator.bind_dn_template = '<%= @ldap_bind_dn_template %>'
|
||||
c.LDAPAuthenticator.use_ssl = <%= @ldap_use_ssl ? 'True' : 'False' %>
|
||||
|
||||
# Restrict access to a specific LDAP group
|
||||
c.LDAPAuthenticator.allowed_groups = <%= @ldap_allowed_groups.to_s %>
|
||||
|
||||
# Set an LDAP group as admins
|
||||
c.LDAPAuthenticator.admin_groups = <%= @ldap_admin_groups.to_s %>
|
||||
@@ -0,0 +1,16 @@
|
||||
[Unit]
|
||||
Description=JupyterHub
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/opt/jupyterhub/venv/bin/jupyterhub -f /opt/jupyterhub/config.py
|
||||
WorkingDirectory=/opt/jupyterhub
|
||||
User=<%= @owner %>
|
||||
Group=<%= @group %>
|
||||
|
||||
Environment="PATH=/opt/jupyterhub/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user