From 32ffa5dc728bb5d3b476b940518cfddd9c5dba90 Mon Sep 17 00:00:00 2001 From: Ben Hale Date: Thu, 24 Apr 2014 08:03:49 +0100 Subject: [PATCH 1/6] New Relic 3.6 This change update the version of New Relic to 3.6.+ --- config/new_relic_agent.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/new_relic_agent.yml b/config/new_relic_agent.yml index 180ee02142..02d52eb86e 100644 --- a/config/new_relic_agent.yml +++ b/config/new_relic_agent.yml @@ -15,5 +15,5 @@ # Configuration for the New Relic framework --- -version: 3.5.+ +version: 3.6.+ repository_root: "{default.repository.root}/new-relic" From 8a2d325364a9ae878533698a4db341f599be8fcb Mon Sep 17 00:00:00 2001 From: Ben Hale Date: Thu, 24 Apr 2014 08:04:28 +0100 Subject: [PATCH 2/6] Dependency Updates This change updates the versions of dependencies. --- .idea/.rakeTasks | 2 +- Gemfile.lock | 10 +++++----- java-buildpack.iml | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.idea/.rakeTasks b/.idea/.rakeTasks index e3b4a50423..c9e19c2156 100644 --- a/.idea/.rakeTasks +++ b/.idea/.rakeTasks @@ -4,4 +4,4 @@ You are allowed to: 1. Remove rake task 2. Add existing rake tasks To add existing rake tasks automatically delete this file and reload the project. ---> +--> diff --git a/Gemfile.lock b/Gemfile.lock index af230e9ad1..a903b7f6e1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,7 +2,7 @@ GEM remote: https://rubygems.org/ specs: addressable (2.3.6) - ast (1.1.0) + ast (2.0.0) codeclimate-test-reporter (0.3.0) simplecov (>= 0.7.1, < 1.0.0) crack (0.4.2) @@ -12,12 +12,12 @@ GEM docile (1.1.3) json (1.8.1) multi_json (1.9.2) - parser (2.1.7) - ast (~> 1.1) + parser (2.1.9) + ast (>= 1.1, < 3.0) slop (~> 3.4, >= 3.4.5) powerpack (0.0.9) rainbow (2.0.0) - rake (10.2.2) + rake (10.3.1) redcarpet (3.1.1) rspec (3.0.0.beta2) rspec-core (= 3.0.0.beta2) @@ -44,7 +44,7 @@ GEM rake (>= 0.8.1) ruby-progressbar (1.4.2) rubyzip (1.1.3) - safe_yaml (1.0.2) + safe_yaml (1.0.3) simplecov (0.8.2) docile (~> 1.1.0) multi_json diff --git a/java-buildpack.iml b/java-buildpack.iml index 1ba68c2dad..8b2077628f 100644 --- a/java-buildpack.iml +++ b/java-buildpack.iml @@ -270,8 +270,8 @@ - - + + @@ -279,10 +279,10 @@ - + - + @@ -294,7 +294,7 @@ - + From 415861c3d343fee6f7fee7f2744b0e7772d2a927 Mon Sep 17 00:00:00 2001 From: Ben Hale Date: Thu, 24 Apr 2014 15:53:45 +0100 Subject: [PATCH 3/6] Spring Boot and Tomcat detect overlap Previously, a Spring Boot WAR would cause both spring_boot and tomcat to detect. This change makes the discrimination stronger by only allowing spring_boot to detect if it also has a start script. [#70085176] [resolves #51] --- lib/java_buildpack/buildpack.rb | 15 +++++++++++++-- lib/java_buildpack/container/ratpack.rb | 2 +- lib/java_buildpack/container/spring_boot.rb | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/java_buildpack/buildpack.rb b/lib/java_buildpack/buildpack.rb index 8fd0c0b6fe..ec09a6ccdf 100644 --- a/lib/java_buildpack/buildpack.rb +++ b/lib/java_buildpack/buildpack.rb @@ -159,8 +159,19 @@ def require_component(component) end def tag_detection(type, components, unique) - tags = components.map { |component| component.detect }.compact - fail "Application can be run by more than one #{type}: #{names components}" if unique && tags.size > 1 + detected = [] + tags = [] + + components.each do |component| + result = component.detect + + if result + detected << component + tags << result + end + end + + fail "Application can be run by more than one #{type}: #{names detected}" if unique && tags.size > 1 tags end diff --git a/lib/java_buildpack/container/ratpack.rb b/lib/java_buildpack/container/ratpack.rb index 7ed3bed548..b065e0dccb 100644 --- a/lib/java_buildpack/container/ratpack.rb +++ b/lib/java_buildpack/container/ratpack.rb @@ -42,7 +42,7 @@ def id # (see JavaBuildpack::Container::DistZipLike#supports?) def supports? - @ratpack_utils.is? @application + start_script(root) && start_script(root).exist? && @ratpack_utils.is?(@application) end private diff --git a/lib/java_buildpack/container/spring_boot.rb b/lib/java_buildpack/container/spring_boot.rb index 459dd46578..3695bcb312 100644 --- a/lib/java_buildpack/container/spring_boot.rb +++ b/lib/java_buildpack/container/spring_boot.rb @@ -47,7 +47,7 @@ def id # (see JavaBuildpack::Container::DistZipLike#supports?) def supports? - @spring_boot_utils.is? @application + start_script(root) && start_script(root).exist? && @spring_boot_utils.is?(@application) end private From bd21de4edc00455ef5e3bdb0028862f45ae95c2b Mon Sep 17 00:00:00 2001 From: Ben Hale Date: Fri, 25 Apr 2014 11:16:20 +0100 Subject: [PATCH 4/6] Enforce unique container in all phases Previously, the buildpack only enforced a single unique container in the detect phase. This meant that any time a buildpack was explicitly specified (and detect skipped) it was possible to end up with an ambiguous container choice. This change ensures that the same logic for guaranteeing a unique container is used in all phases. [#70085176] --- lib/java_buildpack/buildpack.rb | 48 ++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/lib/java_buildpack/buildpack.rb b/lib/java_buildpack/buildpack.rb index ec09a6ccdf..76c3c2db5f 100644 --- a/lib/java_buildpack/buildpack.rb +++ b/lib/java_buildpack/buildpack.rb @@ -56,11 +56,11 @@ def detect def compile puts BUILDPACK_MESSAGE % @buildpack_version - container = component_detection(@containers).first + container = component_detection('container', @containers, true).first fail 'No container can run this application' unless container - component_detection(@jres).first.compile - component_detection(@frameworks).each { |framework| framework.compile } + component_detection('JRE', @jres, true).first.compile + component_detection('framework', @frameworks, false).each { |framework| framework.compile } container.compile end @@ -69,11 +69,11 @@ def compile # # @return [String] The payload required to run the application. def release - container = component_detection(@containers).first + container = component_detection('container', @containers, true).first fail 'No container can run this application' unless container - component_detection(@jres).first.release - component_detection(@frameworks).each { |framework| framework.release } + component_detection('JRE', @jres, true).first.release + component_detection('framework', @frameworks, false).each { |framework| framework.release } command = container.release payload = { @@ -118,8 +118,26 @@ def initialize(app_dir, application) java_opts, app_dir) end - def component_detection(components) - components.select { |component| component.detect } + def component_detection(type, components, unique) + detected, _tags = detection type, components, unique + detected + end + + def detection(type, components, unique) + detected = [] + tags = [] + + components.each do |component| + result = component.detect + + if result + detected << component + tags << result + end + end + + fail "Application can be run by more than one #{type}: #{names detected}" if unique && detected.size > 1 + [detected, tags] end def instantiate(components, additional_libraries, application, java_home, java_opts, root) @@ -159,19 +177,7 @@ def require_component(component) end def tag_detection(type, components, unique) - detected = [] - tags = [] - - components.each do |component| - result = component.detect - - if result - detected << component - tags << result - end - end - - fail "Application can be run by more than one #{type}: #{names detected}" if unique && tags.size > 1 + _detected, tags = detection type, components, unique tags end From b6bc7c0c9c38857336aec1d282a828a85c8006ec Mon Sep 17 00:00:00 2001 From: Ben Hale Date: Fri, 25 Apr 2014 14:22:16 +0100 Subject: [PATCH 5/6] Add example to JAVA_OPTS framework documentation Previously, the documentation for the JAVA_OPTS framework wasn't clear enough that a user could properly configure it without help. This change adds an example to that documentation to make it clearer. [#69514724][resolves #49] --- docs/framework-java_opts.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/framework-java_opts.md b/docs/framework-java_opts.md index 04c8a5aa16..5e268151f5 100644 --- a/docs/framework-java_opts.md +++ b/docs/framework-java_opts.md @@ -25,5 +25,14 @@ The framework can be configured by creating or modifying the [`config/java_opts. | `from_environment` | Whether to append the value of the `JAVA_OPTS` environment variable to the collection of Java options | `java_opts` | The Java options to use when running the application. All values are used without modification when invoking the JVM. The options are specified as a single YAML scalar in plain style or enclosed in single or double quotes. + +## Example +```yaml +# JAVA_OPTS configuration +--- +from_environment: false +java_opts: -Xloggc:$PWD/beacon_gc.log -verbose:gc +``` + [Configuration and Extension]: ../README.md#configuration-and-extension [`config/java_opts.yml`]: ../config/java_opts.yml From dd4cde33dd23f1b04ebb46ee1e375b343e077384 Mon Sep 17 00:00:00 2001 From: Ben Hale Date: Fri, 25 Apr 2014 14:55:22 +0100 Subject: [PATCH 6/6] Add buildpack debugging documentation Previously there was no documentation around debugging the buildpack. This lead to having to provide that information on mailing lists and in issues. This change adds documentation about debug logging and running the buildpack locally. [#69986486][resolves #50] --- README.md | 1 + docs/debugging-the-buildpack.md | 129 ++++++++++++++++++++++++++++++++ lib/java_buildpack/buildpack.rb | 2 +- 3 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 docs/debugging-the-buildpack.md diff --git a/README.md b/README.md index 6527bbd129..099c57f867 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ To learn how to configure various properties of the buildpack, follow the "Confi * [Logging](docs/extending-logging.md) ([Configuration](docs/extending-logging.md#configuration)) * [Repositories](docs/extending-repositories.md) ([Configuration](docs/extending-repositories.md#configuration)) * [Utiltities](docs/extending-utiltities.md) +* [Debugging the Buildpack](docs/debugging-the-buildpack.md) * Related Projects * [Java Buildpack Dependency Builder](https://github.com/cloudfoundry/java-buildpack-dependency-builder) * [Java Test Applications](https://github.com/cloudfoundry/java-test-applications) diff --git a/docs/debugging-the-buildpack.md b/docs/debugging-the-buildpack.md new file mode 100644 index 0000000000..235f881428 --- /dev/null +++ b/docs/debugging-the-buildpack.md @@ -0,0 +1,129 @@ +# Debugging the Buildpack +The buildpack is designed to be easy to configure and extend, but it is still possible that something will go wrong. A configuration property might have an invalid value, or a new component may conflict with an existing one. When these problems happen, the buildpack can tell you quite a bit about what went wrong. + +## Debug Logging +By default the buildpack is very quiet, only informing you about big things going right. Behind the scenes however, it logs an incredible amount of information about each attempt at staging. If your application has staged and is running, but not the way you expected it to, you can get the contents of the debug log by running the following command + +```bash +cf files app/.java-buildpack.log +``` + +If staging fails completely there is no instance that you can query for that file. In that case, you need to cause the [debug logging][d] to print to the console and capture it there. To configure this, run the following command and then push your application again. + +```bash +cf set-env JBP_LOG_LEVEL DEBUG +``` + +In either case, the output will look like the following: + +```text +# Logfile created on 2014-04-25 08:06:06 +0000 by logger.rb/31641 +2014-04-25T08:06:06.01+0000 [ConfigurationUtils] DEBUG No configuration file /tmp/buildpacks/java-buildpack/config/version.yml found +2014-04-25T08:06:06.04+0000 [BuildpackVersion] DEBUG 9d0293b | https://github.com/cloudfoundry/java-buildpack#9d0293b +2014-04-25T08:06:06.04+0000 [Buildpack] DEBUG Environment Variables: {"USER"=>"vcap", "VCAP_APPLICATION"=>"{...}", "STAGING_TIMEOUT"=>"900.0", "PATH"=>"/bin:/usr/bin", "PWD"=>"/home/vcap", "VCAP_SERVICES"=>"{...}", "SHLVL"=>"1", "HOME"=>"/home/vcap", "BUILDPACK_CACHE"=>"/var/vcap/packages/buildpack_cache", "DATABASE_URL"=>"", "MEMORY_LIMIT"=>"512m", "_"=>"/usr/bin/ruby"} +2014-04-25T08:06:06.04+0000 [ConfigurationUtils] DEBUG Configuration from /tmp/buildpacks/java-buildpack/config/components.yml: {"containers"=>["JavaBuildpack::Container::DistZip", "JavaBuildpack::Container::Groovy", "JavaBuildpack::Container::JavaMain", "JavaBuildpack::Container::PlayFramework", "JavaBuildpack::Container::Ratpack", "JavaBuildpack::Container::SpringBoot", "JavaBuildpack::Container::SpringBootCLI", "JavaBuildpack::Container::Tomcat"], "jres"=>["JavaBuildpack::Jre::OpenJdkJRE"], "frameworks"=>["JavaBuildpack::Framework::AppDynamicsAgent", "JavaBuildpack::Framework::JavaOpts", "JavaBuildpack::Framework::MariaDbJDBC", "JavaBuildpack::Framework::NewRelicAgent", "JavaBuildpack::Framework::PlayFrameworkAutoReconfiguration", "JavaBuildpack::Framework::PlayFrameworkJPAPlugin", "JavaBuildpack::Framework::PostgresqlJDBC", "JavaBuildpack::Framework::SpringAutoReconfiguration", "JavaBuildpack::Framework::SpringInsight"]} +2014-04-25T08:06:06.04+0000 [Buildpack] DEBUG Instantiating JavaBuildpack::Jre::OpenJdkJRE +2014-04-25T08:06:06.10+0000 [Buildpack] DEBUG Successfully required JavaBuildpack::Jre::OpenJdkJRE +2014-04-25T08:06:06.10+0000 [ConfigurationUtils] DEBUG Configuration from /tmp/buildpacks/java-buildpack/config/open_jdk_jre.yml: {"repository_root"=>"{default.repository.root}/openjdk/{platform}/{architecture}", "version"=>"1.7.0_+", "memory_sizes"=>{"permgen"=>"64m.."}, "memory_heuristics"=>{"heap"=>75, "permgen"=>10, "stack"=>5, "native"=>10}} +2014-04-25T08:06:06.10+0000 [Buildpack] DEBUG Instantiating JavaBuildpack::Framework::AppDynamicsAgent +2014-04-25T08:06:06.10+0000 [Buildpack] DEBUG Successfully required JavaBuildpack::Framework::AppDynamicsAgent +2014-04-25T08:06:06.10+0000 [ConfigurationUtils] DEBUG Configuration from /tmp/buildpacks/java-buildpack/config/app_dynamics_agent.yml: {"version"=>"3.7.+", "repository_root"=>"{default.repository.root}/app-dynamics", "tier_name"=>"Cloud Foundry"} +2014-04-25T08:06:06.10+0000 [Buildpack] DEBUG Instantiating JavaBuildpack::Framework::JavaOpts +2014-04-25T08:06:06.10+0000 [Buildpack] DEBUG Successfully required JavaBuildpack::Framework::JavaOpts +2014-04-25T08:06:06.10+0000 [ConfigurationUtils] DEBUG Configuration from /tmp/buildpacks/java-buildpack/config/java_opts.yml: {"from_environment"=>true} +2014-04-25T08:06:06.10+0000 [Buildpack] DEBUG Instantiating JavaBuildpack::Framework::MariaDbJDBC +2014-04-25T08:06:06.10+0000 [Buildpack] DEBUG Successfully required JavaBuildpack::Framework::MariaDbJDBC +2014-04-25T08:06:06.10+0000 [ConfigurationUtils] DEBUG Configuration from /tmp/buildpacks/java-buildpack/config/maria_db_jdbc.yml: {"version"=>"1.1.+", "repository_root"=>"{default.repository.root}/mariadb-jdbc"} +2014-04-25T08:06:06.10+0000 [Buildpack] DEBUG Instantiating JavaBuildpack::Framework::NewRelicAgent +2014-04-25T08:06:06.10+0000 [Buildpack] DEBUG Successfully required JavaBuildpack::Framework::NewRelicAgent +2014-04-25T08:06:06.10+0000 [ConfigurationUtils] DEBUG Configuration from /tmp/buildpacks/java-buildpack/config/new_relic_agent.yml: {"version"=>"3.6.+", "repository_root"=>"{default.repository.root}/new-relic"} +2014-04-25T08:06:06.10+0000 [Buildpack] DEBUG Instantiating JavaBuildpack::Framework::PlayFrameworkAutoReconfiguration +2014-04-25T08:06:06.11+0000 [Buildpack] DEBUG Successfully required JavaBuildpack::Framework::PlayFrameworkAutoReconfiguration +2014-04-25T08:06:06.11+0000 [ConfigurationUtils] DEBUG Configuration from /tmp/buildpacks/java-buildpack/config/play_framework_auto_reconfiguration.yml: {"version"=>"0.+", "repository_root"=>"{default.repository.root}/auto-reconfiguration"} +2014-04-25T08:06:06.11+0000 [Buildpack] DEBUG Instantiating JavaBuildpack::Framework::PlayFrameworkJPAPlugin +2014-04-25T08:06:06.11+0000 [Buildpack] DEBUG Successfully required JavaBuildpack::Framework::PlayFrameworkJPAPlugin +2014-04-25T08:06:06.11+0000 [ConfigurationUtils] DEBUG Configuration from /tmp/buildpacks/java-buildpack/config/play_framework_jpa_plugin.yml: {"version"=>"0.+", "repository_root"=>"{default.repository.root}/play-jpa-plugin"} +2014-04-25T08:06:06.12+0000 [Buildpack] DEBUG Instantiating JavaBuildpack::Framework::PostgresqlJDBC +2014-04-25T08:06:06.12+0000 [Buildpack] DEBUG Successfully required JavaBuildpack::Framework::PostgresqlJDBC +2014-04-25T08:06:06.12+0000 [ConfigurationUtils] DEBUG Configuration from /tmp/buildpacks/java-buildpack/config/postgresql_jdbc.yml: {"version"=>"9.3.+", "repository_root"=>"{default.repository.root}/postgresql-jdbc"} +2014-04-25T08:06:06.12+0000 [Buildpack] DEBUG Instantiating JavaBuildpack::Framework::SpringAutoReconfiguration +2014-04-25T08:06:06.15+0000 [Buildpack] DEBUG Successfully required JavaBuildpack::Framework::SpringAutoReconfiguration +2014-04-25T08:06:06.15+0000 [ConfigurationUtils] DEBUG Configuration from /tmp/buildpacks/java-buildpack/config/spring_auto_reconfiguration.yml: {"version"=>"0.+", "repository_root"=>"{default.repository.root}/auto-reconfiguration"} +2014-04-25T08:06:06.15+0000 [ConfigurationUtils] DEBUG Configuration from /tmp/buildpacks/java-buildpack/config/repository.yml: {"default_repository_root"=>"http://download.run.pivotal.io"} +2014-04-25T08:06:06.21+0000 [RepositoryIndex] DEBUG {default.repository.root}/auto-reconfiguration expanded to http://download.run.pivotal.io/auto-reconfiguration +2014-04-25T08:06:06.21+0000 [ConfigurationUtils] DEBUG Configuration from /tmp/buildpacks/java-buildpack/config/cache.yml: {"remote_downloads"=>"enabled"} +2014-04-25T08:06:06.22+0000 [DownloadCache] DEBUG Proxy: , , , +2014-04-25T08:06:06.24+0000 [DownloadCache] DEBUG HTTP: download.run.pivotal.io, 80, {:read_timeout=>10, :connect_timeout=>10, :open_timeout=>10, :use_ssl=>false} +2014-04-25T08:06:06.24+0000 [DownloadCache] DEBUG Request: /auto-reconfiguration/index.yml, {"accept"=>["*/*"], "user-agent"=>["Ruby"]} +2014-04-25T08:06:06.24+0000 [DownloadCache] DEBUG Status: 200 +2014-04-25T08:06:06.24+0000 [DownloadCache] DEBUG Persisting etag: "d093ebc9c94d3050c28898585611701c" +2014-04-25T08:06:06.25+0000 [DownloadCache] DEBUG Persisting last-modified: Thu, 24 Apr 2014 10:47:19 GMT +2014-04-25T08:06:06.25+0000 [DownloadCache] DEBUG Persisting content to /tmp/http:%2F%2Fdownload.run.pivotal.io%2Fauto-reconfiguration%2Findex.yml.cached +2014-04-25T08:06:06.25+0000 [DownloadCache] DEBUG Validated content size 1174 is 1174 +2014-04-25T08:06:06.25+0000 [RepositoryIndex] DEBUG {"0.6.8"=>"http://download.run.pivotal.io/auto-reconfiguration/auto-reconfiguration-0.6.8.jar", "0.7.0"=>"http://download.run.pivotal.io/auto-reconfiguration/auto-reconfiguration-0.7.0.jar", "0.7.1"=>"http://download.run.pivotal.io/auto-reconfiguration/auto-reconfiguration-0.7.1.jar", "0.7.2"=>"http://download.run.pivotal.io/auto-reconfiguration/auto-reconfiguration-0.7.2.jar", "0.8.0"=>"http://download.run.pivotal.io/auto-reconfiguration/auto-reconfiguration-0.8.0.jar", "0.8.1"=>"http://download.run.pivotal.io/auto-reconfiguration/auto-reconfiguration-0.8.1.jar", "0.8.2"=>"http://download.run.pivotal.io/auto-reconfiguration/auto-reconfiguration-0.8.2.jar", "0.8.3"=>"http://download.run.pivotal.io/auto-reconfiguration/auto-reconfiguration-0.8.3.jar", "0.8.4"=>"http://download.run.pivotal.io/auto-reconfiguration/auto-reconfiguration-0.8.4.jar", "0.8.5"=>"http://download.run.pivotal.io/auto-reconfiguration/auto-reconfiguration-0.8.5.jar", "0.8.6"=>"http://download.run.pivotal.io/auto-reconfiguration/auto-reconfiguration-0.8.6.jar", "0.8.7"=>"http://download.run.pivotal.io/auto-reconfiguration/auto-reconfiguration-0.8.7.jar", "0.8.8"=>"http://download.run.pivotal.io/auto-reconfiguration/auto-reconfiguration-0.8.8.jar"} + +... + +2014-04-25T08:06:08.83+0000 [MemoryBucket] DEBUG # +2014-04-25T08:06:08.83+0000 [MemoryBucket] DEBUG # +2014-04-25T08:06:08.83+0000 [MemoryBucket] DEBUG # +2014-04-25T08:06:08.84+0000 [MemoryBucket] DEBUG # +2014-04-25T08:06:08.84+0000 [MemoryBucket] DEBUG # +2014-04-25T08:06:08.84+0000 [Buildpack] DEBUG Release Payload +--- +addons: [] +config_vars: {} +default_process_types: + web: JAVA_HOME=$PWD/.java-buildpack/open_jdk_jre JAVA_OPTS="-Djava.io.tmpdir=$TMPDIR + -XX:OnOutOfMemoryError=$PWD/.java-buildpack/open_jdk_jre/bin/killjava.sh -Xmx382293K + -Xms382293K -XX:MaxPermSize=64M -XX:PermSize=64M -Xss995K -Dalpha=bravo -Dhttp.port=$PORT" + $PWD/.java-buildpack/tomcat/bin/catalina.sh run +``` + +The example content here has been trimmed so that it's not overwhelming, but nearly every component in the buildpack will output something useful as it works. + +## Running the Buildpack Locally +Sometimes logging just isn't going to cut it for debugging. There are times when using a debugger or a local filesystem is the only way to diagnose problems. A simple and surprisingly effective way of troubleshooting buildpacks is actually to skip all of Cloud Foundry and run the buildpack locally. The buildpack API consists of three bash scripts. This means that if you've got a filesystem that looks like what Cloud Foundry will be presented plus a local copy of your buildpack, you can run the bash scripts locally. You might see something like this: + +```bash +$ mkdir -p target/exploded +$ cd target/exploded +$ jar xf ../web-application-1.0.0-BUILD-SNAPSHOT.war + +$ /bin/detect . +java-buildpack=ded1e56-https://github.com/cloudfoundry/java-buildpack#ded1e56 open-jdk-jre=1.7.0_51 spring-auto-reconfiguration=0.8.7 tomcat-instance=7.0.53 tomcat-lifecycle-support=2.1.0_RELEASE tomcat-logging-support=2.1.0_RELEASE + +$ /bin/compile . $TMPDIR +-----> Java Buildpack Version: ded1e56 | https://github.com/cloudfoundry/java-buildpack#ded1e56 +-----> Downloading Open Jdk JRE 1.7.0_51 from http://download.run.pivotal.io/openjdk/mountainlion/x86_64/openjdk-1.7.0_51.tar.gz (5.0s) + Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (0.4s) +-----> Downloading Spring Auto Reconfiguration 0.8.7 from http://download.run.pivotal.io/auto-reconfiguration/auto-reconfiguration-0.8.7.jar (0.3s) + Modifying /WEB-INF/web.xml for Auto Reconfiguration +-----> Downloading Tomcat Instance 7.0.53 from http://download.run.pivotal.io/tomcat/tomcat-7.0.53.tar.gz (1.1s) + Expanding Tomcat to .java-buildpack/tomcat (0.0s) +-----> Downloading Tomcat Lifecycle Support 2.1.0_RELEASE from http://download.run.pivotal.io/tomcat-lifecycle-support/tomcat-lifecycle-support-2.1.0_RELEASE.jar (0.2s) +-----> Downloading Tomcat Logging Support 2.1.0_RELEASE from http://download.run.pivotal.io/tomcat-logging-support/tomcat-logging-support-2.1.0_RELEASE.jar (0.1s) + +$ /bin/release . +--- +addons: [] +config_vars: {} +default_process_types: + web: JAVA_HOME=$PWD/.java-buildpack/open_jdk_jre JAVA_OPTS="-Djava.io.tmpdir=$TMPDIR + -XX:OnOutOfMemoryError=$PWD/.java-buildpack/open_jdk_jre/bin/killjava.sh -XX:MaxPermSize=64M + -XX:PermSize=64M -Dhttp.port=$PORT" $PWD/.java-buildpack/tomcat/bin/catalina.sh + run + +$ JAVA_HOME=$PWD/.java-buildpack/open_jdk_jre JAVA_OPTS="-Djava.io.tmpdir=$TMPDIR -XX:OnOutOfMemoryError=$PWD/.java-buildpack/open_jdk_jre/bin/killjava.sh -XX:MaxPermSize=64M -XX:PermSize=64M -Dhttp.port=$PORT" $PWD/.java-buildpack/tomcat/bin/catalina.sh run +... +``` + +You must be careful that path you run from is the same as the path Cloud Foundry will be presented with. In the case of an exploded filesystem, nothing is different. However, when pushing an archive (e.g. `JAR`, `WAR`, `ZIP`) Cloud Foundry presents the buildpack with an exploded copy of that archive and you must do the same. As described in the **Debug Logging** section above, both file and console debug output are available. To get console output you run the commands as follows: + +```bash +JBP_LOG_LEVEL=DEBUG /bin/detect . +JBP_LOG_LEVEL=DEBUG /bin/compile . $TMPDIR +JBP_LOG_LEVEL=DEBUG /bin/release . +``` + +[d]: extending-logging.md#configuration diff --git a/lib/java_buildpack/buildpack.rb b/lib/java_buildpack/buildpack.rb index 76c3c2db5f..4213c68b01 100644 --- a/lib/java_buildpack/buildpack.rb +++ b/lib/java_buildpack/buildpack.rb @@ -82,7 +82,7 @@ def release 'default_process_types' => { 'web' => command } }.to_yaml - @logger.debug { "Release Payload #{payload}" } + @logger.debug { "Release Payload\n#{payload}" } payload end