Skip to content

Extend OOD application catalogue #738

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions ansible/portal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,39 @@
name: openondemand
tasks_from: jupyter_compute.yml
when: appliances_mode != 'configure' # is run during build

- hosts: openondemand_rstudio
tags:
- openondemand
- openondemand_rstudio
become: yes
gather_facts: yes
tasks:
- import_role:
name: openondemand
tasks_from: rstudio_compute.yml
when: appliances_mode != 'configure' # is run during build

- hosts: openondemand_matlab
tags:
- openondemand
- openondemand_matlab
become: yes
gather_facts: yes
tasks:
- import_role:
name: openondemand
tasks_from: vnc_compute.yml
when: appliances_mode != 'configure' # is run during build

- hosts: openondemand_codeserver
tags:
- openondemand
- openondemand_codeserver
become: yes
gather_facts: yes
tasks:
- import_role:
name: openondemand
tasks_from: codeserver_compute.yml
when: appliances_mode != 'configure' # is run during build
3 changes: 3 additions & 0 deletions ansible/roles/openondemand/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ openondemand_desktop_screensaver: false
openondemand_filesapp_paths: []
openondemand_jupyter_partition: ''
openondemand_dashboard_links: []
openondemand_rstudio_partition: ''
openondemand_matlab_partition: ''
openondemand_codeserver_partition: ''

# Monitoring:
openondemand_exporter: true
Expand Down
18 changes: 18 additions & 0 deletions ansible/roles/openondemand/tasks/codeserver_compute.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
- name: Download code-server binary
get_url:
url: "https://github.com/coder/code-server/releases/download/v4.22.1/code-server-4.22.1-linux-amd64.tar.gz"
dest: "/tmp/code-server.tar.gz"
mode: '0644'

- name: Extract code-server binary
unarchive:
src: "/tmp/code-server.tar.gz"
dest: "/opt/"
remote_src: yes

- name: Symlink code-server to /usr/local/bin
file:
src: "/opt/code-server-4.22.1-linux-amd64/bin/code-server"
dest: "/usr/local/bin/code-server"
state: link
force: yes
27 changes: 27 additions & 0 deletions ansible/roles/openondemand/tasks/rstudio_compute.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Should be run on compute nodes you want to run RStudio on
# See https://osc.github.io/ood-documentation/latest/tutorials/tutorials-interactive-apps/add-rstudio.html
# - Will already have lmod

- name: Install EPEL and dependencies
ansible.builtin.yum:
name:
- epel-release
- R
state: present

- name: Download RStudio Server RPM
ansible.builtin.get_url:
url: https://download2.rstudio.org/server/centos8/x86_64/rstudio-server-rhel-2023.12.1-402-x86_64.rpm
dest: /tmp/rstudio-server.rpm
mode: '0644'

- name: Install RStudio Server
ansible.builtin.yum:
name: /tmp/rstudio-server.rpm
state: present

- name: Ensure rstudio-server service is disabled and stopped
ansible.builtin.service:
name: rstudio-server
enabled: false
state: stopped
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
openondemand_auth: basic_pam
openondemand_jupyter_partition: standard
openondemand_desktop_partition: standard
openondemand_rstudio_partition: standard
openondemand_matlab_partition: standard
openondemand_codeserver_partition: standard
#openondemand_dashboard_support_url:
#openondemand_dashboard_docs_url:
#openondemand_filesapp_paths:
147 changes: 141 additions & 6 deletions environments/common/inventory/group_vars/all/openondemand.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ openondemand_auth: basic_pam

openondemand_jupyter_partition: "{{ openhpc_partitions[0]['name'] }}"
openondemand_desktop_partition: "{{ openhpc_partitions[0]['name'] }}"
openondemand_rstudio_partition: "{{ openhpc_partitions[0]['name'] }}"
openondemand_matlab_partition: "{{ openhpc_partitions[0]['name'] }}"
openondemand_codeserver_partition: "{{ openhpc_partitions[0]['name'] }}"

