ContainerSpecs
Quid?
ContainerSpecs are configuration blocks that specify one container each.
They are grouped under a ProxySpec, and are usually listed in the application.yml
config file, e.g.:
proxy: specs: - id: r-3.4.4 container-specs: - image: "registry.openanalytics.eu/private/rconsoleproxy" port-mapping: default: 8081 help: 8080 runtime-setting-specs: - name: container.volumes
Note: ShinyProxy uses a custom, simplified notation, under the assumption that Shiny apps only use a single container:
proxy: specs: - id: 01_hello display-name: Hello Application description: Application which demonstrates the basics of a Shiny app container-image: openanalytics/shinyproxy-demo container-cmd: ["R", "-e shinyproxy::run_01_hello()"]
ProxySpecs and ContainerSpecs may also be provided at runtime, via the body of a POST request.
Note: ShinyProxy does not allow specs to be provided at runtime. Only specs from the application.yml
file are accepted.
Expressions
ContainerSpecs support Spring Expressions (SpEL, see also https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#expressions). This means that spec values may contain expressions, such as:
proxy: specs: - id: r-3.4.4 container-specs: - image: "registry.openanalytics.eu/private/rconsoleproxy" volumes: [ "/home/#{proxy.userId}/myworkspace:/var/myworkspace" ]
This can be used for various purposes, including dynamic volume mounting.
Expressions are resolved against a context which currently contains 3 objects:
- containerSpec: the ContainerSpec object containing the expression
- proxySpec: the parent ProxySpec of the ContainerSpec
- proxy: the runtime proxy. Note that the proxy's fields may be incomplete, as the expression is resolved during the startup of the proxy.
All ContainerSpec fields support expressions, except for:
env
: in theenv
setting, a map of name-value pairs may be given. The value may contain an expression, but not the name.port-mapping
privileged
Besides the 3 objects mentioned above, expressions may refer to many other things, including Spring beans:
proxy: specs: - id: r-3.4.4 container-specs: - image: "registry.openanalytics.eu/private/rconsoleproxy" volumes: [ "/home/#{@UserService.currentUserId}/myworkspace:/var/myworkspace" ]