Skip to content

Commit

Permalink
Adding skel to user directories
Browse files Browse the repository at this point in the history
  • Loading branch information
costrouc committed Mar 4, 2022
1 parent a05fc2a commit ff746f6
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 6 deletions.
4 changes: 1 addition & 3 deletions qhub/template/image/jupyterlab/postBuild
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
#!/usr/bin/env bash
set -euo pipefail
set -x

# install classic notebook extensions
jupyter nbextension enable --py widgetsnbextension --sys-prefix

# ====== setup jupyterlab configuration overrides ======
mkdir -p /opt/conda/share/jupyter/lab/settings
cp /opt/jupyterlab/overrides.json /opt/conda/share/jupyter/lab/settings

# ====== fix perms ======
fix-permissions /opt/jupyterlab /etc/ipython

# if DEFAULT_ENV is unset ${DEFAULT_ENV+x} expands to nothing otherwise
# it substitutes the string x. This allows us to check if the variable
# is set without triggering an unbound variable error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def base_profile_home_mounts(username):
"""
home_pvc_name = z2jh.get_config("custom.home-pvc")
skel_mount = z2jh.get_config("custom.skel-mount")
pvc_home_mount_path = "home/{username}"
pod_home_mount_path = "/home/{username}"

Expand All @@ -25,6 +26,12 @@ def base_profile_home_mounts(username):
"persistentVolumeClaim": {
"claimName": home_pvc_name,
},
},
{
"name": "skel",
"configMap": {
"name": skel_mount["name"],
}
}
]
}
Expand All @@ -35,11 +42,11 @@ def base_profile_home_mounts(username):
"mountPath": pod_home_mount_path.format(username=username),
"name": "home",
"subPath": pvc_home_mount_path.format(username=username),
}
},
]
}

MKDIR_OWN_DIRECTORY = "mkdir -p /mnt/{path} && chmod 777 /mnt/{path}"
MKDIR_OWN_DIRECTORY = "mkdir -p /mnt/{path} && chmod 777 /mnt/{path} && cp -r /etc/skel/. /mnt/{path}"
command = MKDIR_OWN_DIRECTORY.format(
path=pvc_home_mount_path.format(username=username)
)
Expand All @@ -49,7 +56,10 @@ def base_profile_home_mounts(username):
"image": "busybox:1.31",
"command": ["sh", "-c", command],
"securityContext": {"runAsUser": 0},
"volumeMounts": [{"mountPath": "/mnt", "name": "home"}],
"volumeMounts": [
{"mountPath": "/mnt", "name": "home"},
{"mountPath": "/etc/skel", "name": "skel"},
],
}
]
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
###################################################################
# Managed by QHub #
###################################################################
# ~/.bash_logout: executed by bash(1) when login shell exits.

# when leaving the console clear the screen to increase privacy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
###################################################################
# Managed by QHub #
###################################################################
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
###################################################################
# Managed by QHub #
###################################################################
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ resource "helm_release" "jupyterhub" {
shared-pvc = var.shared-pvc
conda-store-pvc = var.conda-store-pvc
conda-store-mount = var.conda-store-mount
skel-mount = {
name = kubernetes_config_map.etc-skel.metadata.0.name
namespace = kubernetes_config_map.etc-skel.metadata.0.namespace
}
extra-mounts = merge(
var.extra-mounts,
{
Expand Down

0 comments on commit ff746f6

Please sign in to comment.