OpenCPU is a software system for embedded statistical computation and reproducible research. The server exposes a web API interfacing R, Latex and Pandoc. This API is used for example to integrate statistical functionality into systems, share and execute scripts or reports on centralized servers, and build R based "apps". The OpenCPU server can run either as a single-user server inside the interactive R session (for local use and development), or as a cloud server that builds on Linux and rApache.
The OpenCPU software is released under Apache2 license. However note that some of the dependencies, such as R, have other open source licenses (e.g. GPL).
An OpenCPU app is an R package which includes some web page(s) that call the R functions in the package using the OpenCPU API. This makes a convenient way to develop, package and ship portable, standalone R web applications. See the server manual for more information.
The OpenCPU server is designed to run on a remote host, accessed through the OpenCPU API, and perhaps RStudio server. The operating system of the host should be irrelevant to users and clients. That said, best support for R and OpenCPU is available on Ubuntu Linux, but this readme on github has some instructions for building and running OpenCPU on various other Linux distributions. Alternatively, you can use virtualization software such as VMWare (Windows), Parallels (Mac) or KVM (Linux) to run a virtual Ubuntu Server within your local machine.
OpenCPU has no notion of users or privileges. The implementation relies on Mandatory Access Control to implement security policies. On Debian and Ubuntu, AppArmor (a security module for the linux kernel) is used to enforce access control policies on a by-process basis. These policies can easily be customized by modifying the AppArmor profiles that ship with the OpenCPU cloud server. See the server manual for more information.
Yes! Both the OpenCPU single-user server and OpenCPU cloud server have been tested to work with RStudio 0.98 and above. See also the appendix in the server manual on this topic.
Absolutely. The current open-source OpenCPU implementation is released under the Apache2 License. You are allowed to use and modify it as you wish (open source or not).
Yes, EC2 is great to get started with OpenCPU. The Ubuntu team provides daily cloud images for EC2, which contain a pre-installed, up-to-date, ready-to-go Ubuntu Server. Usually you pick the latest stable (LTS) release of Ubuntu Server, currently Xenial 16.04: R requires CPU more than anything else so it is recommended to pick one of the newer generation compute optimized instance types, preferably with a SSD disk. The small and micro EC2 instance types have only half a CPU or less, which is usually not enough.
Finding a good provider can be a bit difficult because most providers focus on traffic, disk space and support, but OpenCPU really only needs fast CPU (and some memory). Get a server that has a couple of fast, uncapped, preferably private, processors. Ask the provider how many and how fast the processors are and whether or not they are shared with many other users on the same machine. Pick a provider that offers a clean, unmanaged Ubuntu Server. Avoid anything with pre-configured control panels and all that stuff, it will only slow things down. Many providers offer a trial period if you ask for it. Try running some quick R benchmarks to test performance. If you really have no idea where to start looking, in the US Rackspace, Linode and Amazon EC2 are popular, and for Europe TransIP seems pretty good.
Yes! To publish an app in the official repository, first put it in your own github repository. It should then be accessible via e.g. Let us know by twitter or email that you would like it published, and if it meets the minimum requirements, we'll fork it into the OpenCPU github organization.
When using unconventional locations for files or packages, these locations need to be added to the security profile. Have a look at /var/log/kern.log on your system and search for lines containing "APPARMOR" and "DENIED" to diagnose if this is the problem. The section on Customizing the security profile in the PDF server manual contains more information.
The purpose of the OpenCPU API is to define a unified, exensible interface to R that allows for developing portable applications and scalable servers. The API is deliberately quite minimal and describes only what it does, not how. The current open-source implementation is written completely in R. It used by several organizations, has undergone lots of testing, and has proven to be stable. However, if it any point you would like to implement an OpenCPU server in e.g. a Java/C++/Node stack (open source or not), you are more than welcome to do so, and we will help out where ever we can. It would be fantastic if the same apps could be hosted on various server implementations.
In most cases, the overhead of the OpenCPU server (especially the cloud server) should be neglectable. The time it takes to call an R function or run a script through OpenCPU is equal to the time it takes to call the same function or script in R, plus the latency of the connection (ping client to server). When using HTTPS there might be a bit of additional SSL handshaking, but if you're using a smart client (e.g. a browser) this is only required for the first request. If you experience slowness, then probably the R code that you are calling is just slow (welcome to R). If there is a big time difference between calling a function locally and calling it through OpenCPU, please report is as a bug. One exception: if you're using the local single-user server on Windows, there is some additional overhead due to the absense of forking in Windows. Rest assured that your application will run faster once it is deployed on the cloud server.
The root path of the package URL shows information about a package. For example, to see which version of knitr is currently installed on the demo server, navigate to OpenCPU is an R package like any other, so to find out which version of OpenCPU a server is running navigate to
The source package of the OpenCPU cloud server is available form the opencpu-server repository. The readme contains more information.
To make OpenCPU work on Fedora / CentOS the installer needs to add a few policies to SELinux. Unfortunately changing SELinux policies is terribly slow.

Mailing List

We now have a mailing list! For questions, suggestions, problems or praise, email to [email protected]. To subscribe or search archives, visit the Google group.

Technical Questions

Technical questions about OpenCPU, R, HTTP, JavaScript, etc, can also be asked on Stack Overflow. Tag your questions with both #opencpu and #r to maximize the likelihood of an answer.

Short Questions

For (short) questions, you can also ask @OpenCPU on twitter.