Feature #868

Updated by Sebastien Jacquot almost 6 years ago

R cannot access internet if there is a proxy:
* during TXM installation (Linux + Mac OS X) -> R configuration
* during the "Check R packages" command. -> Rserve & R configuration

R proxy configuration depends on the Operating System:
* Windows: R uses the "--internet2" option
* Mac OS X/Linux: R uses the "http_proxy" environment variable

- For Windows: the "--internet2" option can be added automatically. see: http://cran.r-project.org/bin/windows/base/rw-FAQ.html#The-Internet-download-functions-fail_002e
- For Mac OS X and Linux, we have to test the "http_proxy" R env variable is used

Currently R and RServe options are not configured by TXM StatEngine preferences.
(For runtime proxy options see also commands: setInternet2(use=TRUE) and Sys.setenv(http_proxy="http://user:password@proxy.example.com:8080/" ))
(We may also use .Rprofile system ? MD: I would rather not do this)

*Setup: solution1* *Solution1* :
* Embed R in all setups and provide the exact libraries for this version of R -> solve R packages installation but not "Check R packages" command

*Setup: solution2*:
* Windows: run R with "--internet2" argument
* Debian/Ubuntu: R automatically uses the "http_proxy" which is normally generated by the network manager. It means there is nothing more to do than running R et install the packages as with direct connection. But we may still test if "http_proxy" exists and do "something" if the variable doesn't exist because the tests have only been made on Ubuntu.
* Mac OS X Mavericks: Network manager does not create "http_proxy" environment variable so we need to create it once. The proxies settings can be retrieved using "networksetup -getwebproxy <Network service>" then we can create the variable before running R with "export" or in R with Sys.setenv().

[SJ] It appears there is no easy cross-platform solution therefore the solution 1 seems to be the better one.

For TXM RCP we need to define if we want that R uses the operating system proxy/network configuration or the Eclipse RCP proxy/network configuration.
[SJ] I think the better feature would be to match the R network configuration to the Eclipse RCP network configuration. But it may be complex to implement, for example, changing the "Networking configuration" in RCP would run some R command as Sys.setenv("http_proxy=http://proxy.xxxxx.com").

*TXM RCP: solution1* :
Do not match the RCP configuration but the OS configuration
* Windows: see solution 1
* Debian/Ubuntu: see solution 1
* Mac OS X Mavericks: see solution 1

*TXM RCP: solution2* :
Match the R network configuration with the RCP network configuration
* add some proxy properties in TBX (http_proxy, http_port, http_user, http_password)
* at RCP startup load these preferences into TBX preferences before running R/RServe

At R first run:
* Windows: no solution at this moment
* Linux/Mac: run R with: R http_proxy="http_user:http_password@http_proxy:http_port"

At RCP network configuration preferences change:
* Windows: no solution at this moment
* Linux/Mac: call in R: Sys.setenv(http_proxy="http_user:http_password@http_proxy:http_port")