-
Notifications
You must be signed in to change notification settings - Fork 1
Lmod spider modules impl #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,31 +1,80 @@ | ||
| FROM rockylinux/rockylinux:9 | ||
| # ========================= | ||
| # Stage 1: base (OOD + Lmod) | ||
| # ========================= | ||
| FROM rockylinux/rockylinux:9 AS base | ||
| LABEL maintainer="[email protected]; [email protected]" | ||
|
|
||
| RUN dnf install -y https://yum.osc.edu/ondemand/4.0/ondemand-release-web-4.0-1.el9.noarch.rpm && \ | ||
| dnf clean all && rm -rf /var/cache/dnf/* | ||
|
|
||
| RUN dnf -y update && \ | ||
| dnf -y update && \ | ||
| dnf install -y dnf-utils && \ | ||
| dnf config-manager --set-enabled crb && \ | ||
| dnf -y module enable nodejs:20 ruby:3.3 && \ | ||
| dnf install -y epel-release && \ | ||
| dnf install -y procps libffi-devel python3-devel gcc && \ | ||
| dnf install -y ondemand ondemand-dex && \ | ||
| dnf install -y procps libffi-devel python3-devel gcc libstdc++ zlib openssl && \ | ||
| dnf install -y --nogpgcheck ondemand ondemand-dex && \ | ||
| dnf install -y Lmod && \ | ||
| dnf clean all && rm -rf /var/cache/dnf/* | ||
|
|
||
| # RUN pip3 install 'setuptools_scm<7' && \ | ||
| RUN pip3 install jupyter | ||
| # Patch OOD’s httpd config | ||
| RUN sed -i 's|--rpm|--rpm -f --insecure|g' /etc/systemd/system/httpd.service.d/ood-portal.conf && \ | ||
| systemctl enable httpd ondemand-dex | ||
|
|
||
| # Create dev user | ||
| RUN useradd jesse && chmod 600 /etc/shadow && \ | ||
| echo 'jesse:password' | chpasswd | ||
|
|
||
| # ========================= | ||
| # Stage 2: wheels (cached Python deps) | ||
| # ========================= | ||
| FROM rockylinux/rockylinux:9 AS builder | ||
| RUN dnf install -y python3 python3-pip gcc libffi-devel zlib-devel bzip2 bzip2-devel xz xz-devel | ||
| WORKDIR /wheels | ||
|
|
||
| RUN python3 -m pip install --upgrade pip wheel setuptools | ||
| RUN pip wheel jupyterlab==3.6.3 -w /wheels | ||
| RUN pip wheel jupyterlab==4.0.9 -w /wheels | ||
|
|
||
| # ========================= | ||
| # Stage 3: apps layer | ||
| # ========================= | ||
| FROM base AS apps | ||
|
|
||
| # Bring in built wheels | ||
| COPY --from=builder /wheels /tmp/wheels | ||
|
|
||
| # Install into isolated venvs using wheels (no re-download) | ||
| RUN python3 -m venv /opt/apps/jupyter/3.6.3 && \ | ||
| /opt/apps/jupyter/3.6.3/bin/pip install --no-index --find-links /tmp/wheels jupyterlab==3.6.3 && \ | ||
| python3 -m venv /opt/apps/jupyter/4.0.9 && \ | ||
| /opt/apps/jupyter/4.0.9/bin/pip install --no-index --find-links /tmp/wheels jupyterlab==4.0.9 | ||
|
|
||
| # Modulefiles for Lmod | ||
| COPY files/modulefiles /opt/modulefiles | ||
|
|
||
| # Smoke test modules | ||
| RUN bash -lc 'module use /opt/modulefiles && \ | ||
| module load jupyter/3.6.3 && jupyter-lab --version && \ | ||
| module swap jupyter/4.0.9 && jupyter-lab --version' | ||
|
|
||
| RUN sed -i 's|--rpm|--rpm -f --insecure|g' /etc/systemd/system/httpd.service.d/ood-portal.conf | ||
| RUN systemctl enable httpd ondemand-dex | ||
| # Generate spider JSON for OOD auto_modules | ||
| RUN bash -lc 'module use /opt/modulefiles && \ | ||
| tmp=$(mktemp) && \ | ||
| $LMOD_DIR/spider -o spider-json "$MODULEPATH" > "$tmp" && \ | ||
| mkdir -p /etc/ood/config/modules && \ | ||
| mv "$tmp" /etc/ood/config/modules/localhost.json && \ | ||
| chmod 644 /etc/ood/config/modules/localhost.json && \ | ||
| chmod 755 /etc/ood/config/modules' | ||
|
|
||
| RUN useradd jesse | ||
| RUN chmod 600 /etc/shadow | ||
| # ========================= | ||
| # Stage 4: final image (volatile files last) | ||
| # ========================= | ||
| FROM apps | ||
|
|
||
| # Put frequently changed configs at the end so edits don’t bust cache | ||
| COPY files/ood_portal.yml /etc/ood/config/ood_portal.yml | ||
| COPY files/clusters.d /etc/ood/config/clusters.d | ||
| COPY files/apps /var/www/ood/apps/sys/ | ||
| COPY files/config /etc/ood/config/apps/ | ||
| COPY files/motd.md /etc/motd.md | ||
|
|
||
| CMD [ "/sbin/init" ] | ||
| CMD ["/sbin/init"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,13 @@ | ||
| cluster: localhost | ||
|
|
||
| --- | ||
| cluster: "localhost" | ||
|
|
||
| form: | ||
| - bc_num_hours | ||
| - auto_modules_jupyter | ||
|
|
||
| attributes: | ||
| auto_modules_jupyter: | ||
| widget: "select" | ||
| label: "Jupyter Version" | ||
| help: "Select which JupyterLab module to load" | ||
| default: false |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| # Job submission configuration file | ||
| # | ||
| --- | ||
| batch_connect: | ||
| template: "basic" | ||
|
|
||
| script: | ||
| native: | ||
| - "--ntasks=1" | ||
|
Comment on lines
+4
to
+7
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't have any affect on the |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # Wait for the Jupyter server to start | ||
| echo "Waiting for Jupyter server to open port ${port}..." | ||
| if wait_until_port_used "${host}:${port}" 600; then | ||
| echo "Discovered Jupyter server listening on port ${port}!" | ||
| else | ||
| echo "Timed out waiting for Jupyter server to open port ${port}!" | ||
| clean_up 1 | ||
| fi | ||
| sleep 2 | ||
|
|
||
| # Write connection.yml so OOD can display the session | ||
| ( | ||
| umask 077 | ||
| cat > connection.yml << EOL | ||
| --- | ||
| host: "${host}" | ||
| port: "${port}" | ||
| password: "${password}" | ||
| EOL | ||
| ) | ||
|
Comment on lines
+11
to
+20
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be done automatically by our wrapper scripts. Did it not work for you automatically? |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,3 +56,13 @@ c.NotebookApp.notebook_dir = '${HOME}' | |
| c.NotebookApp.disable_check_xsrf = True | ||
| EOL | ||
| ) | ||
|
|
||
| if [ -f /usr/share/lmod/lmod/init/bash ]; then | ||
| source /usr/share/lmod/lmod/init/bash | ||
| fi | ||
|
|
||
| module purge | ||
| module use /opt/modulefiles | ||
|
Comment on lines
+59
to
+65
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think instead of the |
||
| module load <%= context.auto_modules_jupyter %> | ||
|
|
||
| which jupyter || echo "Jupyter not found!" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,3 +5,6 @@ v2: | |
| host: localhost | ||
| metadata: | ||
| title: Localhost | ||
| batch_connect: | ||
| basic: | ||
| module_file_dir: "/etc/ood/config/modules" | ||
|
Comment on lines
+8
to
+10
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This does not have any affect. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,4 @@ | ||
| MOTD_PATH=/etc/motd.md | ||
| MOTD_FORMAT='markdown' | ||
| MOTD_FORMAT='markdown' | ||
| OOD_BC_DYNAMIC_JS=TRUE | ||
| OOD_MODULE_FILE_DIR=/etc/ood/config/modules |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Try not to add unnecessary file modifications like the ones in this file. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| help([[ | ||
| JupyterLab 3.6.3 | ||
| ]]) | ||
| whatis("Name: JupyterLab") | ||
| whatis("Version: 3.6.3") | ||
| family("jupyter") | ||
|
|
||
| local root = "/opt/apps/jupyter/3.6.3" | ||
| prepend_path("PATH", pathJoin(root, "bin")) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| help([[ | ||
| JupyterLab 4.0.9 | ||
| ]]) | ||
| whatis("Name: JupyterLab") | ||
| whatis("Version: 4.0.9") | ||
| family("jupyter") | ||
|
|
||
| local root = "/opt/apps/jupyter/4.0.9" | ||
| prepend_path("PATH", pathJoin(root, "bin")) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,4 +41,4 @@ def build_cmd | |
| else | ||
| docker_build_cmd | ||
| end | ||
| end | ||
| end | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just write directly into
/etc/ood/config/modules/localhost.json?