cloudfoundry / r-buildpack

Cloud Foundry buildpack for R
Apache License 2.0
9 stars 24 forks source link

Buildpack isn't installing app dependencies before running the application #36

Closed NiPfi closed 3 years ago

NiPfi commented 3 years ago

Hi there! I'm currently running into an issue, where our application can't be run due to a third-party dependency called drgee not installing a it should. So far I've tried several things, such as vendoring the package or trying different CRAN mirrors, including a in-house Nexus proxy but that didn't help. It seems to me, like the buildpack isn't actually installing the dependency in the first place, since the log output doesn't mention any step for installing the dependency.

What is confusing to me in particular, is that there is no output at all, concerning the installation of the dependency. If there is any issue installing it, for example because it requires compilation, there should be an error and the app shouldn't be run at all but as it stands, it behaves as if the package was not installed.

What version of Cloud Foundry and CF CLI are you using? (i.e. What is the output of running cf curl /v2/info && cf version?

{
   "name": "CFAP01",
   "build": "2.20.3",
   "version": 2,
   "api_version": "2.144.0",
   "osbapi_version": "2.15",
[...] (I redacted some internal info)
}
cf.exe Version 6.46.1+4934877ec.2019-08-23

What version of the buildpack you are using?

v1.1.11

If you were attempting to accomplish a task, what was it you were attempting to do?

Deploying an app with the package drgee as a dependency using the following r.yml file.

applications:
- name: app
  buildpacks:
  - https://github.com/cloudfoundry/r-buildpack#v1.1.11
  disk_quota: 2048M
  instances: ((instances))
  memory: ((memory))
  command: R -f startscript.R
  env:
    ENVIRONMENT_NAME: ((space))
  routes:
  - route: ((route))
  stack: cflinuxfs3
  packages:
  - cran_mirror: https://cran.r-project.org
    packages:
    - name: jsonlite
    - name: drgee

What did you expect to happen?

The buildpack to install the package, print the fact that it is installing the dependency, and the application to run.

What was the actual behavior?

The application failed to run, with an error saying that there is no library called "drgee".

cf push output:

Staging von App und Tracing von Protokollen...
   Cell diego-cell-12 creating container for instance e0eaa647-a16b-4448-99d5-3a11e4f40183
   Cell diego-cell-12 successfully created container for instance e0eaa647-a16b-4448-99d5-3a11e4f40183
   Downloading app package...
   Downloading build artifacts cache...
   Downloaded app package (107.1K)
   Downloaded build artifacts cache (179.6M)
   -----> Download go 1.12.4
   -----> Running go build supply
   /tmp/buildpackdownloads/c0a0f4bf059ddcf2b8af38a5b915e57d ~
   ~
   -----> R Buildpack version 1.1.11
   -----> Supplying R
   -----> Installing r 4.0.3
          Copy [/tmp/cache/final/dependencies/1ae30f2982d679f56d52276700a777c7a2aeb641b59e6d4e8dc79e37e44946dc/r_4.0.3_linux_noarch_cflinuxfs3_2359441e.tgz]
          **WARNING** r 4.0.x will no longer be available in new buildpacks released after 2021-03-01.
          See: https://developer.r-project.org/
   -----> Running go build finalize
   /tmp/buildpackdownloads/c0a0f4bf059ddcf2b8af38a5b915e57d ~
   ~
   Exit status 0
   Uploading droplet, build artifacts cache...
   Uploading droplet...
   Uploading build artifacts cache...
   Uploaded build artifacts cache (179.6M)
   Uploaded droplet (180.6M)
   Uploading complete
   Cell diego-cell-12 stopping instance e0eaa647-a16b-4448-99d5-3a11e4f40183
   Cell diego-cell-12 destroying container for instance e0eaa647-a16b-4448-99d5-3a11e4f40183
   Cell diego-cell-12 successfully destroyed container for instance e0eaa647-a16b-4448-99d5-3a11e4f40183

Warten auf den Start durch die App...
Start nicht erfolgreich

TIPP: Verwenden Sie 'cf.exe logs ebg-temosta-analysis --recent', um weitere Informationen zu erhalten
FEHLGESCHLAGEN

cf log output:

   2021-02-24T17:03:15.78+0100 [CELL/0] OUT Cell diego-cell-12 creating container for instance 11982909-a8f6-48c9-791e-d21f
   2021-02-24T17:03:16.84+0100 [CELL/0] OUT Cell diego-cell-0 successfully destroyed container for instance 1bb04fb8-fb79-4804-69de-6bf7
   2021-02-24T17:03:17.16+0100 [CELL/0] OUT Cell diego-cell-12 successfully created container for instance 11982909-a8f6-48c9-791e-d21f
   2021-02-24T17:03:17.16+0100 [CELL/0] OUT Downloading droplet...
   2021-02-24T17:03:19.52+0100 [CELL/0] OUT Downloaded droplet
   2021-02-24T17:03:19.52+0100 [CELL/0] OUT Starting health monitoring of container
   2021-02-24T17:03:22.13+0100 [APP/PROC/WEB/0] OUT R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
   2021-02-24T17:03:22.13+0100 [APP/PROC/WEB/0] OUT Copyright (C) 2020 The R Foundation for Statistical Computing
   2021-02-24T17:03:22.13+0100 [APP/PROC/WEB/0] OUT Platform: x86_64-pc-linux-gnu (64-bit)
   2021-02-24T17:03:22.20+0100 [APP/PROC/WEB/0] OUT R is free software and comes with ABSOLUTELY NO WARRANTY.
   2021-02-24T17:03:22.20+0100 [APP/PROC/WEB/0] OUT You are welcome to redistribute it under certain conditions.
   2021-02-24T17:03:22.20+0100 [APP/PROC/WEB/0] OUT Type 'license()' or 'licence()' for distribution details.
   2021-02-24T17:03:22.20+0100 [APP/PROC/WEB/0] OUT   Natural language support but running in an English locale
   2021-02-24T17:03:22.20+0100 [APP/PROC/WEB/0] OUT R is a collaborative project with many contributors.
   2021-02-24T17:03:22.20+0100 [APP/PROC/WEB/0] OUT Type 'contributors()' for more information and
   2021-02-24T17:03:22.20+0100 [APP/PROC/WEB/0] OUT 'citation()' on how to cite R or R packages in publications.
   2021-02-24T17:03:22.20+0100 [APP/PROC/WEB/0] OUT Type 'demo()' for some demos, 'help()' for on-line help, or
   2021-02-24T17:03:22.20+0100 [APP/PROC/WEB/0] OUT 'help.start()' for an HTML browser interface to help.
   2021-02-24T17:03:22.20+0100 [APP/PROC/WEB/0] OUT Type 'q()' to quit R.
   2021-02-24T17:03:22.42+0100 [APP/PROC/WEB/0] OUT > Sys.setenv(LANG = "en")
   2021-02-24T17:03:22.42+0100 [APP/PROC/WEB/0] OUT > library(plumber);
   2021-02-24T17:03:22.65+0100 [APP/PROC/WEB/0] OUT > pr <- plumber::plumb("WebApi.R");
   2021-02-24T17:03:22.69+0100 [APP/PROC/WEB/0] ERR Loading required package: jsonlite
   2021-02-24T17:03:22.72+0100 [APP/PROC/WEB/0] ERR Error in stopOnLine(lineNum, file[lineNum], e) : 
   2021-02-24T17:03:22.72+0100 [APP/PROC/WEB/0] ERR   Error on line #2: 'setwd("fun")' - Error in library(drgee): there is no package called ‘drgee’
   2021-02-24T17:03:22.72+0100 [APP/PROC/WEB/0] ERR Calls: <Anonymous> ... tryCatchList -> tryCatchOne -> <Anonymous> -> stopOnLine
   2021-02-24T17:03:22.72+0100 [APP/PROC/WEB/0] ERR Execution halted
   2021-02-24T17:03:22.76+0100 [APP/PROC/WEB/0] OUT Exit status 1
   2021-02-24T17:03:22.76+0100 [CELL/SSHD/0] OUT Exit status 0
   2021-02-24T17:03:22.77+0100 [CELL/0] OUT Cell diego-cell-12 stopping instance 11982909-a8f6-48c9-791e-d21f
   2021-02-24T17:03:22.77+0100 [CELL/0] OUT Cell diego-cell-12 destroying container for instance 11982909-a8f6-48c9-791e-d21f
   2021-02-24T17:03:22.81+0100 [API/0] OUT Process has crashed with type: "web"
   2021-02-24T17:03:22.83+0100 [API/0] OUT App instance exited with guid cae8b206-6359-4e39-9a3a-6e79d6e91d35 payload: {"instance"=>"11982909-a8f6-48c9-791e-d21f", "index"=>0, "cell_id"=>"diego-cell-12", "reason"=>"CRASHED", "exit_description"=>"APP/PROC/WEB: Exited with status 1", "crash_count"=>3, "crash_timestamp"=>1614182602769866014, "version"=>"5581a214-9f89-44cc-aa5b-c306e5910565"}
   2021-02-24T17:03:23.23+0100 [CELL/0] OUT Cell diego-cell-12 successfully destroyed container for instance 11982909-a8f6-48c9-791e-d21f

Please confirm where necessary:

cf-gitbot commented 3 years ago

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/177079879

The labels on this github issue will be updated when the story is started.

NiPfi commented 3 years ago

I've made some progress. The issue seems to be linked with the naming of the files. The manifest file I was using was called r.yml. I've now split it into two files, one called manifest.yml and one called r.yml in which the latter only containes the "packages" section of the original manifest file. Now the buildpack compiles my dependencies and seems to provide them for the container (droplet?) as expected.

menehune23 commented 3 years ago

@NiPfi Since you've been able to get past this, I'll close this issue for now. Feel free to re-open if you still have some concerns. Most of our resources are dedicated to the newer, container-centric Paketo buildpacks, so we aren't able to prioritize this particular issue.

That said, if this is still important to you and you'd like to submit a PR to address, we'd be happy to take a look. Thanks!