Re: Question on Custom script working as part of PHP buildpack


Alexander Lomov <alexander.lomov@...>
 

Hey, Amishi.

I’m not sure that customizing PHP buildpack in this case is a good idea, but if you want to try - here are the steps:


1. You’ll need to add JDK, tomcat and Policy Agent .jar file to the buildpack (as it comes from Agent's docs [1]). In order to do it you’ll better add binaries to S3 and use buildpack-packager [2] to fetch them during compilation. You can take a look on the scripts I wrote to automate this task [3].
2. During compile phase this binaries should be placed to droplet with your app. You can pass settings for Policy Agent through environment variables and render config during this phase.
3. Than you’ll need to make release script to output command to run both PHP app and Policy Agent.

The last step implies running multiple threads in context of one container and I’m not sure that it can work well, the discussion of this problem was raised before several times [4].

This is the main reason to run Policy Agent as a separate Cloud Foundry application. Still I am not sure that standard Java buildpack will suite your needs. Pretty sure that it will be easier in your case to write your custom buildpack. I wrote a blogpost that can help you to understand better how to do it [5].

[1] http://openam.forgerock.org/doc/bootstrap/web-users-guide/
[2] https://github.com/cloudfoundry/buildpack-packager
[3] https://github.com/Altoros/ruby-buildpack/tree/power/power/bin
[4] https://groups.google.com/a/cloudfoundry.org/forum/#!topic/vcap-dev/Uq-d1G72jx0
[5] http://blog.altoros.com/creating-a-custom-cloud-foundry-buildpack-from-scratch-whats-under-the-hood.html

Best Regards,
Alex L.

On Sep 15, 2015, at 3:25 AM, Amishi Shah (amishish) <amishish(a)cisco.com<mailto:amishish(a)cisco.com>> wrote:

Hi team,

I have a requirement to run a custom script (Configure OpenAM Web Policy Agent) as part of a PHP buildpack. The requirement is the Web Policy Agent should have OpenJDK configured before it runs.

Could anyone please share any thoughts on how I can achieve this requirement?

I tried it as part of the custom extension, but seems like it is not working.

Thanks,
Amishi Shah

Join {cf-dev@lists.cloudfoundry.org to automatically receive all group messages.