A Batch Connect app designed for OSC OnDemand that launches a Shiny App within an Owens batch job.
This Batch Connect app requires the following software be installed on the compute nodes that the batch job is intended to run on (NOT the OnDemand node):
- Shiny x.y.z+
- Lmod 6.0.1+ or any other
module purge
andmodule load <modules>
based CLI used to load appropriate environments within the batch job
Use git to clone this app and checkout the desired branch/version you want to use:
scl enable git19 -- git clone <repo>
cd <dir>
scl enable git19 -- git checkout <tag/branch>
You will not need to do anything beyond this as all necessary assets are installed. You will also not need to restart this app as it isn't a Passenger app.
To update the app you would:
cd <dir>
scl enable git19 -- git fetch
scl enable git19 -- git checkout <tag/branch>
Again, you do not need to restart the app as it isn't a Passenger app.
- Fork it ( https://github.com/OSC/bc_osc_example_shiny/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
- Uses CHPC's R (3.6.1) which has shiny installed
- To run a webserver, use an openresty container running nginx
- The script.sh that launches the OOD app creates a nginx config file and Shiny app launcher, then runs R with the launcher, followed by looking for the Unix socket created by the R's Shiny, thich then gets used by the nginx startup
- The user shiny app path is specified in the job specs' input box
Note that Shiny app can be also launched from the OOD's RStudio app by typing library('shiny') runApp("newdir") - where "newdir" is the directory where app.R resides
R libraries that are needed by the application need to either be installed centrally to CHPC's R libraries location, or to other shared directory location. The former approach risks potential version conflicts with other library dependencies (this is more of an issue in Python but is possible in R as well).
Best practice may be for the creator of the app to install all the dependencies to his/her home directory, and in the app modify the R library path (using the .libPaths function) to add this directory to it.