Skip to content

Commit 741d0da

Browse files
committed
add and configure VSCode OOD app
1 parent 4d1f816 commit 741d0da

File tree

7 files changed

+84
-1
lines changed

7 files changed

+84
-1
lines changed

ansible/portal.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,16 @@
5959
- import_role:
6060
name: openondemand
6161
tasks_from: vnc_compute.yml
62+
when: appliances_mode != 'configure' # is run during build
63+
64+
- hosts: openondemand_codeserver
65+
tags:
66+
- openondemand
67+
- openondemand_codeserver
68+
become: yes
69+
gather_facts: yes
70+
tasks:
71+
- import_role:
72+
name: openondemand
73+
tasks_from: codeserver_compute.yml
6274
when: appliances_mode != 'configure' # is run during build

ansible/roles/openondemand/defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ openondemand_jupyter_partition: ''
2626
openondemand_dashboard_links: []
2727
openondemand_rstudio_partition: ''
2828
openondemand_matlab_partition: ''
29+
openondemand_codeserver_partition: ''
2930

3031
# Monitoring:
3132
openondemand_exporter: true
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
- name: Download code-server binary
2+
get_url:
3+
url: "https://github.com/coder/code-server/releases/download/v4.22.1/code-server-4.22.1-linux-amd64.tar.gz"
4+
dest: "/tmp/code-server.tar.gz"
5+
mode: '0644'
6+
7+
- name: Extract code-server binary
8+
unarchive:
9+
src: "/tmp/code-server.tar.gz"
10+
dest: "/opt/"
11+
remote_src: yes
12+
13+
- name: Symlink code-server to /usr/local/bin
14+
file:
15+
src: "/opt/code-server-4.22.1-linux-amd64/bin/code-server"
16+
dest: "/usr/local/bin/code-server"
17+
state: link
18+
force: yes

environments/.stackhpc/inventory/group_vars/all/openondemand.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ openondemand_jupyter_partition: standard
33
openondemand_desktop_partition: standard
44
openondemand_rstudio_partition: standard
55
openondemand_matlab_partition: standard
6+
openondemand_codeserver_partition: standard
67
#openondemand_dashboard_support_url:
78
#openondemand_dashboard_docs_url:
89
#openondemand_filesapp_paths:

environments/common/inventory/group_vars/all/openondemand.yml

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ openondemand_jupyter_partition: "{{ openhpc_partitions[0]['name'] }}"
1616
openondemand_desktop_partition: "{{ openhpc_partitions[0]['name'] }}"
1717
openondemand_rstudio_partition: "{{ openhpc_partitions[0]['name'] }}"
1818
openondemand_matlab_partition: "{{ openhpc_partitions[0]['name'] }}"
19+
openondemand_codeserver_partition: "{{ openhpc_partitions[0]['name'] }}"
1920

2021
# Regex defining hosts which openondemand can proxy; the default regex is compute nodes (for apps) and grafana host,
2122
# e.g. if the group `compute` has hosts `compute-{0,1,2,..}` this will be '(compute-\d+)|(control)'.
@@ -95,13 +96,18 @@ openondemand_install_app_matlab:
9596
matlab:
9697
repo: https://github.com/stackhpc/ood-stackhpc-matlab.git
9798
version: main
99+
openondemand_install_app_codeserver:
100+
codeserver:
101+
repo: https://github.com/stackhpc/bc_osc_codeserver.git
102+
version: main
98103
# osc:ood role var (NB only active when not in configure):
99104
ood_install_apps: >-
100105
{{
101106
{}
102107
| combine(openondemand_install_app_jupyter if openondemand_jupyter_partition else {})
103108
| combine(openondemand_install_app_rstudio if openondemand_rstudio_partition else {})
104109
| combine(openondemand_install_app_matlab if openondemand_matlab_partition else {})
110+
| combine(openondemand_install_app_codeserver if openondemand_codeserver_partition else {})
105111
}}
106112
107113
# https://github.com/OSC/ondemand/tree/master/apps/bc_desktop
@@ -250,6 +256,36 @@ openondemand_apps_matlab_default:
250256
- <%= "--nodelist=#{node}" %>
251257
openondemand_apps_matlab: "{{ {'matlab':openondemand_apps_matlab_default} if openondemand_matlab_partition | default(none) else {} }}"
252258

259+
openondemand_apps_codeserver_default:
260+
title: Codeserver
261+
description: Request a Codeserver
262+
cluster: slurm
263+
form:
264+
- bc_queue
265+
- bc_num_hours
266+
- num_cores
267+
- node
268+
attributes: # TODO
269+
num_cores:
270+
label: Number of cores FOO
271+
value: 1
272+
bc_queue:
273+
value: "{{ openondemand_codeserver_partition | default(none) }}"
274+
node: ""
275+
submit: |
276+
---
277+
batch_connect:
278+
template: "basic"
279+
conn_params:
280+
- code_server_version
281+
script:
282+
job_name: "ood-codeserver"
283+
native:
284+
- <%= "--nodes=1" %>
285+
- <%= "--ntasks=#{num_cores}" %>
286+
- <%= "--nodelist=#{node}" %>
287+
openondemand_apps_codeserver: "{{ {'codeserver':openondemand_apps_codeserver_default} if openondemand_codeserver_partition | default(none) else {} }}"
288+
253289
# osc.ood:ood_apps - see https://github.com/OSC/ood-ansible#ood_apps
254290
openondemand_dashboard_support_url: ''
255291
openondemand_dashboard_docs_url: ''
@@ -269,7 +305,15 @@ openondemand_apps:
269305
ood_brand_bg_color: "#0e6ec8"
270306
ood_dashboard_title: "{{ openhpc_cluster_name }}"
271307

272-
ood_apps: "{{ openondemand_apps | combine(openondemand_apps_jupyter) | combine(openondemand_apps_desktop) | combine(openondemand_apps_rstudio) | combine(openondemand_apps_matlab) }}"
308+
ood_apps: >-
309+
{{
310+
openondemand_apps
311+
| combine(openondemand_apps_jupyter)
312+
| combine(openondemand_apps_desktop)
313+
| combine(openondemand_apps_rstudio)
314+
| combine(openondemand_apps_matlab)
315+
| combine(openondemand_apps_codeserver)
316+
}}
273317
274318
# Prometheus config for Open Ondemand exporter
275319
# https://osc.github.io/ood-documentation/latest/monitoring/prometheus.html#prometheus-configuration

environments/common/inventory/groups

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ fail2ban
9494
[openondemand_matlab]
9595
# Subset of compute to run RStudio servers on via Open Ondemand
9696

97+
[openondemand_codeserver]
98+
# Subset of compute to run a Codeserver VSCode instance on via Open Ondemand
99+
97100
[etc_hosts]
98101
# Hosts to manage /etc/hosts e.g. if no internal DNS. See ansible/roles/etc_hosts/README.md
99102

environments/common/layouts/everything

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ compute
6363
# Subset of compute to run a MATLAB interactive desktop on via Open Ondemand
6464
compute
6565

66+
[openondemand_codeserver:children]
67+
# Subset of compute to run a Codeserver VSCode instance on via Open Ondemand
68+
compute
69+
6670
[etc_hosts:children]
6771
# Hosts to manage /etc/hosts e.g. if no internal DNS. See ansible/roles/etc_hosts/README.md
6872
cluster

0 commit comments

Comments
 (0)