How to configure FastRWeb to use the built-in RServer web server

I am new to RServe (and FastRWeb). I installed RServe 1.7.0 as I want to use its integrated web server. Since I already have apache on this machine, I want to run RServe / FastRWeb on a user port.

I did cd /usr/local/lib/R/site-library/FastRWeb;sudo ./install.sh , which created the / var / FastRWeb / directory tree.

I do not see the configuration file mentioning the port. The default value /var/FastRWeb/code/rserve.conf looks like this:

 socket /var/FastRWeb/socket sockmod 0666 source /var/FastRWeb/code/rserve.R control enable 

I assume it uses unix sockets by default? Therefore, I think that my question is what exactly do I need to put (and delete from) this file in order to, say, listen to it through TCP port 8888? And is there anything else I need to do? (I want to be able to connect to other machines, not just local hosts.)

Maybe I am associated with /var/FastRWeb/web/index.html and contains javascript that will connect to /cgi-bin/R/ . Is this path specific to using Apache, or will it be fine as it is when using RServe?

+4
source share
2 answers

The Rserve 1.7.0 post has an explanation of the port setup. So at the top of rserve.conf I added this line: http.port 8888 Then I used the start script (as root user) to run it.

This got me halfway, as http://127.0.0.1:8888/ works now, but gives me a page that says:

 Error in try(.http.request("/", NULL, NULL, c(48, 6f, 73, 74, 3a, 20, : could not find function ".http.request" 

The second half of the solution is to add this to the beginning of /var/FastRWeb/code/rserve.R:

 library(FastRWeb) .http.request <- FastRWeb:::.http.request 

Then run everything by running /var/FastRWeb/code/start . There is no default handler, so you can check it with http://127.0.0.1:8888/info . Or a more interesting example is http://127.0.0.1:8888/example1.png (for viewing a chart) or http://127.0.0.1:8888/example2 (for viewing a combination of html and a chart).

Note. I did not delete or edit any other configuration to make this work. This means that we also have listening to unix sockets. If this is not required, delete these two lines from the Rserve.conf file.

If you want it to listen on all IP addresses, not just localhost, add remote enable to your Rserve.conf file. NOTE. . Before you open a server in the world, make sure that you understand the security implications.

So, after these two changes, my /var/FastRWeb/code/Rserve.conf file looks like this:

 http.port 8888 remote enable source /var/FastRWeb/code/rserve.R control enable 
+7
source

Have you seen Jay Emerson's review from abroad on how to use RServe as a backend for website driven analysis? As far as I remember, Apache is still used for redirection, not an explicit port, as you assume.

Jay setup was very impressive. He used Rserve to provide mixed tabular / graphical pages written in a mesh package, all very fast and very fast, based on a huge dataset (from a UN agency or the World Bank or something else). But I can’t find a link to this report right now ...

+1
source

Source: https://habr.com/ru/post/1479130/


All Articles