2
votes

I have a Shiny app that runs as expected locally, and I am working to deploy it to Bluemix using Cloud Foundry. I am using this buildpack.

The default staging time for apps to build is 15 minutes, but that is not long enough to install R and the packages needed for my app. If I try to push my app with the defaults, I get an error about running out of time:

Error restarting application: sherlock-topics failed to stage within 15.000000 minutes

I changed my manifest.yml to increase the staging time:

applications:  
- name: sherlock-topics
  memory: 728M
  instances: 1
  buildpack: git://github.com/beibeiyang/cf-buildpack-r.git
  env:
    CRAN_MIRROR: https://cran.rstudio.com
    CF_STAGING_TIMEOUT: 45
    CF_STARTUP_TIMEOUT: 9999

Then I also changed the staging time for the CLI before pushing:

cf set-env sherlock-topics CF_STAGING_TIMEOUT 45
cf push sherlock-topics

What happens then is that the app tries to deploy. It installs R in the container and installs packages, but only for about 15 minutes (a little longer). When it gets to the first new task (package) after the 15 minute mark, it errors but with a different, sadly uninformative error message.

Staging failed
Destroying container
Successfully destroyed container

FAILED
Error restarting application: StagingError

There is nothing in the logs but info about the libraries being installed and then Staging failed.

Any ideas about why it isn't continuing to stage past the 15-minute mark, even after I increase CF_STAGING_TIMEOUT?

2

2 Answers

4
votes

The platform operator controls the hard limit for staging timeout and application startup timeout. CF_STAGING_TIMEOUT and CF_STARTUP_TIMEOUT are cf cli configuration options that tell the cli how long to wait for staging and app startup.

See docs here for reference:

https://docs.cloudfoundry.org/devguide/deploy-apps/large-app-deploy.html#consid_limits

As an end user, it's not possible to exceed the hard limits put in place by your platform operator.

1
votes

I ran into the same exact issue. I was also trying to deploy a shinyR app with a quite a number of dependencies.

The trick is to add the num_threads property to r.yml file. This will definitely speed up the build time.

Here's how one might look:

packages:
 - packages: 
    - name: bupaR
    - name: edeaR
   num_threads: 8

See https://docs.cloudfoundry.org/buildpacks/r/index.html for more info