Skip to content

Infra-Red/cf-postgresql-broker

Repository files navigation

PostgreSQL Broker

Maintainability Build Status

This service broker shares a PostgreSQL amongst many users via the Open Service Broker API.

Configuration

There are important environment variables that should be overriden inside the manifest.yml file:

  • BROKER_USERNAME and BROKER_PASSWORD are required to setup HTTP Basic Auth to the broker API.
  • PG_SOURCE - URL used for connection to a PostgreSQL database instance. Can be customized according to this library.

Deployment

  1. Clone this repository, and cd into it.

  2. Target the space you want to deploy the broker to.

    $ cf target -o <org> -s <space>
  3. The configuration is entirely read from environment variables. Edit the manifest.yml according to your environment.

  4. Deploy the broker as an application.

    $ cf push
  5. Register a Broker.

    $ cf create-service-broker shared-postgresql-broker $BROKER_USERNAME $BROKER_PASSWORD $APP-URL
  6. Enable Access to Service Plans.

    $ cf enable-service-access a.postgresql

Using

All credentials stored in the VCAP_SERVICES environment variable with the JSON key a.postgresql.

  1. Create a Service Instance.

    $ cf create-service a.postgresql standard my-postgresql
  2. Bind a Service Instance.

    $ cf bind-service my-app my-postgresql

Demo

asciicast

License

Copyright 2017 Andrei Krasnitski

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.