First draft of reference documentation

Fixes #111
This commit is contained in:
Ben Klein
2019-02-01 16:07:32 -06:00
committed by Scott Frederick
parent 219aa16e1e
commit 2315ec7324
7 changed files with 220 additions and 8 deletions

View File

@@ -0,0 +1,6 @@
[[advertising-services]]
== Advertising Services
The service broker catalog, through which the broker advertises service offerings, is provided by Spring Cloud Open Service Broker. In App Broker configuration (using properties under `spring.cloud.appbroker.services`), you can list services and their plans. This listing must correspond to the service and service plan listing given to Spring Cloud Open Service Broker (using properties under `spring.cloud.openservicebroker.catalog.services`).
For more information about configuring the broker catalog, see the {scosb-docs}#service-catalog[Spring Cloud Open Service Broker documentation].

View File

@@ -1,2 +0,0 @@
[[data-storage]]
== Data Storage

View File

@@ -1,4 +1,21 @@
[[deployment-platforms]]
== Deployment Platforms
You can configure details of deployment platforms in App Broker configuration properties. These properties are under `spring.cloud.appbroker.deployer`. Currently, Spring Cloud App Broker supports only Cloud Foundry as a deployment platform.
To configure a Cloud Foundry deployment platform, use properties under `spring.cloud.appbroker.deployer.cloudfoundry`, as in the following example:
[subs=+quotes]
```yml
spring:
cloud:
appbroker:
deployer:
*cloudfoundry:*
*api-host: api.sys.example.com*
*api-port: 443*
*username: admin*
*password: adminpass*
*default-org: test*
*default-space: development*
```

View File

@@ -12,6 +12,7 @@
:source: {github}/tree/{branch-or-tag}
:scosb: https://cloud.spring.io/spring-cloud-open-service-broker/
:scosb-href: {scosb}[Spring Cloud Open Service Broker]
:scosb-docs: https://docs.spring.io/spring-cloud-open-service-broker/docs/current/reference/html5/
:osbapi: https://www.openservicebrokerapi.org/
:osbapi-href: {osbapi}[Open Service Broker API]
:springboot: https://projects.spring.io/spring-boot/
@@ -25,8 +26,7 @@ Spring Cloud App Broker is a framework for building {springboot-href} applicatio
include::introduction.adoc[]
include::getting-started.adoc[]
include::advertising-services.adoc[]
include::service-instances.adoc[]
include::service-bindings.adoc[]
include::service-broker-security.adoc[]
include::data-storage.adoc[]
include::deployment-platforms.adoc[]

View File

@@ -1,6 +1,14 @@
[[service-bindings]]
== Service Bindings
=== Service Binding Creation
By default, Spring Cloud App Broker does not include functionality for managing bindings to its service instances. App Broker provides interfaces which service broker authors can implement to control service bindings.
=== Service Binding Deletion
//TODO: Move App Broker API docs base to AsciiDoc attribute.
=== Creating a Service Binding
The service broker application must implement the https://docs.spring.io/spring-cloud-app-broker/docs/1.0.0.BUILD-SNAPSHOT/api/org/springframework/cloud/appbroker/service/CreateServiceInstanceAppBindingWorkflow.html[`CreateServiceInstanceAppBindingWorkflow`] interface.
=== Deleting a Service Binding
The service broker application must implement the https://docs.spring.io/spring-cloud-app-broker/docs/1.0.0.BUILD-SNAPSHOT/api/org/springframework/cloud/appbroker/service/DeleteServiceInstanceBindingWorkflow.html[`DeleteServiceInstanceBindingWorkflow`] interface.

View File

@@ -1,2 +0,0 @@
[[service-broker-security]]
== Service Broker Security

View File

