<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/opencpu-2-1-release-scalable-r-services/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://www.opencpu.org/posts/opencpu-201/"> OpenCPU</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p> <a rel="nofollow" href="https://www.opencpu.org/posts/opencpu-201" target="_blank"><img alt="opencpu logo" src="https://i1.wp.com/www.opencpu.org/images/stockplot.png?w=456&ssl=1" data-recalc-dims="1"></a></p>
<p>OpenCPU provides a mature and robust system for hosting R based services. The server exposes a simple <a rel="nofollow" href="https://www.opencpu.org/api.html" target="_blank">HTTP API</a> for calling R functions, scripts and managing data. The Cloud Server is completely free and scales up to many concurrent users. This provides a reliable foundation for intergrating R into any environment.</p>
<p>The 2.1 branch is the new major release of OpenCPU. The changes in this version are mostly internal, and make the server a bit lighter and faster. The built-in CI system has switched to the lightweight <a rel="nofollow" href="https://cloud.r-project.org/web/packages/remotes/index.html" target="_blank">remotes</a> package for installing packages from GitHub. Moreover the <code>opencpu-server</code> package has been tweaked to work better inside docker. Also we now target R 3.5 on server installations.</p>
<p>The user facing features are unchanged; see the <a rel="nofollow" href="https://www.opencpu.org/posts/opencpu-2-0/" target="_blank">opencpu 2.0 announcement post</a> for a brief overview.</p>
<h2>Upgrading</h2>
<p>The version 2.1.0 is available from <a rel="nofollow" href="https://cran.r-project.org/package=opencpu" target="_blank">CRAN</a>, <a rel="nofollow" href="https://www.opencpu.org/download.html" target="_blank">Launchpad</a>, <a rel="nofollow" href="https://hub.docker.com/u/opencpu" target="_blank">Dockerhub</a>, <a rel="nofollow" href="https://software.opensuse.org/download.html?project=home:jeroenooms:opencpu-2.1&package=opencpu" target="_blank">OBS</a> and the <a rel="nofollow" href="https://archive.opencpu.org/" target="_blank">server archive</a>.</p>
<p>The recommended platform for running the server is Ubuntu 18.04 or 16.04, which can be installed <a rel="nofollow" href="https://www.opencpu.org/download.html" target="_blank">directly from the PPA</a>. For Fedora and CentOS you can download installers from the <a rel="nofollow" href="https://archive.opencpu.org/centos-6/" target="_blank">server achive</a>. All binaries from the archive have been <a rel="nofollow" href="https://www.opencpu.org/posts/opencpu-with-docker/" target="_blank">built on dockerhub</a> and depend on the current version of R from <a rel="nofollow" href="https://apps.fedoraproject.org/packages/R-devel" target="_blank">Fedora / EPEL</a>.</p>
<p>The easiest way to get started is by deploying your packages on the <a rel="nofollow" href="https://www.opencpu.org/cloud.html" target="_blank">public cloud server</a> by enabling the opencpu webhook in your GitHub repository.</p>
<h2>Docker</h2>
<p>Another easy way to get started is using docker, which also runs on Windows these days. Images based on various platforms are published on <a rel="nofollow" href="https://hub.docker.com/u/opencpu" target="_blank">dockerhub</a> The <a rel="nofollow" href="https://hub.docker.com/r/opencpu/rstudio" target="_blank">opencpu/rstudio</a> image is recommended for development: it runs both <code>opencpu-server</code> and <code>rstudio-server</code> which are very powerful together.</p>
<div>
<div>
<pre><code><span># Run server as executable</span>
docker run <span>--name</span> mybox <span>-t</span> <span>-p</span> 80:80 opencpu/rstudio

<span># OR: if port 80 is taken use port 8004</span>
docker run <span>--name</span> mybox <span>-t</span> <span>-p</span> 8004:8004 opencpu/rstudio
</code></pre>
</div>
</div>
<p>Now simply open <code>http://localhost/ocpu/</code> and <code>http://localhost/rstudio/</code> in your browser! Login via rstudio with user: <code>opencpu</code> (passwd: <code>opencpu</code>) to build and install packages.</p>
<p>To connect to a running container (e.g. for installing system libraries) get a root shell:</p>
<div>
<div>
<pre><code><span># Replace 'mybox' with the container name or id</span>
docker <span>exec</span> <span>-i</span> <span>-t</span> mybox /bin/bash
</code></pre>
</div>
</div>
<p>Use the <a rel="nofollow" href="https://hub.docker.com/r/opencpu/base" target="_blank">opencpu/base</a> image for deployments. Also see the <a rel="nofollow" href="https://github.com/jeroen/opencpu-server/tree/master/docker#readme" target="_blank">docker readme</a>.</p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://www.opencpu.org/posts/opencpu-201/"> OpenCPU</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/xqR2feFB3VU" height="1"></a></div>