48c.JupyterHub.active_server_limit = 0
67c.JupyterHub.admin_access =
True
72from firstuseauthenticator
import FirstUseAuthenticator
77c.JupyterHub.authenticator_class = FirstUseAuthenticator
80c.FirstUseAuthenticator.create_users =
False
83c.FirstUseAuthenticator.open_signup =
False
86c.Authenticator.admin_users = {
"mofem"}
88c.JupyterHub.spawner_class =
'jupyterhub.spawner.LocalProcessSpawner'
92 username = spawner.user.name
93 home = f
"/mofem_install/jupyter/{username}"
94 skel =
"/mofem_install/jupyter/skel"
97 spack_config_packages =
"/mofem_install/spack_config_dir/packages.yaml"
98 spack_config_repo =
"/mofem_install/spack_config_dir/repos.yaml"
99 spack_config_dest = os.path.join(home,
".spack/")
101 spawner.log.info(f
"Setting up home for {username} at {home}")
104 subprocess.check_call([
"id", username])
105 spawner.log.info(f
"User {username} already exists")
106 except subprocess.CalledProcessError:
108 subprocess.check_call([
109 "useradd",
"-m",
"-d", home,
"-k", skel,
"-s",
"/bin/bash", username
112 os.makedirs(spack_config_dest, exist_ok=
True)
113 subprocess.check_call([
"cp", spack_config_packages, spack_config_dest])
114 subprocess.check_call([
"cp", spack_config_repo, spack_config_dest])
116 cmd =
r'''grep -rl "jupyter:" --include="*.md" . | while read f; do
117 jupytext --to ipynb "$f" && rm "$f"
119 subprocess.run(cmd, shell=
True, check=
True)
121 spawner.log.info(f
"Created user {username} with home {home}")
123 subprocess.check_call([
"chown",
"-R", f
"{username}:{username}", home])
125 spawner.environment[
"HOME"] = home
126 spawner.args = [f
"--ServerApp.root_dir={home}"]
129c.Spawner.pre_spawn_hook = setup_user_home
235c.JupyterHub.concurrent_spawn_limit = 100
695c.JupyterHub.template_paths = [
'/mofem_install/jupyter/templates']
870c.Spawner.default_url =
'/lab/tree/README.md'
891c.Spawner.env_keep = [
'LD_LIBRARY_PATH',
'PATH',
'PYTHONPATH',
'CONDA_ROOT',
'CONDA_DEFAULT_ENV',
'VIRTUAL_ENV',
'LANG',
'LC_ALL',
'JUPYTERHUB_SINGLEUSER_APP']