# Elastic Apm Agent on PCF cloud foundry Java Build pack (automatic integration)

**URL:** <https://discuss.elastic.co/t/elastic-apm-agent-on-pcf-cloud-foundry-java-build-pack-automatic-integration/171359>\
**Category:** APM\
**Created:** [March 7, 2019, 4:59pm UTC](https://discuss.elastic.co/t/elastic-apm-agent-on-pcf-cloud-foundry-java-build-pack-automatic-integration/171359 "2019-03-07T16:59:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kenmac](https://avatars.discourse-cdn.com/v4/letter/k/839c29/32.png) [@kenmac](https://discuss.elastic.co/u/kenmac)\
**Post date:** [March 7, 2019, 4:59pm UTC](https://discuss.elastic.co/t/elastic-apm-agent-on-pcf-cloud-foundry-java-build-pack-automatic-integration/171359/1 "2019-03-07T16:59:37Z")

</div>

> <https://github.com/cloudfoundry/java-buildpack/issues/659>

I've got a test MR pull request of code here:

> **[kmacpher67/java-buildpack](https://github.com/kmacpher67/java-buildpack)**
>
> Cloud Foundry buildpack for running Java applications - kmacpher67/java-buildpack

I've almost got the build pack to automatically load Elastic Apm Agent on startup.  
Except it's expecting the repo to have index.yml file in the maven repo.

> <https://github.com/kmacpher67/java-buildpack/blob/master/config/elastic_apm_agent.yml#L18>

````auto
version: 1.1.0
repository_root: https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/
repository_download: https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/1.1.0/elastic-apm-agent-1.1.0.jar```

Is there a repo where index.yml is supported? 

I've noted that we can hack the agent line manually, but we have over 50 microservices, this becomes very costly. I'd like to get this merged into the base java build packs. 
https://discuss.elastic.co/t/elastic-apm-agent-jar-on-pcf/166137
````

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [March 11, 2019, 1:17am UTC](https://discuss.elastic.co/t/elastic-apm-agent-on-pcf-cloud-foundry-java-build-pack-automatic-integration/171359/2 "2019-03-11T01:17:32Z")

</div>

> [@kenmac](#):
>
> [Central Repository: co/elastic/apm/elastic-apm-agent](https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent)

Hi @kenmac

Thank you so much for using the Elastic Java APM and working on the Cloud Foundry Build Pack, We Certainly want to have an official build pack at some point soon.

BTW I wrote the manual hack, 😁 We realize that is not optimal but we wanted a way for folks to start trying out the agent in CF before a build pack was available.

I have forwarded this on to a couple internal folks including the PM on the APM Team.

Is this what you are looking for in the elastic apm agent maven repo?

> <https://github.com/kmacpher67/java-buildpack-elkapm/blob/master/config/elastic_apm_agent.yml>

Let's see what I can find out...

NOTE: I am a little confused are you specifically creating this buildpack to be dependent / integrated with JRebel?

---

<div class="post-metadata">

**Author:** ![kenmac](https://avatars.discourse-cdn.com/v4/letter/k/839c29/32.png) [@kenmac](https://discuss.elastic.co/u/kenmac)\
**Post date:** [March 13, 2019, 12:27pm UTC](https://discuss.elastic.co/t/elastic-apm-agent-on-pcf-cloud-foundry-java-build-pack-automatic-integration/171359/3 "2019-03-13T12:27:11Z")

</div>

> [@stephenb](#):
>
> Is this what you are looking for in the elastic apm agent maven repo?

That file is the internal configuration file for the Java BuildPack's internal ruby code inside the build pack compile to "lookup" the version number and repo location.

When that .rb code goes to the var key `repository_root` URL it attempts to fetch a  
I believe the code looks for a  
`INDEX_PATH&#32;=&#32;'/index.yml' `  
If you can name it that so the content looks like this url endpoint.  
[https://download.run.pivotal.io/new-relic/index.yml](https://download.run.pivotal.io/new-relic/index.yml)

> 1.1.0: [https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/1.1.0/elastic-apm-agent-1.1.0.jar](https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/1.1.0/elastic-apm-agent-1.1.0.jar)  
> 1.2.0: [https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/1.2.0/elastic-apm-agent-1.2.0.jar](https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/1.2.0/elastic-apm-agent-1.2.0.jar)  
> 1.3.0: [https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/1.3.0/elastic-apm-agent-1.3.0.jar](https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/1.3.0/elastic-apm-agent-1.3.0.jar)  
> 1.4.0: [https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/1.4.0/elastic-apm-agent-1.4.0.jar](https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/1.4.0/elastic-apm-agent-1.4.0.jar)

The Elastic apm directory uses the Maven xml nomenclature standard to lookup available versions to jar files like this:  
[https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/maven-metadata.xml](https://repo1.maven.org/maven2/co/elastic/apm/elastic-apm-agent/maven-metadata.xml)

The Pivotal BP need it in yml style name:value where:  
name is the version number as a key and  
value is the direct URL to the jar file.

As you send this to me, I could just create a temp url host for that data.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 3, 2019, 8:27am UTC](https://discuss.elastic.co/t/elastic-apm-agent-on-pcf-cloud-foundry-java-build-pack-automatic-integration/171359/4 "2019-04-03T08:27:24Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
