Skip to content

Commit

Permalink
Default repository root
Browse files Browse the repository at this point in the history
Previously, all of the repository_root declarations in the component
configurations used the common
http://download.pivotal.io.s3.amazonaws.com domain for their
repositories.  Since any user wanting to move the repositories to a
different location (e.g. replication behind a firewall) would have to
change many files, this change abstracts the repository root
declaration.  It does this by introducing a {default.repository.root}
substitution variable for repository_roots.  This placeholder is
substituted with a value configured in config/repository.yml.  The use
of this placeholder is not required.

[#57585912]
  • Loading branch information
nebhale committed Dec 4, 2013
1 parent 7b15293 commit f277c37
Show file tree
Hide file tree
Showing 39 changed files with 271 additions and 194 deletions.
14 changes: 13 additions & 1 deletion .idea/codeStyleSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/dictionaries/bhale.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/runConfigurations/All_Tests.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/runConfigurations/Without_Integration_Tests.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ To learn how to configure various properties of the buildpack, follow the "Confi
* Utilities
* [Caches](docs/util-caches.md) ([Configuration](docs/util-caches.md#configuration))
* [Logging](docs/logging.md) ([Configuration](docs/logging.md#configuration))
* [Repositories](docs/util-repositories.md)
* [Repositories](docs/util-repositories.md) ([Configuration](docs/util-repositories.md#configuration))
* [Other Utiltities](docs/util-other.md)
* [Repository Builder](docs/util-repository-builder.md)
* [Test Applications](docs/util-test-applications.md)
Expand Down
2 changes: 1 addition & 1 deletion config/appdynamics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
# Configuration for the New Relic framework
---
version: 3.7.+
repository_root: "http://download.pivotal.io.s3.amazonaws.com/app-dynamics"
repository_root: "{default.repository.root}/app-dynamics"
tier_name: Cloud Foundry
2 changes: 1 addition & 1 deletion config/groovy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
# Configuration for the Groovy container
---
version: 2.1.+
repository_root: "http://download.pivotal.io.s3.amazonaws.com/groovy"
repository_root: "{default.repository.root}/groovy"
2 changes: 1 addition & 1 deletion config/mariadbjdbc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
# Configuration for the MariaDB JDBC framework
---
version: 1.1.+
repository_root: "http://download.pivotal.io.s3.amazonaws.com/mariadb-jdbc"
repository_root: "{default.repository.root}/mariadb-jdbc"
2 changes: 1 addition & 1 deletion config/newrelic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
# Configuration for the New Relic framework
---
version: 3.1.+
repository_root: "http://download.pivotal.io.s3.amazonaws.com/new-relic"
repository_root: "{default.repository.root}/new-relic"
2 changes: 1 addition & 1 deletion config/openjdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

# Configuration for JRE repositories keyed by vendor
---
repository_root: "http://download.pivotal.io.s3.amazonaws.com/openjdk/{platform}/{architecture}"
repository_root: "{default.repository.root}/openjdk/{platform}/{architecture}"
version: 1.7.0_+
memory_sizes:
permgen: 64m..
Expand Down
2 changes: 1 addition & 1 deletion config/playautoreconfiguration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
# avoid conflicts.
---
version: 0.+
repository_root: "http://download.pivotal.io.s3.amazonaws.com/auto-reconfiguration"
repository_root: "{default.repository.root}/auto-reconfiguration"
2 changes: 1 addition & 1 deletion config/playjpaplugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
# Configuration for the Play JPA Plugin framework
---
version: 0.+
repository_root: "http://download.pivotal.io.s3.amazonaws.com/play-jpa-plugin"
repository_root: "{default.repository.root}/play-jpa-plugin"
2 changes: 1 addition & 1 deletion config/postgresqljdbc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
# Configuration for the Postgresql JDBC framework
---
version: 9.3.+
repository_root: "http://download.pivotal.io.s3.amazonaws.com/postgresql-jdbc"
repository_root: "{default.repository.root}/postgresql-jdbc"
18 changes: 18 additions & 0 deletions config/repository.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Cloud Foundry Java Buildpack
# Copyright (c) 2013 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Repository configuration
---
default_repository_root: http://download.pivotal.io.s3.amazonaws.com
2 changes: 1 addition & 1 deletion config/springautoreconfiguration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
# avoid conflicts.
---
version: 0.+
repository_root: "http://download.pivotal.io.s3.amazonaws.com/auto-reconfiguration"
repository_root: "{default.repository.root}/auto-reconfiguration"
2 changes: 1 addition & 1 deletion config/springbootcli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
# avoid conflicts.
---
version: 0.5.0_+
repository_root: "http://download.pivotal.io.s3.amazonaws.com/spring-boot-cli"
repository_root: "{default.repository.root}/spring-boot-cli"
4 changes: 2 additions & 2 deletions config/tomcat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# Configuration for the Tomcat container
---
version: 7.0.+
repository_root: "http://download.pivotal.io.s3.amazonaws.com/tomcat"
repository_root: "{default.repository.root}/tomcat"
support:
version: 1.1.+
repository_root: "http://download.pivotal.io.s3.amazonaws.com/tomcat-buildpack-support"
repository_root: "{default.repository.root}/tomcat-buildpack-support"
25 changes: 13 additions & 12 deletions docs/container-groovy.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
The Groovy Container allows a uncompiled (i.e. `*.groovy`) to be run.

<table>
<tr>
<td><strong>Detection Criteria</strong></td><td><ul>
<li>A <tt>.groovy</tt> file exists which has a <tt>main()</tt> method, or</li>
<li>A <tt>.groovy</tt> file exists which is not a POGO (a POGO contains one or more classes), or</li>
<li>A <tt>.groovy</tt> file exists which has a shebang (<tt>#!</tt>) declaration</li>
</ul>and<ul>
<li>No <tt>.class</tt> files exist</li>
</ul></td>
</tr>
<tr>
<td><strong>Tags</strong></td><td><tt>groovy=&lang;version&rang;</tt></td>
</tr>
<tr>
<td><strong>Detection Criteria</strong></td>
<td><ul>
<li>A <tt>.groovy</tt> file exists which has a <tt>main()</tt> method, or</li>
<li>A <tt>.groovy</tt> file exists which is not a POGO (a POGO contains one or more classes), or</li>
<li>A <tt>.groovy</tt> file exists which has a shebang (<tt>#!</tt>) declaration</li>
</ul>and<ul>
<li>No <tt>.class</tt> files exist</li>
</ul></td>
</tr>
<tr>
<td><strong>Tags</strong></td><td><tt>groovy=&lang;version&rang;</tt></td>
</tr>
</table>
Tags are printed to standard output by the buildpack detect script

Expand Down
3 changes: 1 addition & 2 deletions docs/container-play.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ The Play Container allows Play applications to be run.

<table>
<tr>
<td><strong>Detection Criteria</strong></td><td>The Play start script and the Play runtime JAR exist in the appropriate subdirectories of the application
directory or one of its immediate subdirectories (but not in both)</td>
<td><strong>Detection Criteria</strong></td><td>The Play start script and the Play runtime JAR exist in the appropriate subdirectories of the application directory or one of its immediate subdirectories (but not in both)</td>
</tr>
<tr>
<td><strong>Tags</strong></td><td><tt>play-framework=&lt;version&gt;</tt></td>
Expand Down
25 changes: 13 additions & 12 deletions docs/container-spring-boot-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
The Spring Boot CLI Container runs one or more Groovy (i.e. `*.groovy`) files using Spring Boot CLI.

<table>
<tr>
<td><strong>Detection Criteria</strong></td><td><ul>
<li>The application has one or more <tt>.groovy</tt> files in the root directory, and</li>
<li>All the application's <tt>.groovy</tt> files in the root directory are POGOs (a POGO contains one or more classes), and</li>
<li>None of the application's <tt>.groovy</tt> files in the root directory contain a <tt>main</tt> method, and</li>
<li>None of the application's <tt>.groovy</tt> files in the root directory contain a shebang (`#!`) declaration, and</li>
<li>The application does not have a <tt>WEB-INF</tt> subdirectory of its root directory.</li>
</ul></td>
</tr>
<tr>
<td><strong>Tags</strong></td><td><tt>spring-boot-cli=&lang;version&rang;</tt></td>
</tr>
<tr>
<td><strong>Detection Criteria</strong></td>
<td><ul>
<li>The application has one or more <tt>.groovy</tt> files in the root directory, and</li>
<li>All the application's <tt>.groovy</tt> files in the root directory are POGOs (a POGO contains one or more classes), and</li>
<li>None of the application's <tt>.groovy</tt> files in the root directory contain a <tt>main</tt> method, and</li>
<li>None of the application's <tt>.groovy</tt> files in the root directory contain a shebang (`#!`) declaration, and</li>
<li>The application does not have a <tt>WEB-INF</tt> subdirectory of its root directory.</li>
</ul></td>
</tr>
<tr>
<td><strong>Tags</strong></td><td><tt>spring-boot-cli=&lang;version&rang;</tt></td>
</tr>
</table>
Tags are printed to standard output by the buildpack detect script.

Expand Down
18 changes: 9 additions & 9 deletions docs/extending.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,6 @@ This base class is recommended for use by all components. It ensures that each
### [`lib/java_buildpack/versioned_dependency_component.rb`][]
This base class is recommended for use by any component that uses the buildpack [repository support][] to download a dependency. It ensures that each component has a `@version` and `@uri` that were resolved from the repository specified in the component's configuration. It also implements the `detect` method with an standard implementation.

[`config/components.yml`]: ../config/components.yml
[`JavaBuildpack::Application`]: ../lib/java_buildpack/application.rb
[`lib/java_buildpack/base_component.rb`]: ../lib/java_buildpack/base_component.rb
[`lib/java_buildpack/container`]: ../lib/java_buildpack/container
[`lib/java_buildpack/framework`]: ../lib/java_buildpack/framework
[`lib/java_buildpack/jre`]: ../lib/java_buildpack/jre
[`lib/java_buildpack/versioned_dependency_component.rb`]: ../lib/java_buildpack/versioned_dependency_component.rb
[repository support]: util-repositories.md

## Examples
The following example components are relatively simple and good for copying as the basis for a new component.

Expand All @@ -90,4 +81,13 @@ The [Java Main Class Container](container-java-main.md) ([`lib/java_buildpack/co

The [Spring Boot CLI Container](container-spring-boot-cli.md) ([`lib/java_buildpack/container/spring_boot_cli.rb`](../lib/java_buildpack/container/spring_boot_cli.rb)) extends the [`VersionedDependencyComponent`](../lib/java_buildpack/versioned_dependency_component.rb) base class described above.

[`config/components.yml`]: ../config/components.yml
[`JavaBuildpack::Application`]: ../lib/java_buildpack/application.rb
[`lib/java_buildpack/base_component.rb`]: ../lib/java_buildpack/base_component.rb
[`lib/java_buildpack/container`]: ../lib/java_buildpack/container
[`lib/java_buildpack/framework`]: ../lib/java_buildpack/framework
[`lib/java_buildpack/jre`]: ../lib/java_buildpack/jre
[`lib/java_buildpack/versioned_dependency_component.rb`]: ../lib/java_buildpack/versioned_dependency_component.rb
[repository support]: util-repositories.md


4 changes: 3 additions & 1 deletion docs/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ original repository. This will ensure that your fork runs with any security fixe

## Security and Logs

See [Sensitive Information in Logs](logging.md#Sensitive-Information-in-Logs).
See [Sensitive Information in Logs][].

[Sensitive Information in Logs]: logging.md#Sensitive-Information-in-Logs
23 changes: 11 additions & 12 deletions docs/util-caches.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ JavaBuildpack::Util::DownloadCache.new().get(uri) do |file|
end
```

## Configuration
For general information on configuring the buildpack, refer to [Configuration and Extension][].

Caching can be configured by modifying the [`config/cache.yml`][] file.

| Name | Description
| ---- | -----------
| `remote_downloads` | This property can take the value `enabled` or `disabled`. <p>The default value of `enabled` means that the buildpack will check the internet connection and remember the result for the remainder of the buildpack invocation. If the internet is available, it will then be used to download files. If the internet is not available, cache will be consulted instead. <p>Alternatively, the property may be set to `disabled` which avoids the check for an internet connection, does not attempt downloads, and consults the cache instead.

## `JavaBuildpack::Util::DownloadCache`
The [`DownloadCache`][] is the most generic of the three caches. It allows you to create a cache that persists files any that write access is available. The constructor signature looks the following:

Expand All @@ -48,18 +57,6 @@ The [`DownloadCache`][] is the most generic of the three caches. It allows you
def initialize(cache_root = Dir.tmpdir)
```

### Configuration
For general information on configuring the buildpack, refer to [Configuration and Extension][].

Caching can be configured by modifying the [`config/cache.yml`][] file.

| Name | Description
| ---- | -----------
| `remote_downloads` | This property can take the value `enabled` or `disabled`. <br><br>The default value of `enabled` means that the buildpack will check the internet connection and remember the result for the remainder of the buildpack invocation. If the internet is available, it will then be used to download files. If the internet is not available, cache will be consulted instead. <br><br>Alternatively, the property may be set to `disabled` which avoids the check for an internet connection, does not attempt downloads, and consults the cache instead.

[Configuration and Extension]: ../README.md#Configuration-and-Extension
[`config/cache.yml`]: ../config/cache.yml

## `JavaBuildpack::Util::ApplicationCache`
The [`ApplicationCache`][] is a cache that persists files into the application cache passed to the `compile` script. It examines `ARGV[1]` for the cache location and configures itself accordingly.

Expand All @@ -83,5 +80,7 @@ def initialize
```

[`ApplicationCache`]: ../lib/java_buildpack/util/application_cache.rb
[`config/cache.yml`]: ../config/cache.yml
[`DownloadCache`]: ../lib/java_buildpack/util/download_cache.rb
[`GlobalCache`]: ../lib/java_buildpack/util/global_cache.rb
[Configuration and Extension]: ../README.md#Configuration-and-Extension
5 changes: 0 additions & 5 deletions docs/util-other.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,9 @@ The `GroovyUtils` class provides a set of methods for finding groovy files and d
## [`JavaBuildpack::Util::Properties`][]
The `Properties` class provides a Ruby class that can read in a Java properties file and acts as a `Hash` with that data.

## [`JavaBuildpack::Util::ResourceUtils`][]
The `ResourceUtils` class provides an abstract around the `resources` directory of the buildpack. It eanbles the reading and copying of files located in that directory.

## [`JavaBuildpack::Util::ServiceUtils`][]
The `ServiceUtils` class provides a set of methods for finding a given service in the `VCAP_SERVICES` payload.

[`JavaBuildpack::Util::GroovyUtils`]: ../lib/java_buildpack/util/groovy_utils.rb
[`JavaBuildpack::Util::PlayUtils`]: ../lib/java_buildpack/util/play_utils.rb
[`JavaBuildpack::Util::Properties`]: ../lib/java_buildpack/util/properties.rb
[`JavaBuildpack::Util::ResourceUtils`]: ../lib/java_buildpack/util/resource_utils.rb
[`JavaBuildpack::Util::ServiceUtils`]: ../lib/java_buildpack/util/service_utils.rb
24 changes: 22 additions & 2 deletions docs/util-repositories.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ An example filesystem might look like:
```

## Usage

The main class used when dealing with a repository is [`JavaBuildpack::Repository::ConfiguredItem`][]. It provides a single method that is used to resolve a specific version and its URI.

```ruby
Expand Down Expand Up @@ -48,6 +47,24 @@ version, uri = JavaBuildpack::Repository::ConfiguredItem.find_item(configuration
end
```

## Wildcards
`repository_root` declarations in component configuration files can have variables in them. These variables are replaced by the repository infrastructure and the resulting URI is used when retrieving the repository index.

| Variable | Description |
| -------- | ----------- |
| `{default.repository.root}` | The common root for all repositories. Currently defaults to `http://download.pivotal.io.s3.amazonaws.com`.
| `{platform}` | The platform that the application is running on. Currently detects `centos6`, `lucid`, `mountainlion`, and `precise`.
| `{architecture}` | The architecture of the system as returned by Ruby. The value is typically one of `x86_64` or `x86`.

## Configuration
For general information on configuring the buildpack, refer to [Configuration and Extension][].

Repositories can be configured by modifying the [`config/repository.yml`][] file.

| Name | Description
| ---- | -----------
| `default_repository_root` | This property can take a URI that is used as a common root for all of the repositories used by the buildpack. The value is substituted for the `{default.repository.root}` variable in `repository_root` declarations.

## Version Syntax and Ordering
Versions are composed of major, minor, micro, and optional qualifier parts (`<major>.<minor>.<micro>[_<qualifier>]`). The major, minor, and micro parts must be numeric. The qualifier part is composed of letters, digits, and hyphens. The lexical ordering of the qualifier is:

Expand All @@ -66,5 +83,8 @@ In addition to declaring a specific versions to use, you can also specify a boun
| `1.7.0_+` | Selects the greatest available version less than `1.7.1`. Use this syntax to stay up to date with the latest security releases in a particular version.


[example]: http://download.pivotal.io.s3.amazonaws.com/openjdk/lucid/x86_64/index.yml
[`config/repository.yml`]: ../config/repository.yml
[`JavaBuildpack::Repository::ConfiguredItem`]: ../lib/java_buildpack/repository/configured_item.rb
[Configuration and Extension]: ../README.md#Configuration-and-Extension
[example]: http://download.pivotal.io.s3.amazonaws.com/openjdk/lucid/x86_64/index.yml

Loading

0 comments on commit f277c37

Please sign in to comment.