Skip to content

Commit e682e24

Browse files
committed
Merge pull request #3 from willtf/secfix
Merging secfix branch
2 parents c6cbc34 + 0156133 commit e682e24

144 files changed

Lines changed: 2911 additions & 406 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.idea/dictionaries/bhale.xml

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/encodings.xml

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ AllCops:
99
- 'build/**/*'
1010
- 'vendor/**/*'
1111
Metrics/AbcSize:
12-
Max: 18
12+
Max: 22
1313
Metrics/ClassLength:
1414
Max: 200
1515
Metrics/CyclomaticComplexity:

README.md

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The `java-buildpack` is a [Cloud Foundry][] buildpack for running JVM-based appl
1010
To use this buildpack specify the URI of the repository when pushing an application to Cloud Foundry:
1111

1212
```bash
13-
cf push <APP-NAME> -p <ARTIFACT> -b https://github.com/cloudfoundry/java-buildpack.git
13+
$ cf push <APP-NAME> -p <ARTIFACT> -b https://github.com/cloudfoundry/java-buildpack.git
1414
```
1515

1616
## Examples
@@ -27,15 +27,39 @@ The following are _very_ simple examples for deploying the artifact types that w
2727
## Configuration and Extension
2828
The buildpack supports extension through the use of Git repository forking. The easiest way to accomplish this is to use [GitHub's forking functionality][] to create a copy of this repository. Make the required extension changes in the copy of the repository. Then specify the URL of the new repository when pushing Cloud Foundry applications. If the modifications are generally applicable to the Cloud Foundry community, please submit a [pull request][] with the changes.
2929

30-
Buildpack configuration can be overridden with an environment variable matching the configuration file you wish to override minus the `.yml` extension and with a prefix of `JBP_CONFIG`. It is not possible to add new configuration properties and properties with `nil` or empty values will be ignored by the buildpack. The value of the variable should be valid inline yaml. For example, to change the default version of Java to 7 and adjust the memory heuristics apply this environment variable to the application.
30+
Buildpack configuration can be overridden with an environment variable matching the configuration file you wish to override minus the `.yml` extension and with a prefix of `JBP_CONFIG`. It is not possible to add new configuration properties and properties with `nil` or empty values will be ignored by the buildpack. The value of the variable should be valid inline yaml, referred to as `flow style` in the yaml spec ([Wikipedia] has a good description of this yaml syntax). For example, to change the default version of Java to 7 and adjust the memory heuristics apply this environment variable to the application.
3131

32-
```cf set-env my-application JBP_CONFIG_OPEN_JDK_JRE '[jre: {version: 1.7.0_+}, memory_calculator: {memory_heuristics: {heap: 85, stack: 10}}]'```
32+
```bash
33+
$ cf set-env my-application JBP_CONFIG_OPEN_JDK_JRE '{jre: { version: 1.7.0_+ }}'
34+
```
3335

3436
If the key or value contains a special character such as `:` it should be escaped with double quotes. For example, to change the default repository path for the buildpack.
3537

36-
```cf set-env my-application JBP_CONFIG_REPOSITORY '[ default_repository_root: "http://repo.example.io" ]'```
38+
```bash
39+
$ cf set-env my-application JBP_CONFIG_REPOSITORY '{default_repository_root: "http://repo.example.io"}'
40+
```
41+
42+
If the key or value contains an environment variable that you want to bind at runtime you need to escape it from your shell. For example, to add command line arguments containing an environment variable to a [Java Main](docs/container-java_main.md) application.
43+
44+
```bash
45+
$ cf set-env my-application JBP_CONFIG_JAVA_MAIN '{arguments: "-server.port=\$PORT -foo=bar"}'
46+
```
47+
48+
Environment variable can also be specified in the applications `manifest` file. For example, to specify an environment variable in an applications manifest file that disables Auto-reconfiguration.
3749

38-
Environment variable can also be specified in the applications `manifest` file. See the [Environment Variables][] documentation for more information.
50+
```bash
51+
env:
52+
JBP_CONFIG_SPRING_AUTO_RECONFIGURATION: '{enabled: false}'
53+
```
54+
55+
This final example shows how to change the version of Tomcat that is used by the buildpack with an environment variable specified in the applications manifest file.
56+
57+
```bash
58+
env:
59+
JBP_CONFIG_TOMCAT: '{tomcat: { version: 8.0.+ }}'
60+
```
61+
62+
See the [Environment Variables][] documentation for more information.
3963

4064
To learn how to configure various properties of the buildpack, follow the "Configuration" links below. More information on extending the buildpack is available [here](docs/extending.md).
4165

@@ -53,17 +77,21 @@ To learn how to configure various properties of the buildpack, follow the "Confi
5377
* [Tomcat](docs/container-tomcat.md) ([Configuration](docs/container-tomcat.md#configuration))
5478
* Standard Frameworks
5579
* [AppDynamics Agent](docs/framework-app_dynamics_agent.md) ([Configuration](docs/framework-app_dynamics_agent.md#configuration))
56-
* [Introscope Agent](docs/framework-introscope_agent.md) ([Configuration](docs/framework-introscope_agent.md#configuration))
80+
* [Debug](docs/framework-debug.md) ([Configuration](docs/framework-debug.md#configuration))
5781
* [DynaTrace Agent](docs/framework-dyna_trace_agent.md) ([Configuration](docs/framework-dyna_trace_agent.md#configuration))
82+
* [Introscope Agent](docs/framework-introscope_agent.md) ([Configuration](docs/framework-introscope_agent.md#configuration))
5883
* [Java Options](docs/framework-java_opts.md) ([Configuration](docs/framework-java_opts.md#configuration))
5984
* [JRebel Agent](docs/framework-jrebel_agent.md) ([Configuration](docs/framework-jrebel_agent.md#configuration))
85+
* [JMX](docs/framework-jmx.md) ([Configuration](docs/framework-jmx.md#configuration))
86+
* [Luna Security Provider](docs/framework-luna_security_provider.md) ([Configuration](docs/framework-luna_security_provider.md#configuration))
6087
* [MariaDB JDBC](docs/framework-maria_db_jdbc.md) ([Configuration](docs/framework-maria_db_jdbc.md#configuration))
6188
* [New Relic Agent](docs/framework-new_relic_agent.md) ([Configuration](docs/framework-new_relic_agent.md#configuration))
6289
* [Play Framework Auto Reconfiguration](docs/framework-play_framework_auto_reconfiguration.md) ([Configuration](docs/framework-play_framework_auto_reconfiguration.md#configuration))
6390
* [Play Framework JPA Plugin](docs/framework-play_framework_jpa_plugin.md) ([Configuration](docs/framework-play_framework_jpa_plugin.md#configuration))
6491
* [PostgreSQL JDBC](docs/framework-postgresql_jdbc.md) ([Configuration](docs/framework-postgresql_jdbc.md#configuration))
6592
* [Spring Auto Reconfiguration](docs/framework-spring_auto_reconfiguration.md) ([Configuration](docs/framework-spring_auto_reconfiguration.md#configuration))
6693
* [Spring Insight](docs/framework-spring_insight.md)
94+
* [YourKit Profiler](docs/framework-your_kit_profiler.md) ([Configuration](docs/framework-your_kit_profiler.md#configuration))
6795
* Standard JREs
6896
* [OpenJDK](docs/jre-open_jdk_jre.md) ([Configuration](docs/jre-open_jdk_jre.md#configuration))
6997
* [Oracle](docs/jre-oracle_jre.md) ([Configuration](docs/jre-oracle_jre.md#configuration))
@@ -91,8 +119,8 @@ The buildpack can be packaged up so that it can be uploaded to Cloud Foundry usi
91119
The online package is a version of the buildpack that is as minimal as possible and is configured to connect to the network for all dependencies. This package is about 50K in size. To create the online package, run:
92120

93121
```bash
94-
bundle install
95-
bundle exec rake package
122+
$ bundle install
123+
$ bundle exec rake package
96124
...
97125
Creating build/java-buildpack-cfd6b17.zip
98126
```
@@ -103,8 +131,8 @@ The offline package is a version of the buildpack designed to run without access
103131
To pin the version of dependencies used by the buildpack to the ones currently resolvable use the `PINNED=true` argument. This will update the [`config/` directory][] to contain exact version of each dependency instead of version ranges.
104132

105133
```bash
106-
bundle install
107-
bundle exec rake package OFFLINE=true PINNED=true
134+
$ bundle install
135+
$ bundle exec rake package OFFLINE=true PINNED=true
108136
...
109137
Creating build/java-buildpack-offline-cfd6b17.zip
110138
```
@@ -113,8 +141,8 @@ Creating build/java-buildpack-offline-cfd6b17.zip
113141
Keeping track of different versions of the buildpack can be difficult. To help with this, the rake `package` task puts a version discriminator in the name of the created package file. The default value for this discriminator is the current Git hash (e.g. `cfd6b17`). To change the version when creating a package, use the `VERSION=<VERSION>` argument:
114142

115143
```bash
116-
bundle install
117-
bundle exec rake package VERSION=2.1
144+
$ bundle install
145+
$ bundle exec rake package VERSION=2.1
118146
...
119147
Creating build/java-buildpack-2.1.zip
120148
```
@@ -123,8 +151,8 @@ Creating build/java-buildpack-2.1.zip
123151
To run the tests, do the following:
124152

125153
```bash
126-
bundle install
127-
bundle exec rake
154+
$ bundle install
155+
$ bundle exec rake
128156
```
129157

130158
[Running Cloud Foundry locally][] is useful for privately testing new features.
@@ -149,3 +177,4 @@ This buildpack is released under version 2.0 of the [Apache License][].
149177
[Pull requests]: http://help.github.com/send-pull-requests
150178
[Running Cloud Foundry locally]: http://docs.cloudfoundry.org/deploying/run-local.html
151179
[Spring Boot]: http://projects.spring.io/spring-boot/
180+
[Wikipedia]: https://en.wikipedia.org/wiki/YAML#Basic_components_of_YAML

config/app_dynamics_agent.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
# Configuration for the New Relic framework
16+
# Configuration for the AppDynamics framework
1717
---
18-
version: 4.0.+
18+
version: 4.1.8_5
1919
repository_root: ! '{default.repository.root}/app-dynamics'
20-
default_node_name: ! '$(expr "$VCAP_APPLICATION" : ''.*instance_index[": ]*\([[:digit:]]*\).*'')'
21-
default_tier_name: CloudFoundry
20+
default_application_name:
21+
default_node_name: $(ruby -e "require 'json' ; a = JSON.parse(ENV['VCAP_APPLICATION']);
22+
puts \"#{a['application_name']}:#{a['instance_index']}\"")
23+
default_tier_name:

config/components.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,23 @@ jres:
3131
- "JavaBuildpack::Jre::OpenJdkJRE"
3232
# - "JavaBuildpack::Jre::OracleJRE"
3333

34+
# Frameworks are processed in order. Any Java Opts added by the JavaOpts framework will be specified in the start
35+
# command after any Java Opts added by previous frameworks.
36+
3437
frameworks:
3538
- "JavaBuildpack::Framework::AppDynamicsAgent"
36-
# - "JavaBuildpack::Framework::IntroscopeAgent"
39+
- "JavaBuildpack::Framework::Debug"
3740
# - "JavaBuildpack::Framework::DynaTraceAgent"
38-
- "JavaBuildpack::Framework::JavaOpts"
41+
# - "JavaBuildpack::Framework::IntroscopeAgent"
42+
- "JavaBuildpack::Framework::Jmx"
3943
- "JavaBuildpack::Framework::JrebelAgent"
44+
# - "JavaBuildpack::Framework::LunaSecurityProvider"
4045
- "JavaBuildpack::Framework::MariaDbJDBC"
4146
- "JavaBuildpack::Framework::NewRelicAgent"
4247
- "JavaBuildpack::Framework::PlayFrameworkAutoReconfiguration"
4348
- "JavaBuildpack::Framework::PlayFrameworkJPAPlugin"
4449
- "JavaBuildpack::Framework::PostgresqlJDBC"
4550
- "JavaBuildpack::Framework::SpringAutoReconfiguration"
4651
- "JavaBuildpack::Framework::SpringInsight"
52+
- "JavaBuildpack::Framework::YourKitProfiler"
53+
- "JavaBuildpack::Framework::JavaOpts"

config/debug.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Cloud Foundry Java Buildpack
2+
# Copyright 2014-2015 the original author or authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# Debug configuration
17+
---
18+
enabled: false
19+
port: 8000
20+
suspend: false

config/dyna_trace_agent.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@
1717
---
1818
version: 6.1.0_+
1919
repository_root: ""
20+
default_agent_name:

config/groovy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515

1616
# Configuration for the Groovy container
1717
---
18-
version: 2.4.+
18+
version: 2.4.5
1919
repository_root: ! '{default.repository.root}/groovy'

config/introscope_agent.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
---
1818
repository_root: ""
1919
version: 9.7.+
20-
default_agent_name: "$(expr \"$VCAP_APPLICATION\" : \'.*application_name[\": ]*\\([A-Za-z0-9_-]*\\).*\')"
20+
default_agent_name: ! '$(ruby -e "require ''json'' ; puts JSON.parse(ENV[''VCAP_APPLICATION''])[''application_name'']")'

0 commit comments

Comments
 (0)