2017 © Pedro Peláez
 

library php-cf-service-broker

A Cloud Foundry service broker made for Cloud Foundry

image

cloudfoundry-community/php-cf-service-broker

A Cloud Foundry service broker made for Cloud Foundry

  • Tuesday, May 12, 2015
  • by ArthurHlt
  • Repository
  • 50 Watchers
  • 2 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 2 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Cloud Foundry PHP Service Broker

Software License Stories in Ready Build Status Scrutinizer Code Quality Code Coverage, (*1)

Php project for creating service brokers compatible with Open Service Broker API., (*2)

This project for example can be used to quickly implement new service brokers for Kubernetes or Cloud Foundry., (*3)

Compatibility

Quick start

  1. Clone this repo or use composer create-project cloudfoundry-community/php-cf-service-broker
  2. Add your service inside /config/services.json (remove example first)
  3. Create a user by doing this in command line: php bin/addUser.php [user_name] [password]
  4. (optional) Change configuration inside /config/config.yml
  5. Create the logic inside /src/Sphring/MicroWebFramework/ServiceBroker/DefaultServiceBroker.php (I suggest to see the doc, no need to follow rest url project handle it)
  6. Register your new service broker, (*4)

    • in Kubernetes, (*5)

      by following https://svc-cat.io/docs/resources/#service-brokers, (*6)

    • in Cloud Foundry, (*7)

      by following http://docs.cloudfoundry.org/services/managing-service-brokers.html#register-broker, (*8)

  7. Service broker is ready and follow rest url given by the doc, (*9)

Configuration

Common

See /config/config.yml., (*10)

Database

By default this project use an sqlite database, change to another database by modifying this file: /config/doctrine-driver.yml, (*11)

Adjust logging

See app/app.php., (*12)

By default this application logs only warnings to stdout., (*13)

To enable logging to file you can uncomment $logger->pushHandler line., (*14)

To adjust log level you can change \Monolog\Logger::* value. For example, to set logging level to debug you can set the value to \Monolog\Logger::DEBUG. See Monolog logger source code for details., (*15)

Add more service broker

You can add an infinity of service broker to do this follow these steps:, (*16)

  • Add another service inside /config/services.json
  • Create a new service broker class and extend Sphring\MicroWebFramework\ServiceBroker\AbstractServiceBroker
  • Register your new broker by adding entry in /sphring/service-broker.yml like this: yaml service.broker.[your broker name]: class: Sphring\MicroWebFramework\ServiceBroker\[your broker class name] extend: service.broker.abstract
  • Add in this same file a new entry in service.broker.list, example: yaml service.broker.list: class: \ArrayObject constructor: 1: ref: default: service.broker.default [service name from services.json]: service.broker.[your broker name]
  • Unvalidate cache by doing in command line touch sphring/main.yml or set cache to false inside /config/config.yml
  • Your new service broker is available

Run as a Cloud Foundry app

  1. Create a database service which his name follow this regex: /.*(postgres|pgsql|db|database|my|maria|oracle|oci).*/i (note: add in composer.json other pdo driver than pdo_mysql)
  2. Push the app (run cf push)
  3. Bind your database service on your app
  4. Restage your app
  5. Service broker app is ready try go to http://your_url/v2/catalog you should see your catalog

Development environment

Router for PHP embedded web server

cd app
php -S 0.0.0.0:8888 ../config/routes/router.php

Tests

Tests use PHPUnit. Run with your command line: vendor/bin/phpunit --bootstrap tests\bootstrap.php --no-configuration tests, (*17)

Add a service to test

  1. Update services.json inside tests configuration directory.
  2. Update service-broker.yml inside tests configuration directory.
  3. Run vendor/bin/phpunit --bootstrap tests\bootstrap.php --no-configuration tests

See also

Open Service Broker API: - https://github.com/openservicebrokerapi/servicebroker, (*18)

K8s Service Catalog: - Service Catalog documentation in the official K8s documentation - Service Catalog documentation at the official site of K8s Service Catalog - Service Catalog datastructures and interfaces in its source code - Compatibility of Service Catalog with Open Service Broker API, (*19)

The Versions

12/05 2015
11/05 2015

1.1.0

1.1.0.0

A Cloud Foundry service broker made for Cloud Foundry

  Sources   Download

MIT

The Requires

 

The Development Requires

cloud cloud foundry cf service broker

11/05 2015

1.0.0

1.0.0.0

A Cloud Foundry service broker made for Cloud Foundry

  Sources   Download

MIT

The Requires

 

The Development Requires

cloud cloud foundry cf service broker