Skip to content
This repository was archived by the owner on May 16, 2024. It is now read-only.

sky-uk/shop-java-buildpack

 
 

Repository files navigation

Cloud Foundry Java Buildpack

Build Status Dependency Status Code Climate Code Climate

The java-buildpack is a Cloud Foundry buildpack for running JVM-based applications. It is designed to run many JVM-based applications (Grails, Groovy, Java Main, Play Framework, Spring Boot, and Servlet) with no additional configuration, but supports configuration of the standard components, and extension to add custom components.

Usage

To use this buildpack specify the URI of the repository when pushing an application to Cloud Foundry:

cf push <APP-NAME> -p <ARTIFACT> -b https://github.com/cloudfoundry/java-buildpack.git

Examples

The following are very simple examples for deploying the artifact types that we support.

Configuration and Extension

The buildpack supports configuration and 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 configuration and 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.

To learn how to configure various properties of the buildpack, follow the "Configuration" links below. More information on extending the buildpack is available here.

Additional Documentation

Building Packages

The buildpack can be packaged up so that it can be uploaded to Cloud Foundry using the cf create-buildpack and cf update-buildpack commands. In order to create these packages, the rake package task is used.

Online Package

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:

bundle install
bundle exec rake package
...
Creating build/java-buildpack-cfd6b17.zip

Offline Package

The offline package is a version of the buildpack designed to run without access to a network. It packages the latest version of each dependency (as configured in the config/ directory) and disables remote_downloads. This package is about 180M in size. To create the offline package, use the OFFLINE=true argument:

bundle install
bundle exec rake package OFFLINE=true
...
Creating build/java-buildpack-offline-cfd6b17.zip

Package Versioning

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:

bundle install
bundle exec rake package VERSION=2.1
...
Creating build/java-buildpack-2.1.zip

Running Tests

To run the tests, do the following:

bundle install
bundle exec rake

Setting up New Relic monitoring in shop apps

Note, these steps are only necessary in the absence of a new relic service within a nimbus space. All you should need to do after that is to bind your app to the service (which provides the licence key to the agent):

1. Use this build pack to deploy app
2. Add a user provided new relic service:
	cf cups newrelic-shop -p '{"licenseKey":"Pass the valid key"}'
3. create a proxy, add proxy.txt(can be found in root of this repo)
	cf create-service proxy default proxy-shop
        nimbus2 set-schema proxy-shop /Users/rra08/proxy.txt
4. Bind both services (newrelic-shop and proxy-shop) to your app, preferably through editing your manifest.yml in your application
5. Login to https://rpm.newrelic.com and look for your apps monitoring        

Running Cloud Foundry locally is useful for privately testing new features.

Contributing

Pull requests are welcome; see the contributor guidelines for details.

License

This buildpack is released under version 2.0 of the Apache License.

About

Cloud Foundry buildpack for running Java applications

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Ruby 99.6%
  • Shell 0.4%