Accessing app working directory, and other arbitrary fields

I have two things I’d like to do with my interactive app. The first is to be able to work out the working directory of the running app, so that I can link to the output.log from the view.html. I had a look at the variables and environment variables available in the .erb but couldn’t work out how to do that. There was some sort of path prefix variable but without the OnDemand job ID I couldn’t construct a full path. Also, the process working directory in Ruby seemed to be the OnDemand installation root somewhere in /var.

The second thing I want to do is have a sort of app config file so that I can write one code base for the app, but allow different sites to configure it without needing to edit my source code. So the natural thing to do is have a conf.yml that lives in the app, and then each of the .erb files would read from that config file. The reason I want configuration to live in a config file and not in the form.yml is because I don’t want to ask end users stuff like what the cluster name is, and what the appropriate partition is for this app, rather I want to the cluster admins to work this out and create the config file when they deploy the app, insulating the end users from some of this complexity. However, because of the working directory issue above, I can’t read a config file. Is there some other way to have some arbitrary fields that are available within the Ruby context?

Hi thanks for the post and questions.

For getting access to the dataroot you may want to look at the ood_appkit as it provides some utility functions around configuration options:

The system apps will run out of /var/www/ood/apps/sys/.

For the second part of the question, I’m a bit confused. Are you trying to let users deploy system apps on their own and remove the need to setup some of the configuration like the cluster? I’m not sure if that can work given you will need to have privilige escalation to deploy an app for the system when you move it to the /var/www/ood/apps/sys location.

Also, if you are saying you don’t want the form to ask users these things, you should look at the docs. We provide ways to obfuscate and hard set certain fields in the form.yml if you want to hide those details.

You can hard-code things like the clusters:

Or you can use some code to get options for the user and present them like what you see with the groups in the bc_osc_jupyter app:

Also notice in that app the cluster is set to simply present those choices in a select dropdown. Do any of those options get at what you are trying to accomplish?

From my side, I’m a bit confused on the idea of the end user doing any configuration, the software’s feature set shouldn’t make that necessary, and you the admin have a lot of control as to what is shown, set, and automatically generated in the app config files using ERB and some of the methods above.

Have you read the docs on app deployment and any of the tutorials? Walking through one might help you see some of the ways this is done.