# Regex defining hosts which openondemand can proxy; the default regex is compute nodes (for apps) and grafana host,
# e.g. if the group `compute` has hosts `compute-{0,1,2,..}` this will be '(compute-\d+)|(control)'.
Expand Down Expand Up @@ -47,8 +50,6 @@ openondemand_clusters:
basic:
script_wrapper: |
module purge
export PATH=/opt/jupyter-py39/bin/:$PATH
%s
set_host: host=$(hostname -s)
vnc:
script_wrapper: |
Expand Down Expand Up @@ -83,13 +84,31 @@ openondemand_clusters_grafana:
jobid: "jobid"

# define installation of openondemand apps (see openondemand_apps_* below for configuration):
openondemand_install_apps_default:
openondemand_install_app_jupyter:
jupyter:
repo: https://github.com/OSC/bc_example_jupyter.git
version: master # defaults (optional)
openondemand_install_apps_extra: {} # mapping, values as for ansible.builtin.git: repo (required)/dest/version(default main)/umask
openondemand_install_app_rstudio: # mapping, values as for ansible.builtin.git: repo (required)/dest/version(default main)/umask
rstudio:
repo: https://github.com/stackhpc/ood-stackhpc-rstudio.git
version: main
openondemand_install_app_matlab:
matlab:
repo: https://github.com/stackhpc/ood-stackhpc-matlab.git
version: main
openondemand_install_app_codeserver:
codeserver:
repo: https://github.com/stackhpc/bc_osc_codeserver.git
version: main
# osc:ood role var (NB only active when not in configure):
ood_install_apps: "{{ openondemand_install_apps_default if openondemand_jupyter_partition | default(none) else {} | combine(openondemand_install_apps_extra) }}"
ood_install_apps: >-
{{
{}
| combine(openondemand_install_app_jupyter if openondemand_jupyter_partition else {})
| combine(openondemand_install_app_rstudio if openondemand_rstudio_partition else {})
| combine(openondemand_install_app_matlab if openondemand_matlab_partition else {})
| combine(openondemand_install_app_codeserver if openondemand_codeserver_partition else {})
}}

# https://github.com/OSC/ondemand/tree/master/apps/bc_desktop
# also https://osc.github.io/ood-documentation/latest/enable-desktops/custom-job-submission.html#enable-desktops-custom-job-submission
Expand Down Expand Up @@ -151,6 +170,10 @@ openondemand_apps_jupyter_default:
---
batch_connect:
template: "basic"
script_wrapper: |
module purge
export PATH=/opt/jupyter-py39/bin/:$PATH
%s
script:
job_name: "ood-jupyter"
native:
Expand All @@ -159,6 +182,110 @@ openondemand_apps_jupyter_default:
- <%= "--nodelist=#{node}" %>
openondemand_apps_jupyter: "{{ {'jupyter':openondemand_apps_jupyter_default} if openondemand_jupyter_partition | default(none) else {} }}"

openondemand_apps_rstudio_default:
title: RStudio
description: Request a RStudio server
cluster: slurm
form:
- bc_queue
- rstudio_module
- bc_num_hours
- num_cores
- node
attributes:
num_cores:
label: Number of cores FOO
value: 1
bc_queue:
value: "{{ openondemand_rstudio_partition | default(none) }}"
node: ""
rstudio_module:
label: RStudio module
required: true
cachable: true
help: Choose your RStudio module - 2023.09 is only for el8 partitions
widget: select
options:
- ["RStudio-Server/2022.07.2+576-foss-2022a-Java-11-R-4.2.1", "RStudio-Server/2022.07.2+576-foss-2022a-Java-11-R-4.2.1"]
- ["RStudio-Server/1.4.1717-foss-2021a-Java-11-R-4.1.0", "RStudio-Server/1.4.1717-foss-2021a-Java-11-R-4.1.0"]
- ["RStudio-Server/2023.09.1+494-foss-2023a-Java-11-R-4.3.2", "RStudio-Server/2023.09.1+494-foss-2023a-Java-11-R-4.3.2"]
submit: |
---
batch_connect:
template: "basic"
conn_params:
- csrf_token
script:
job_name: "ood-rstudio"
native:
- <%= "--nodes=1" %>
- <%= "--ntasks=#{num_cores}" %>
- <%= "--nodelist=#{node}" %>
openondemand_apps_rstudio: "{{ {'rstudio':openondemand_apps_rstudio_default} if openondemand_rstudio_partition | default(none) else {} }}"

