setup all initial notebooks

This commit is contained in:
Nikita Aleksandrov 2025-09-02 15:18:10 +02:00
parent e1b8a67cb1
commit 7f3e7645c7
5 changed files with 45 additions and 100 deletions

View File

@ -7,3 +7,4 @@ ipywidgets
mlflow
ollama
panel
ray

View File

@ -1,19 +1,18 @@
---
{{- /*
Create ConfigMaps for jupyterhub singleuser pods.
These ConfigMaps are mounted as volumes.
Create a single ConfigMap with all initialization files for the jupyterhub singleuser pod.
This ConfigMap is mounted as a volume.
*/ -}}
{{- range $path, $_ := .Files.Glob "files/*" }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-%s" $.Release.Name (base $path | replace "." "-" | replace "_" "-") }}
name: ai-starter-kit-init-files
labels:
app.kubernetes.io/managed-by: {{ $.Release.Service | quote }}
app.kubernetes.io/instance: {{ $.Release.Name | quote }}
helm.sh/chart: "{{ $.Chart.Name }}-{{ $.Chart.Version }}"
data:
{{- range $path, $bytes := .Files.Glob "files/*" }}
{{ base $path | quote }}: |-
{{ $.Files.Get $path | nindent 4 }}
{{ $bytes | toString | nindent 4 }}
{{- end }}

View File

@ -37,28 +37,22 @@ jupyterhub:
pip install -r /tmp/requirements.txt
python /tmp/download_models.py
# populate workspace with initial files
if [ ! -f /home/jovyan/welcome.ipynb ]; then
cp /tmp/welcome.ipynb /home/jovyan/welcome.ipynb
fi
for f in /tmp/*.ipynb; do
if [ -f "$f" ]; then
# Use cp -n to not overwrite existing files.
cp -n "$f" /home/jovyan/
fi
done
volumeMounts:
- name: requirements-txt
mountPath: /tmp/requirements.txt
subPath: requirements.txt
readOnly: true
# This 'home' volume is created by the helm chart's 'homeMountPath' option.
# We mount it to initContainer too, so all downloads and installations are persisted in this mounted home folder.
# This 'home' volume is created by the helm chart's 'homeMountPath' option.
# We mount it to initContainer too, so all downloads and installations are persisted in this mounted home folder.
- name: home
mountPath: /home/jovyan
subPath: jupyterhub_workspace
- name: "download-models-py"
mountPath: /tmp/download_models.py
subPath: download_models.py
readOnly: true
- name: welcome-ipynb
mountPath: "/tmp/welcome.ipynb"
subPath: welcome.ipynb
- name: init-files
mountPath: /tmp
readOnly: true
storage:
@ -69,21 +63,9 @@ jupyterhub:
capacity: 20Gi
homeMountPath: /home/jovyan
extraVolumes:
- name: requirements-txt
- name: init-files
configMap:
name: "ai-starter-kit-requirements-txt"
- name: download-models-py
configMap:
name: "ai-starter-kit-download-models-py"
- name: welcome-ipynb
configMap:
name: "ai-starter-kit-welcome-ipynb"
- name: ray-ipynb
configMap:
name: "ai-starter-kit-ray-ipynb"
- name: chat-bot-ipynb
configMap:
name: "ai-starter-kit-chat-bot-ipynb"
name: "ai-starter-kit-init-files"
# This environment variables list have its own format: https://z2jh.jupyter.org/en/latest/resources/reference.html#singleuser-extraenv
extraEnv:
HF_TOKEN:

View File

@ -38,29 +38,22 @@ jupyterhub:
python /tmp/download_models.py
# populate workspace with initial files
if [ ! -f /home/jovyan/welcome.ipynb ]; then
cp /tmp/welcome.ipynb /home/jovyan/welcome.ipynb
fi
# populate workspace with initial notebook files
for f in /tmp/*.ipynb; do
if [ -f "$f" ]; then
# Use cp -n to not overwrite existing files.
cp -n "$f" /home/jovyan/
fi
done
volumeMounts:
- name: requirements-txt
mountPath: /tmp/requirements.txt
subPath: requirements.txt
readOnly: true
# This 'home' volume is created by the helm chart's 'homeMountPath' option.
# We mount it to initContainer too, so all downloads and installations are persisted in this mounted home folder.
# This 'home' volume is created by the helm chart's 'homeMountPath' option.
# We mount it to initContainer too, so all downloads and installations are persisted in this mounted home folder.
- name: home
mountPath: /home/jovyan
subPath: jupyterhub_workspace
- name: "download-models-py"
mountPath: /tmp/download_models.py
subPath: download_models.py
- name: init-files
mountPath: /tmp
readOnly: true
- name: welcome-ipynb
mountPath: "/tmp/welcome.ipynb"
subPath: welcome.ipynb
readOnly: true
storage:
type: static
static:
@ -69,21 +62,9 @@ jupyterhub:
capacity: 20Gi
homeMountPath: /home/jovyan
extraVolumes:
- name: requirements-txt
- name: init-files
configMap:
name: "ai-starter-kit-requirements-txt"
- name: download-models-py
configMap:
name: "ai-starter-kit-download-models-py"
- name: welcome-ipynb
configMap:
name: "ai-starter-kit-welcome-ipynb"
- name: ray-ipynb
configMap:
name: "ai-starter-kit-ray-ipynb"
- name: chat-bot-ipynb
configMap:
name: "ai-starter-kit-chat-bot-ipynb"
name: "ai-starter-kit-init-files"
# This environment variables list have its own format: https://z2jh.jupyter.org/en/latest/resources/reference.html#singleuser-extraenv
extraEnv:
HF_TOKEN:

View File

@ -37,28 +37,22 @@ jupyterhub:
pip install -r /tmp/requirements.txt
python /tmp/download_models.py
# populate workspace with initial files
if [ ! -f /home/jovyan/welcome.ipynb ]; then
cp /tmp/welcome.ipynb /home/jovyan/welcome.ipynb
fi
for f in /tmp/*.ipynb; do
if [ -f "$f" ]; then
# Use cp -n to not overwrite existing files.
cp -n "$f" /home/jovyan/
fi
done
volumeMounts:
- name: requirements-txt
mountPath: /tmp/requirements.txt
subPath: requirements.txt
readOnly: true
# This 'home' volume is created by the helm chart's 'homeMountPath' option.
# We mount it to initContainer too, so all downloads and installations are persisted in this mounted home folder.
# This 'home' volume is created by the helm chart's 'homeMountPath' option.
# We mount it to initContainer too, so all downloads and installations are persisted in this mounted home folder.
- name: home
mountPath: /home/jovyan
subPath: jupyterhub_workspace
- name: "download-models-py"
mountPath: /tmp/download_models.py
subPath: download_models.py
readOnly: true
- name: welcome-ipynb
mountPath: "/tmp/welcome.ipynb"
subPath: welcome.ipynb
- name: init-files
mountPath: /tmp
readOnly: true
storage:
@ -69,21 +63,9 @@ jupyterhub:
capacity: 20Gi
homeMountPath: /home/jovyan
extraVolumes:
- name: requirements-txt
- name: init-files
configMap:
name: "ai-starter-kit-requirements-txt"
- name: download-models-py
configMap:
name: "ai-starter-kit-download-models-py"
- name: welcome-ipynb
configMap:
name: "ai-starter-kit-welcome-ipynb"
- name: ray-ipynb
configMap:
name: "ai-starter-kit-ray-ipynb"
- name: chat-bot-ipynb
configMap:
name: "ai-starter-kit-chat-bot-ipynb"
name: "ai-starter-kit-init-files"
# This environment variables list have its own format: https://z2jh.jupyter.org/en/latest/resources/reference.html#singleuser-extraenv
extraEnv:
HF_TOKEN: