Date
1 - 3 of 3
Question on Custom script working as part of PHP buildpack
Amishi Shah
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
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
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.
toggle quoted message
Show quoted text
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
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
Daniel Mikusa
On Mon, Sep 14, 2015 at 8:25 PM, Amishi Shah (amishish) <amishish(a)cisco.com>
wrote:
put into the `.profile.d` folder (in the root of your application) will be
executed prior to your application starting in the runtime environment.
Just bear in mind that these scripts must run quick as they need to finish
before your application will start and your application plus the
`.profile.d` scripts all need to start within the health check timeout.
might try the multi-buildpack, configured to run the Java & PHP build packs.
https://github.com/ddollar/heroku-buildpack-multi
shell script, so it's pretty easy to make it do what you want. If you need
to do something at staging time, then I would suggest a build pack
extension.
You could certainly write your own build pack or fork one of the existing
ones, but that's a lot more work and puts a maintenance burden on you going
forward.
to what didn't work.
Dan
wrote:
Hi team,The easiest way to do this is with a `.profile.d` script. Any script you
I have a requirement to run a custom script (Configure OpenAM Web Policy
Agent) as part of a PHP buildpack.
put into the `.profile.d` folder (in the root of your application) will be
executed prior to your application starting in the runtime environment.
Just bear in mind that these scripts must run quick as they need to finish
before your application will start and your application plus the
`.profile.d` scripts all need to start within the health check timeout.
The requirement is the Web Policy Agent should have OpenJDK configuredThat's tricky since the PHP is not going to install that for you. You
before it runs.
might try the multi-buildpack, configured to run the Java & PHP build packs.
https://github.com/ddollar/heroku-buildpack-multi
Could anyone please share any thoughts on how I can achieve thisI prefer a `.profile.d` script when possible. It's lightweight and is a
requirement?
shell script, so it's pretty easy to make it do what you want. If you need
to do something at staging time, then I would suggest a build pack
extension.
You could certainly write your own build pack or fork one of the existing
ones, but that's a lot more work and puts a maintenance burden on you going
forward.
I tried it as part of the custom extension, but seems like it is notCan you be more specific? Both in regards to what you tried and in regards
working.
to what didn't work.
Dan