Git Product home page Git Product logo

spring-cloud-cloudfoundry-service-broker's Introduction

CircleCI
Codecov
Codacy code quality

Overview

This project provides a framework for building a Spring Boot project to quickly implement a service broker for Cloud Foundry.

This project replaces Spring Boot CF Service Broker.

Compatibility

Getting Started

See the Spring Boot documentation for getting started building a Spring Boot application.

A sample MongoDB service broker project is available.

Add dependencies to your project’s build file.

Maven example:

<dependencies>
    ...
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-service-broker-webmvc</artifactId>
        <version>${springCloudServiceBrokerVersion}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-open-service-broker</artifactId>
        <version>${springCloudServiceBrokerVersion}</version>
        <classifier>tests</classifier>
        <scope>test</scope>
    </dependency>
    ...
</dependencies>

Gradle example:

dependencies {
    ...
    compile("org.springframework.cloud:spring-cloud-starter-service-broker-webmvc:${springCloudServiceBrokerVersion}")
    testCompile(group: "org.springframework.cloud", name: "spring-cloud-open-service-broker", version: "${springCloudServiceBrokerVersion}", classifier: "tests")
    ...
}

Configuring the broker

The framework provides default implementations of most of the components needed to implement a service broker. In Spring Boot fashion, you can override the default behavior by providing your own implementation of Spring beans, and the framework will back away from its defaults.

To start, use the @EnableAutoConfiguration or @SpringBootApplication annotation on the broker’s main application class:

@SpringBootApplication
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

This will trigger the inclusion of the default configuration.

Service beans

The Cloud Foundry service broker API has three main endpoint groupings: catalog management, service instance provisioning/deprovisioning, and service instance binding/unbinding. The broker will need to provide one Spring bean to provide the necessary functionality for each endpoint grouping.

For catalog management, the framework provides a default implementation that requires the broker to just provide an implementation of a Catalog bean. There is an example of this approach in the MongoDB sample broker. To override this default, provide your own bean that implements the CatalogService interface.

For service instance provisioning/deprovisioning, provide a Spring bean that implements the ServiceInstanceService interface. There is no default implementation provided.

For service instance binding/unbinding, provide a Spring bean that implements the ServiceInstanceBindingService interface. If the service broker does not provide any bindable services, this bean can be omitted and a default implementation will be provided.

Security

The project includes the spring-boot-starter-security project. See the Spring Boot Security documentation for configuration options.

The default behavior creates a user called user with a generated password that is logged as an INFO message during app startup. For example:

2014-04-16T10:08:52.54-0600 [App/0]   OUT Using default password for application endpoints: 7c2969c1-d9c7-47e9-9c9e-2cd94a7b6cf1

If you are deploying your service broker to Cloud Foundry as an app, be aware the password is re-generated every time you push the application. Therefore, you need to run cf update-service-broker with the new password after each push.

To see the generated password in the application logs on Cloud Foundry, use one of the following commands:

$ cf logs <broker-app-name>
$ cf logs --recent <broker-app-name>

API version verification

By default, the framework will verify the version of the service broker API for each request it receives. To disable service broker API version header verification, provide a BrokerApiVersion bean that accepts any API version:

@Bean
public BrokerApiVersion brokerApiVersion() {
    return new BrokerApiVersion();
}

Deploying your broker

Follow the documentation to register the broker to Cloud Foundry.

Build

The project is built with Gradle. The Gradle wrapper allows you to build the project on multiple platforms and even if you do not have Gradle installed; run it in place of the gradle command (as ./gradlew) from the root of the main project directory.

To compile the project and run tests

./gradlew build

spring-cloud-cloudfoundry-service-broker's People

Contributors

scottfrederick avatar royclarkson avatar samze avatar s-bortolussi avatar spring-builds avatar making avatar spiegela avatar

Watchers

Ilayaperumal Gopinathan avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.