GithubHelp home page GithubHelp logo

appengine-rstudio's Introduction

RStudio Appengine

Appengine is a managed compute service that recently started to support Docker environments that can run any code. This is a demo of deploying R.

Appengine offers benefits such as a free tier and auto scaling that turns off the instance when you are not using it. It reboots upon request of the application URL.

I wouldn't keep any data on the instance, but with the use of Google Cloud Storage you can preserve state.

Other applications of R on appengine include an R API via OpenCPU/plumber. Shiny sadly can't be supported yet as it uses websockets, that aren't yet supported on Appengine flexible containers.

Setup

Clone repo then in same directory run:

gcloud app deploy --project your-project

Demo: https://mark-rstudio.appspot.com (auth login only)

authentication

Instance has a Google OAuth2 proxy login over the normal RStudio login, you can configure access via https://console.cloud.google.com/iam-admin/gatekeeper/project

scaling config

The RStudio session disconnects on default scaling settings, as only one session is allowed per RStudio Server connection and appengine defaults to 2 https://cloud.google.com/appengine/docs/standard/python/how-instances-are-managed

Configure app.yaml to get around this:

app.yaml configuration

See how to config the app.yaml here

Set to only 1 per instance with 30min timeout via:

automatic_scaling:
  min_num_instances: 1
  max_num_instances: 1

If you want the instance to run all the time, replace basic scaling with manual scaling:

manual_scaling:
  instances: 1

Flexible containers do not support basic_scaling

Instance size

You can set the size of the instance via the resources config:

e.g.

resources:
  cpu: 2
  memory_gb: 2.3
  disk_size_gb: 10
  volumes:
  - name: ramdisk1
    volume_type: tmpfs
    size_gb: 0.5

reference

https://support.rstudio.com/hc/en-us/articles/200552316-Configuring-the-Server

https://github.com/rocker-org/rocker/blob/master/rstudio/testing/Dockerfile

https://cloud.google.com/appengine/docs/standard/python/an-overview-of-app-engine

debug

gcloud app --project [PROJECT-ID] instances enable-debug

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.