openondemand_apps_matlab_default:
title: MATLAB
description: Request a desktop to run MATLAB.
cluster: slurm
form:
- desktop
- bc_queue
- bc_num_hours
- num_cores
- node
attributes:
desktop: xfce
# bc_account: # i.e. slurm account
# value: root
bc_queue:
value: "{{ openondemand_matlab_partition | default(none) }}"
num_cores:
label: Number of cores
value: 1
node:
label: Node name
help: Select a particular node or leave empty to let Slurm pick the next available
value: ""
submit: |
---
script:
job_name: "ood-matlab"
native:
- <%= "--nodes=1" %>
- <%= "--ntasks=#{num_cores}" %>
- <%= "--nodelist=#{node}" %>
openondemand_apps_matlab: "{{ {'matlab':openondemand_apps_matlab_default} if openondemand_matlab_partition | default(none) else {} }}"

openondemand_apps_codeserver_default:
title: Codeserver
description: Request a Codeserver
cluster: slurm
form:
- bc_queue
- bc_num_hours
- num_cores
- node
attributes: # TODO
num_cores:
label: Number of cores FOO
value: 1
bc_queue:
value: "{{ openondemand_codeserver_partition | default(none) }}"
node: ""
submit: |
---
batch_connect:
template: "basic"
conn_params:
- code_server_version
script:
job_name: "ood-codeserver"
native:
- <%= "--nodes=1" %>
- <%= "--ntasks=#{num_cores}" %>
- <%= "--nodelist=#{node}" %>
openondemand_apps_codeserver: "{{ {'codeserver':openondemand_apps_codeserver_default} if openondemand_codeserver_partition | default(none) else {} }}"

# osc.ood:ood_apps - see https://github.com/OSC/ood-ansible#ood_apps
openondemand_dashboard_support_url: ''
openondemand_dashboard_docs_url: ''
Expand All @@ -178,7 +305,15 @@ openondemand_apps:
ood_brand_bg_color: "#0e6ec8"
ood_dashboard_title: "{{ openhpc_cluster_name }}"

ood_apps: "{{ openondemand_apps | combine(openondemand_apps_jupyter) | combine(openondemand_apps_desktop) }}"
ood_apps: >-
{{
openondemand_apps
| combine(openondemand_apps_jupyter)
| combine(openondemand_apps_desktop)
| combine(openondemand_apps_rstudio)
| combine(openondemand_apps_matlab)
| combine(openondemand_apps_codeserver)
}}

# Prometheus config for Open Ondemand exporter
# https://osc.github.io/ood-documentation/latest/monitoring/prometheus.html#prometheus-configuration
Expand Down
9 changes: 9 additions & 0 deletions environments/common/inventory/groups
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ fail2ban
[openondemand_jupyter]
# Subset of compute to run a Jupyter Notebook servers on via Open Ondemand

[openondemand_rstudio]
# Subset of compute to run RStudio servers on via Open Ondemand

[openondemand_matlab]
# Subset of compute to run RStudio servers on via Open Ondemand

[openondemand_codeserver]
# Subset of compute to run a Codeserver VSCode instance on via Open Ondemand

[etc_hosts]
# Hosts to manage /etc/hosts e.g. if no internal DNS. See ansible/roles/etc_hosts/README.md

Expand Down
12 changes: 12 additions & 0 deletions environments/common/layouts/everything
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ compute
# Subset of compute to run a Jupyter Notebook servers on via Open Ondemand
compute

[openondemand_rstudio:children]
# Subset of compute to run RStudio servers on via Open Ondemand
compute

[openondemand_matlab:children]
# Subset of compute to run a MATLAB interactive desktop on via Open Ondemand
compute

[openondemand_codeserver:children]
# Subset of compute to run a Codeserver VSCode instance on via Open Ondemand
compute

[etc_hosts:children]
# Hosts to manage /etc/hosts e.g. if no internal DNS. See ansible/roles/etc_hosts/README.md
cluster
Expand Down
Loading