Estimated Time: 25 minutes
1. Preface
We’ve learned that buildpacks produce the droplets that are needed to run our applications. But how do we customize their behavior? In this lab, you’ll explore ways to configure the version of the java runtime that the java buildpack provisions for your application.
2. Exercises
2.1. Use a Custom Buildpack
-
Review the documentation on deploying with custom buildpacks and how dependencies are handled with the Java Buildpack online package and the offline package.
-
Review the Java Version reported by
articulate
. -
Review which buildpack is in use.
cf app articulate
-
Push
articulate
again, but this time specify a custom buildpack. In this case, we will use the latest version of the Java Buildpack on GitHub.cd ~/pivotal-cloud-foundry-developer-workshop/articulate/
..and:
cf push articulate -p ./articulate-0.2.jar -b https://github.com/cloudfoundry/java-buildpack.git
-
Using your browser, refresh the
articulate
application.
It’s likely (but not required) that the Java Version
changed.
2.2. Change the Java version
-
Review the Java Buildpack configuration and extension documentation.
-
Let’s assume that we want to run
articulate
on a specific version Java.cf set-env articulate JBP_CONFIG_OPEN_JDK_JRE "{jre: { version: 1.8.0_45 }}"
-
Using your browser, refresh the
articulate
application.QUESTION: Is the
articulate
running with1.8.0_45
? Why not? -
Restage
articulate
.cf restage articulate
QUESTION: Would
cf restart
be sufficient instead ofcf restage
? Why not? -
Using your browser, refresh the
articulate
application.
2.3. Questions
-
What other items are easily customized with the Java Buildpack?
-
How would you go about customizing the java buildpack to use a different version of the new relic agent jar?
-
If you use Java, what items do you think would need customization in your environment?