Skip to content

ROADMAP #19

Description

@psolymos

This is the roadmap for revising the R/rstats templates for OpenFaaS.

Base images

We need the following base image options (BASEIMAGE below):

  • Debian based rocker/r-base: consistency for most adopted base images, call this base;
  • Ubuntu based rocker/r-ubuntu: long term support can be important in corporate context and it jives with RSPM, call this ubuntu;
  • Alpine based r-hub/r-minimal: small size is always a good thing, call this minimal.

Watchdog version

  • Classic watchdog with stdin/stdout: call these images rstats-BASEIMAGE;
  • of-watchdog with http support: call these images rstats-BASEIMAGE-FRAMEWORK.

Existing server frameworks

The following are server frameworks capable of running R based APIs:

  • Rserve: very bare-bones implementation (RestRserve wraps this), rstats-BASEIMAGE-rserve;
    • RestRserve: a full-fledged API framework based on Rserve, rstats-BASEIMAGE-restserve;
  • httpuv: the most popular server option behind other frameworks, rstats-BASEIMAGE-httpuv;
    • plumber: rstats-BASEIMAGE-plumber;
    • opencpu: rstats-BASEIMAGE-opencpu;
    • fiery: rstats-BASEIMAGE-fiery;
    • beakr: rstats-BASEIMAGE-beakr.

Template structure and workflows

  • template.yml: yaml file for OpenFaaS, docker user, function name etc might have to be edited, see OpenFaaS config.
  • Dockerfile: usually does not need editing.
  • index.R: this file abstracts the server framework. Templates are set up for JSON in JSON out re/res types. This file only needs to be edited if the mime type depends on different midlewear, headers need to be changed etc.
  • function/PACKAGES: file listing required packages and remotes to be installed for the function/handler.R file, plus additional sysreqs.
  • function/handler.R: R script implementing the handler:
    • load libraries;
    • load data;
    • define functions/methods as needed;
    • it should include the handle = function(req, res) { ... } function called by index.R.

I really like how the r-minimal image implements remotes::install_deps() with the _R_SHLIB_STRIP_=true envvar. This behavior should be implemented for other templates through the Dockerfile as added by @mrchypark for the r-minimal template.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions