cloudfoundry / java-buildpack

Cloud Foundry buildpack for running Java applications
Apache License 2.0
439 stars 2.58k forks source link

AppDynamics Component Re-Activation via Manifest, etc. #345

Closed JArmstrongTP closed 7 years ago

JArmstrongTP commented 8 years ago

We use App Dynamics Framework component in previous releases of the buildpack. However, in the head version this feature has been deactivated. In the comments it is stated it can be re-activated by a company that has App Dynamic licenses (which we do). In the config/components.yml file the JavaBuildpack::Framework::AppDynamicsAgent has been commented out. Is there a way (other than cloning the repository) to re-enable this component? E.g. JBP_CONFIG_COMPONENTS: '[ frameworks: "JavaBuildpack::Framework::AppDynamicsAgent" ]' returns an error that the list is a map and fails to continue the buildpack.

staging: [Buildpack]                      ERROR Compile failed with exception #<NoMethodError: undefined method `map' for "JavaBuild
pack::Framework::AppDynamicsAgent":String>
staging: [Buildpack]                      DEBUG Exception #<NoMethodError: undefined method `map' for "JavaBuildpack::Framework::App
DynamicsAgent":String> backtrace:
staging: /tmp/buildpacks/java-buildpack/lib/java_buildpack/buildpack.rb:154:in `instantiate'
staging: /tmp/buildpacks/java-buildpack/lib/java_buildpack/buildpack.rb:127:in `instantiate_components'
staging: /tmp/buildpacks/java-buildpack/lib/java_buildpack/buildpack.rb:120:in `initialize'
staging: /tmp/buildpacks/java-buildpack/lib/java_buildpack/buildpack.rb:225:in `new'
staging: /tmp/buildpacks/java-buildpack/lib/java_buildpack/buildpack.rb:225:in `with_buildpack'
staging: /tmp/buildpacks/java-buildpack/bin/compile:26:in `<main>'
staging: undefined method `map' for "JavaBuildpack::Framework::AppDynamicsAgent":String
staging: Staging failed: Buildpack compilation step failed
nebhale commented 8 years ago

The JBP_CONFIG_* behavior, overlays map keys onto of what is already ere. So there is no way to add to a list, but you can override a value that is a list. Therefore, the configuration is like this:

cf set-env <APP> JBP_CONFIG_COMPONENTS '{ frameworks: [ "JavaBuildpack::Framework::AppDynamicsAgent", "JavaBuildpack::Framework::ContainerCertificateTrustStore", "JavaBuildpack::Framework::ContainerCustomizer", "JavaBuildpack::Framework::Debug", "JavaBuildpack::Framework::DynatraceAppmonAgent", "JavaBuildpack::Framework::DynatraceOneAgent", "JavaBuildpack::Framework::Jmx", "JavaBuildpack::Framework::JrebelAgent", "JavaBuildpack::Framework::LunaSecurityProvider", "JavaBuildpack::Framework::MariaDbJDBC", "JavaBuildpack::Framework::NewRelicAgent", "JavaBuildpack::Framework::PlayFrameworkAutoReconfiguration", "JavaBuildpack::Framework::PlayFrameworkJPAPlugin", "JavaBuildpack::Framework::PostgresqlJDBC", "JavaBuildpack::Framework::SpringAutoReconfiguration", "JavaBuildpack::Framework::SpringInsight", "JavaBuildpack::Framework::YourKitProfiler", "JavaBuildpack::Framework::JavaOpts" ] }'

You can filter that list for what you'd really like (to help with the fact that all applications would be forced to set it), but for something this invasive, having a fork might actually be preferable. Please also remember that as part of this change, we no longer host AppDynamics binaries so you'll also need to set:

cf set-env <APP> JBP_CONFIG_APP_DYNAMICS_AGENT = '{ repository_root: "<REPOSITORY ROOT>" }'

to point at a repository that you host with AppDynamics binaries.

ipsi commented 7 years ago

Can you please update the documentation? It needs to be way more obvious than a comment in a commit message. It's already cost me time trying to figure out why AppDynamics wasn't loading.

nebhale commented 7 years ago

Documented in b3d62ad2f78c11756b6911cb7b4b51774f844ba0.