cloudfoundry / nodejs-buildpack

Cloud Foundry buildpack for Node.js
http://docs.cloudfoundry.org/buildpacks/
Apache License 2.0
173 stars 385 forks source link

nodejs_app_with_appdyanmics_test Fails #207

Closed gili-patrick-r closed 5 years ago

gili-patrick-r commented 5 years ago

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?

(base) -bash-4.2$ cf curl /v2/info
{
   "name": "",
   "build": "",
   "support": "https://support.pivotal.io",
   "version": 0,
   "description": "",
   "authorization_endpoint": "https://login.cfsys-cti-dev-3.nam.nsroot.net",
   "token_endpoint": "https://uaa.cfsys-cti-dev-3.nam.nsroot.net",
   "min_cli_version": "6.23.0",
   "min_recommended_cli_version": "6.23.0",
   "api_version": "2.94.0",
   "app_ssh_endpoint": "ssh.cfsys-cti-dev-3.nam.nsroot.net:2222",
   "app_ssh_host_key_fingerprint": "d3:64:4f:39:18:5d:6e:3c:3f:1b:3c:ed:69:48:b0:80",
   "app_ssh_oauth_client": "ssh-proxy",
   "doppler_logging_endpoint": "wss://doppler.cfsys-cti-dev-3.nam.nsroot.net:443",
   "routing_endpoint": "https://api.cfsys-cti-dev-3.nam.nsroot.net/routing",
   "user": "71a54276-8bcd-4cb1-8315-77866a4d95be"
}
(base) -bash-4.2$ cf version
cf version 6.38.0+7ddf0aadd.2018-08-07

What version of the buildpack you are using?

v1.6.54

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

Run the nodejs_app_with_appdynamics_test, in isolation.

What did you expect to happen?

For the test to pass.

What was the actual behavior?

The test fails in the same place every time:

Eventually(appConfig, 10*time.Second).Should(ContainSubstring("controllerHost": "test-ups-host"))

appConfig returns the following string: "{"killed":false,"code":1,"signal":null,"cmd":"cat /tmp/appd//.json"}"

When I "cf ssh" into the container and "cat /tmp/appd//.json", it finds no such file.

Can you provide a sample app?

Please confirm where necessary:

cf-gitbot commented 5 years ago

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

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

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

gili-patrick-r commented 5 years ago

It is worth noting that we are using version 4.5.20 of the AppDynamics agent, as we cannot use 4.5.15 (as we are behind a corporate proxy that prevents it from operating correctly.

In addition, not there are no errors in the application's log.

sclevine commented 5 years ago

Thanks for the report @gili-patrick-r!

It seems like the underlying issue is that the buildpack isn't fully compatible with the latest release of the app dynamics agent. I'm prioritizing this issue now.

More generally, the next-generation Cloud Native Buildpacks version of this buildpack (https://github.com/cloudfoundry/nodejs-cnb) will push the APM agent configuration logic into a dedicated extension buildpack so that ideally AppD can fix compatibility issues as they arise.

ryanmoran commented 5 years ago

Hi @gili-patrick-r!

This looks to have been an undocumented change in the AppDynamics Node.js agent code that slipped into the v4.5.16 patch release of their npm package. As far as I can tell, there are 2 changes that need to be made to an app so that it will continue to operate in the same manner as it did in v4.5.15.

  1. When requiring the appdynamics package in your node code and starting to profile, you will need to set the option proxy to true. Here is an example:
    var appdynamics = require("appdynamics").profile({
      applicationName: "my-app",
      proxy: true
     });
  2. Specifying the above will then require the appdynamics-jre package to be installed. There is a "postinstall" script in the appdynamics package that will reach out and install this package for you, but only if the npm_config_appd_include_java_proxy environment variable is set to true.

You can see both of these changes to the fixture app in https://github.com/cloudfoundry/nodejs-buildpack/commit/cbdd77884a4bf3f1812c60521ba21bc461359aaa. In this commit, we have also bumped the version of the agent we test to v4.5.20. The tests now pass.

Thank you for bringing this to our attention. I hope the details above allow you to resolve your issue.