Skip to content

8451/cf-buildpack-r

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CloudFoundry buildpack: R

This is a CloudFoundry buildpack for applications which use R for statistical computing and CRAN for R packages.

It's a fork from the R buildpack for Heroku.

R is ‘GNU S’, a freely available language and environment for statistical computing and graphics which provides a wide variety of statistical and graphical techniques: linear and nonlinear modelling, statistical tests, time series analysis, classification, clustering, etc. Please consult the R project homepage for further information.

CRAN is a network of ftp and web servers around the world that store identical, up-to-date, versions of code and documentation for R.

Building the buildpack with cached dependencies

Building a version of the buildpack with cached dependencies requires Ruby version 2.2.3. Replace <app_name> with the name of your app. Also replace <version> with the version number found in /VERSION

  1. cd into the root directory of the CloudFoundry buildpack for R

  2. Execute a bundle install to install the necessary gems

$ bundle install 
  1. Execute the build buildpack-packager command to generate a zip file with the downloaded dependencies
$ bundle exec buildpack-packager --cached
  1. Upload the buildpack to Cloud Foundry and optionally specify it by name
$ cf create-buildpack custom_r_buildpack R_buildpack-cached-v<version>.zip
$ cf push <app_name> -b custom_r_buildpack 

Usage

Example usage (replace <app_name> with the name of your app):

$ ls
init.r prog1.r prog2.r ...

$ cf push <app_name> -b http://github.com/alexkago/cf-buildpack-r.git

...
-----> R successfully installed

The buildpack will detect your app makes use of R if it has the init.r file in the root. The R runtime is vendored into your slug, and includes the gcc compiler for fortran support.

Installing R packages

During the slug compilation process, the init.r R file is executed. Put code in this file to install any packages you may require. See the Installing-packages for details. The list of available packages can be found at http://cran.r-project.org.

# Example `init.r` file

install.packages("nlme", dependencies = TRUE)

R packages can also be included in your project source and installed when the init.r file is executed.

install.packages("optional-path-to-packages/local-r-package-file.tar.gz", repos=NULL, type="source")

R Binaries

The binaries used by the buildpack are for R 3.0.1, and are hosted on https://s3.amazonaws.com/r-buildpack/R-3.1.0-binaries-20140629-2201.tar.gz

See the guide for building the R binaries yourself.

Caveats

Due to the size of the R runtime, the slug size on Cloud Foundry, without any additional packages or program code, is approximately 98Mb. If additional R packages are installed by the init.r script then the slug size will increase.

Packages

No packages published

Languages

  • Shell 51.3%
  • C 39.2%
  • Ruby 5.2%
  • R 4.3%