Skip to content

Commit

Permalink
Deprecate JB build in user pods
Browse files Browse the repository at this point in the history
  • Loading branch information
agahkarakuzu committed Sep 14, 2024
1 parent 6313e6e commit 4aa1596
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 42 deletions.
26 changes: 1 addition & 25 deletions terraform-modules/binderhub/assets/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,49 +37,25 @@ jupyterhub:
every: 30
concurrency: 5 #to avoid Hub slow down, 5 concurrent processes
maxAge: 7200 #2h
# https://z2jh.jupyter.org/en/latest/resources/reference.html#singleuser
singleuser:
storage:
type: none
extraVolumes:
- name: shared-data
hostPath:
path: /DATA
- name: book-data
hostPath:
path: /DATA/book-artifacts
- name: repo2data
hostPath:
path: /DATA
extraVolumeMounts:
- name: shared-data
mountPath: /home/jovyan/data # where each user can reach shared data
readOnly : true
- name: book-data
mountPath: /mnt/books
- name: repo2data
mountPath: /mnt/data
memory:
guarantee: 4G
limit: 8G
cpu:
guarantee: 1
startTimeout: 3600 #1h
#for repo2data https://zero-to-jupyterhub.readthedocs.io/en/latest/resources/reference.html#singleuser-initcontainers
# https://zero-to-jupyterhub.readthedocs.io/en/latest/jupyterhub/customizing/user-environment.html#about-user-storage-and-adding-files-to-it
extraFiles:
jb_build:
mountPath: /usr/local/share/jb_build.bash
mode: 0755
repo2data:
mountPath: /usr/local/share/repo2data.bash
mode: 0755
fill_submission_metadata:
mountPath: /usr/local/share/fill_submission_metadata.bash
mode: 0755
lifecycleHooks:
postStart:
exec:
command: ["/bin/sh", "-c", "/usr/local/share/repo2data.bash; /usr/local/share/jb_build.bash"]

# BinderHub config
config:
Expand Down
9 changes: 6 additions & 3 deletions terraform-modules/binderhub/assets/install-binderhub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,13 @@ sudo helm repo add jupyterhub https://jupyterhub.github.io/helm-chart
sudo helm repo update
sudo helm install binderhub jupyterhub/binderhub --version=${binder_version} \
--namespace=binderhub -f config.yaml -f secrets.yaml \
--set-file jupyterhub.singleuser.extraFiles.repo2data.stringData=./repo2data.bash \
--set-file jupyterhub.singleuser.extraFiles.fill_submission_metadata.stringData=./fill_submission_metadata.bash \
--set-file jupyterhub.singleuser.extraFiles.jb_build.stringData=./jb_build.bash \
--kubeconfig ~/.kube/config

# DROPPING JB BUILD INSIDE POD SUPPORT
# --set-file jupyterhub.singleuser.extraFiles.repo2data.stringData=./repo2data.bash \
# --set-file jupyterhub.singleuser.extraFiles.fill_submission_metadata.stringData=./fill_submission_metadata.bash \
# --set-file jupyterhub.singleuser.extraFiles.jb_build.stringData=./jb_build.bash \

# sudo helm upgrade binderhub jupyterhub/binderhub -n binderhub --version=${binder_version} \
# -f confgi.yaml -f secrets.yaml \
# --set-file jupyterhub.singleuser.extraFiles.repo2data.stringData=./repo2data.bash \
Expand Down
5 changes: 5 additions & 0 deletions terraform-modules/binderhub/assets/jb_build.bash
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/bash


# ---------------------------------------------------------------
# DEPRECATED
# ---------------------------------------------------------------

# repo parameters
IFS='/'; BINDER_PARAMS=(${BINDER_REF_URL}); unset IFS;
PROVIDER_NAME=${BINDER_PARAMS[-5]}
Expand Down
30 changes: 16 additions & 14 deletions terraform-modules/binderhub/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,22 @@ provisioner "file" {
destination = "/home/${var.admin_user}/cloudflare-secret.yaml"
}

provisioner "file" {
source = "${path.module}/assets/fill_submission_metadata.bash"
destination = "/home/${var.admin_user}/fill_submission_metadata.bash"
}

provisioner "file" {
source = "${path.module}/assets/repo2data.bash"
destination = "/home/${var.admin_user}/repo2data.bash"
}

provisioner "file" {
source = "${path.module}/assets/jb_build.bash"
destination = "/home/${var.admin_user}/jb_build.bash"
}
## DEPRECATED

# provisioner "file" {
# source = "${path.module}/assets/fill_submission_metadata.bash"
# destination = "/home/${var.admin_user}/fill_submission_metadata.bash"
# }

# provisioner "file" {
# source = "${path.module}/assets/repo2data.bash"
# destination = "/home/${var.admin_user}/repo2data.bash"
# }

# provisioner "file" {
# source = "${path.module}/assets/jb_build.bash"
# destination = "/home/${var.admin_user}/jb_build.bash"
# }

provisioner "remote-exec" {
inline = ["bash /home/${var.admin_user}/install-binderhub.sh",]
Expand Down

0 comments on commit 4aa1596

Please sign in to comment.