R Shiny Server custom R location


#1

Hi,

I have installed R Shiny using the instructions here ->
https://www.rstudio.com/products/shiny/download-server/

It is on CentOS7.

We have a custom R location using enviroment modules.

The Webserver comes up but nothing runs as it can find R in the standard locations.

I have tried altering the service file /etc/systemd/system/shiny-server.service as such ->

ExecStartPre=/usr/bin/bash -c 'source /etc/profile.d/modules.sh; source /etc/profile.d/z_hpc.sh; module load R/3.4.3; which R >> /var/log/shiny-server.log'

or

ExecStart=/usr/bin/bash -c 'source /etc/profile.d/modules.sh; source /etc/profile.d/z_hpc.sh; module load R/3.4.3; which R;/opt/shiny-server/bin/shiny-server --pidfile=/var/run/shiny-server.pid >> /var/log/shiny-server.log 2>&1'

And although the environment can see R before starting the server can still not see R.

Can I somehow direct R shiny to a non standard R install or do I need install from source ?

Thanks Roger


#2

What is the error report from shiny server process when it starts?
Can you confirm the user which is used to run R process (shiny by default) can run R from the custom location?
Rgds,
Peter


#3

Hi Peter, root is running I can change this.

I have partly fixed the problem by doing a softlink from /usr/bin/R to the custom R. But often things still fail as a list of libraries need to be loaded too.

Roger


#4

I've also tried setting up the Environment on the command line and running
/opt/shiny-server/bin/shiny-server --pidfile=/var/run/shiny-server.pid >> /var/log/shiny-server.log 2>&1

directly from the command line.

The error in the log is
Warning: Error in .rasterObjectFromFile: Cannot create RasterLayer object from this file; perhaps you need to install rgdal first
Stack trace (innermost first):

because R shiny has not got the Right environment.

Roger


#5

Im getting this in some of the logs which could be the issue

su: ignore --preserve-environment, it's mutually exclusive to --login.


#6

I have created a temporary fix for this by creating this file,

[root@ukvmlx-rshiny-01 log]# cat /usr/bin/R
#!/bin/bash
module load R/3.4.3
R $*

It would be good to know the correct solution.