How do I start / stop / reset OpenCPU on CentOS6?

I have successfully created and installed OpenCPU and RStudio Server on CentOS6. Everything works as expected and I get successful GET / POST responses for my local R packages.

A couple of things that don't seem to work:

  • I cannot figure out a clean way to start / stop / reset OpenCPU. I'm currently using apachectl restart

    , but I'm not even sure what is reloading R packages as expected. I tried the Jeroen bash scripts in /usr/lib/opencpu/scripts

    , but they seem to require quite a bit of tweaking to work on CentOS.
  • (possibly related to this above) I am using load()

    and readRDS()

    in file /etc/opencpu/Renviron

    (also tried in /etc/opencpu/Rprofile

    ) to load persistent datasets into the global environment - but that doesn't seem to work, I don't get any error log, but objects are not available in subsequent requests.
  • Ubuntu OpenCPU seems to be configured to run as user opencpu

    . On CentOS6 it works under root

    after installation. I would like to change this, but do not know how to do it.

Just wondering if anyone has had any success setting up OpenCPU on CentOS6.

Thanks a lot, --Mel.

+3


source to share


1 answer


Some answers

  • Starting sudo apachectl restart

    will result in a restart. There is currently no dedicated init or systemd script for opencpu included in rpm, but basically anything the script does on ubuntu is restarting apache and printing some messages to the terminal.

  • The file REnviron

    is for environment variables only. For custom code, you need to use RProfile

    . See also help . It may not be loading into the correct environment. Try: load(file, envir = globalenv(), verbose = TRUE)

    .

  • Note that the recommended way to store data is to put it in an R package, either as a lazyload, or sysdata.rda

    (see the R extensions entry ). You can then download or attach the package at startup, or better yet: formally import the dataset from the package containing your application or R functions.

  • Afaik, centos is running HTTP requests as user apache

    ? What makes you think opencpu is running as root? This is certainly not an intention. On CentOS, you sometimes need to fiddle with the SELinux httpd flags to get your applications to work, see also the rpm readme .



The rpm packages are a little more recent and less tested than debian, so if you have any problems or suggestions, open the github issue.

+2


source







All Articles