Package 'opencpu'

Title: Producing and Reproducing Results
Description: A system for embedded scientific computing and reproducible research with R. The OpenCPU server exposes a simple but powerful HTTP api for RPC and data interchange with R. This provides a reliable and scalable foundation for statistical services or building R web applications. The OpenCPU server runs either as a single-user development server within the interactive R session, or as a multi-user Linux stack based on Apache2. The entire system is fully open source and permissively licensed. The OpenCPU website has detailed documentation and example apps.
Authors: Jeroen Ooms [aut, cre]
Maintainer: Jeroen Ooms <[email protected]>
License: Apache License 2.0
Version: 2.2.14
Built: 2024-10-03 19:17:02 UTC
Source: https://github.com/opencpu/opencpu

Help Index


OpenCPU Application

Description

Manage installed OpenCPU applications. These applications can be started locally using ocpu_start_app or deployed online on ocpu.io.

Usage

install_apps(repo, ...)

remove_apps(repo)

installed_apps()

available_apps()

update_apps(...)

Arguments

repo

a github repository such as user/repo, see remotes::install_github.

...

additional options for install_github

Details

OpenCPU apps are simply R packages. For regular users, apps get installed in a user-specific app library which is persistent between R sessions. This is used for locally running or developing web applications.

When running these functions as opencpu user on an OpenCPU cloud server, apps will be installed in the global opencpu server app library; the same library as used by the OpenCPU Github webhook.

See Also

Other ocpu: ocpu-server

Examples

## Not run: 
# List available demo apps
available_apps()

# Run application from: https://github.com/rwebapps/nabel
ocpu_start_app("rwebapps/nabel")

# Run application from: https://github.com/rwebapps/markdownapp
ocpu_start_app("rwebapps/markdownapp")

# Run application from: https://github.com/rwebapps/stockapp
ocpu_start_app("rwebapps/stockapp")

# Run application from: https://github.com/rwebapps/appdemo
ocpu_start_app("rwebapps/appdemo")

# Show currently installed apps
installed_apps()

## End(Not run)

OpenCPU Single-User Server

Description

Starts the OpenCPU single-user server for developing and running apps locally. To deploy your apps on a cloud server or ocpu.io, simply push them to github and install the opencpu webhook. Some example apps are available from github::rwebapps/.

Usage

ocpu_start_server(
  port = 5656,
  root = "/ocpu",
  workers = 2,
  preload = NULL,
  on_startup = NULL,
  no_cache = FALSE
)

ocpu_start_app(app, update = TRUE, ...)

Arguments

port

port number

root

base of the URL where to host the OpenCPU API

workers

number of worker processes

preload

character vector of packages to preload in the workers. This speeds up requests to those packages.

on_startup

function to call once server has started (e.g. utils::browseURL)

no_cache

sets Cache-Control: no-cache for all responses to disable browser caching. Useful for development when files change frequently. You might still need to manually flush the browser cache for resources cached previously. Try pressing CTRL+R or go incognito if your browser is showing old content.

app

either the name of a locally installed package, or a github remote (see install_apps)

update

checks if the app is up-to-date (if possible) before running

...

extra parameters passed to ocpu_start_server

See Also

Other ocpu: apps

Examples

## Not run: 
# List available demo apps
available_apps()

# Run application from: https://github.com/rwebapps/nabel
ocpu_start_app("rwebapps/nabel")

# Run application from: https://github.com/rwebapps/markdownapp
ocpu_start_app("rwebapps/markdownapp")

# Run application from: https://github.com/rwebapps/stockapp
ocpu_start_app("rwebapps/stockapp")

# Run application from: https://github.com/rwebapps/appdemo
ocpu_start_app("rwebapps/appdemo")

# Show currently installed apps
installed_apps()

## End(Not run)