@@ -1,6 +1,8 @@
[[service-instances]]
== Service Instances
You can configure details of services, including apps to deploy, app deployment details, and backing services to create, in App Broker configuration properties. These properties are generally under `spring.cloud.appbroker.services`.
=== Configuring App Deployment
Deployment details for a backing application can be configured statically in the service broker's application configuration and dynamically using service instance parameters and customization implementations.
@@ -127,16 +129,199 @@ The following table lists properties that can be set for all or specific app dep
===== Environment Configuration
You can provide environment variables to be set on a deployed app. Environment variables are set using properties under `environment` for the deployed app, as in the following example:
[subs=+quotes]
```yml
spring:
cloud:
appbroker:
services:
- service-name: example
plan-name: standard
apps:
- name: example-service-app1
path: classpath:app1.jar
*environment:*
*logging.level.spring.security: DEBUG*
*spring.profiles.active: cloud*
```
===== Service Configuration
You can configure services which should be bound to a deployed app. Services are configured using properties under `services` for the deployed app, as in the following example:
[subs=+quotes]
```yml
spring:
cloud:
appbroker:
services:
- service-name: example
plan-name: standard
apps:
- name: example-service-app1
path: classpath:app1.jar
*services:*
*- service-instance-name: example-db*
*name: mysql*
*plan: small*
*parameters:*
*param-key: param-value*
```
==== Dynamic Customization
To customize the backing application deployment using information that is only available when performing a service broker operation or that must be generated per service instance, you can use the service broker application configuration to provide the names of customization implementations.
===== Backing Application Target
You can configure the target location for backing applications (in Cloud Foundry, an org and space) using a `target` specification, as in the following example:
[subs=+quotes]
```yml
spring:
cloud:
appbroker:
services:
- service-name: example
plan-name: standard
*target:*
*- name: SpacePerServiceInstance*
apps:
apps:
- name: example-service-app1
path: classpath:app1.jar
```
By default (if you do not provide a `target` specification), all backing applications are deployed to the default target specified under `spring.cloud.appbroker.deployer`. For Cloud Foundry, this is the org named by `spring.cloud.appbroker.deployer.cloudfoundry.default-org` and the space named by `spring.cloud.appbroker.deployer.cloudfoundry.default-space`.
====== The `SpacePerServiceInstance` Target
If you use the `SpacePerServiceInstance` target, App Broker will deploy backing applications to a unique target location that is named using the service instance GUID provided by the platform at service instance create time. For Cloud Foundry, this target location will be the org named by `spring.cloud.appbroker.deployer.cloudfoundry.default-org` and a new space created using the service instance GUID as the space name.
===== Service Instance Parameters
When a user provides parameters while creating or updating a service instance, App Broker can transform these parameters into details of the backing app deployment using parameters transformers. You can configure parameters transformers using properties under `parameters-transformers`, as in the following example:
[subs=+quotes]
```yml
spring:
cloud:
appbroker:
services:
- service-name: example
plan-name: standard
apps:
- name: example-service-app1
path: classpath:app1.jar
*parameters-transformers:*
*- name: EnvironmentMapping*
*args:*
*- include: parameter1,parameter2*
*- name: PropertyMapping*
*args:*
*- include: count,memory*
```
In this example, the named `parameters-transformers` refer to Java objects which have been contributed to the Spring application context. A parameters transformer can accept one or more arguments that configure its behavior, and can modify any aspect of the backing application deployment (properties, environment variables, services, etc.).
====== The `EnvironmentMapping` Parameters Transformer
The `EnvironmentMapping` parameters transformer populates environment variables on the backing application from parameters provided when a service instance is created or updated. It supports a single argument, `include`, which specifies the names of parameters that will be mapped to environment variables.
====== The `PropertyMapping` Parameters Transformer
The `PropertyMapping` parameters transformer sets deployment properties of the backing application from parameters provided when a service instance is created or updated. It supports a single argument, `include`, which specifies the names of deployment properties that should be recognized.
===== Credentials Generation
App Broker can generate and assign unique credentials for each backing app deployment. You can configure credential providers using properties under `credential-providers`, as in the following example:
[subs=+quotes]
```yml
spring:
cloud:
appbroker:
services:
- service-name: example
plan-name: standard
apps:
- name: example-service-app1
path: classpath:app1.jar
*credential-providers:*
*- name: SpringSecurityBasicAuth*
*- name: SpringSecurityOAuth2*
```
In this example, the named `credential-providers` refer to Java objects which have been contributed to the Spring application context. A credential provider can accept one or more arguments that configure its behavior. A credential provider typically generates credentials and set environment variables on the backing application.
====== The `SpringSecurityBasicAuth` Credential Provider
The `SpringSecurityBasicAuth` credential provider generates a username and password and sets Spring Boot security properties to the generated values. Username and password generation can be configured with arguments, as in the following example:
[subs=+quotes]
```yml
spring:
cloud:
appbroker:
services:
- service-name: example
plan-name: standard
apps:
- name: example-service-app1
path: classpath:app1.jar
*credential-providers:*
*- name: SpringSecurityBasicAuth*
*args:*
*- length: 14*
*include-uppercase-alpha: true*
*include-lowercase-alpha: true*
*include-numeric: true*
*include-special: true*
```
====== The `SpringSecurityOAuth2` Credential Provider
The `SpringSecurityOAuth2` credential provider creates an OAuth2 client in a token server (e.g. UAA for Cloud Foundry) using details provided as arguments and a generated client secret, and sets Spring Boot security properties to the generated values. Client secret generation can also be configured with arguments, as in the following example:
[subs=+quotes]
```yml
spring:
cloud:
appbroker:
services:
- service-name: example
plan-name: standard
apps:
- name: example-service-app1
path: classpath:app1.jar
*credential-providers:*
*- name: SpringSecurityOAuth2*
*args:*
*- registration: my-client-1*
*client-id: example-client*
*client-name: example-client*
*scopes: ["uaa.resource"]*
*authorities: ["uaa.resource"]*
*grant-types: ["client_credentials"]*
*identity-zone-subdomain:*
*identity-zone-id:*
*length: 14*
*include-uppercase-alpha: true*
*include-lowercase-alpha: true*
*include-numeric: true*
*include-special: true*
```
////
TODO: Document `CreateServiceInstanceWorkflow`, `UpdateServiceInstanceWorkflow`, and `DeleteServiceInstanceWorkflow`.
=== Creating a Service Instance
=== Updating a Service Instance
=== Deleting a Service Instance
////