-
Notifications
You must be signed in to change notification settings - Fork 66
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
support variable volume list #88
Comments
This is already possible. When ShinyProxy parses a list that support SpEL, it will ignore any value that is either empty or is an empty list. For example, the following will be parsed to just a single value: container-volumes:
- null
- []
- "/tmp/test:/tmp/test" In addition, ShinyProxy allow to have nested lists (but only one level). Both parsing features make it possible to achieve your scenario:
I'm aware that these specific features are not fully documented on the website, I'll update it soon. |
Thanks ! Definitely I understand this covers my first point. Not sure on the second point which is about dealing with projects (ie: This one will produce at most 2 volumes: container-volumes:
- "#{true == true ? '/tmp/test:/tmp/test' : null}"
- "#{true == false ? '/tmp/abc:/tmp/abc' : null}" I d'like to be able to generate a list of volume from a spel: container-volumes: #{spel-syntax-to-dynamically-produce-a-list} would expand into 0 to n volumes according to the groups spel result. This would be fine for volumes, but also for any primitive list such as parameters:
definitions:
- id: project
display-name: Data project
description: The project you belong to
value-sets:
- values:
project: "#{groups.^[#this.substring(0,6) == 'PROJECT_'].toLowerCase()}"
access-control:
groups: "#{groups.^[#this.substring(0,6) == 'PROJECT_'].toLowerCase()}" |
Hi, what you are trying to achieve is already possible. ShinyProxy already flattens nested lists and SpEL Collection Projection allows you to "loop" over a list (https://docs.spring.io/spring-framework/reference/core/expressions/language-ref/collection-projection.html), therefore you can do something like: users:
- name: jack
password: password
groups:
- test1
- test2
- test3
- test
specs:
- id: rstudio
container-image: openanalytics/shinyproxy-rstudio-ide-demo:2023.06.0_421__4.3.1
container-volumes: "#{groups.!['/tmp/volumes/' + #this.toLowerCase() + ':' + '/volumes/' + #this.toLowerCase()]}"
container-env:
DISABLE_AUTH: true
WWW_ROOT_PATH: "#{proxy.getRuntimeValue('SHINYPROXY_PUBLIC_PATH')}"
port: 8787 Once launches it will have the following volumes: root@afeaced47587:~# ls -l /volumes/
total 0
drwxr-xr-x 2 root root 40 Oct 28 15:35 test1
drwxr-xr-x 2 root root 40 Oct 28 15:35 test2
drwxr-xr-x 2 root root 40 Oct 28 15:35 test3
drwxr-xr-x 2 root root 40 Oct 28 15:35 test4 And as mentioned in my previous post, you can even have multiple of these lists: container-volumes:
- "#{groups.!['/tmp/volumes/' + #this.toLowerCase() + ':' + '/volumes/' + #this.toLowerCase()]}"
- "#{groups.!['/tmp/volumes/' + #this.toLowerCase() + ':' + '/volumes2/' + #this.toLowerCase()]}" root@857cf7bd9277:/# ls -l /volumes
total 0
drwxr-xr-x 2 root root 40 Oct 28 15:35 test1
drwxr-xr-x 2 root root 40 Oct 28 15:35 test2
drwxr-xr-x 2 root root 40 Oct 28 15:35 test3
drwxr-xr-x 2 root root 40 Oct 28 15:35 test4
root@857cf7bd9277:/# ls -l /volumes2/
total 0
drwxr-xr-x 2 root root 40 Oct 28 15:35 test1
drwxr-xr-x 2 root root 40 Oct 28 15:35 test2
drwxr-xr-x 2 root root 40 Oct 28 15:35 test3
drwxr-xr-x 2 root root 40 Oct 28 15:35 test4 |
Currently Spel and env variables allows to dynamically generate the content of a given string element.
We need more complex scenario such as :
As for 2. We would mount one volume per group. Let's say user has groups [project1, project2] then we would mount both [/data/project1, /data/priject2]
Glad to contributeon this.
The text was updated successfully, but these errors were encountered: