vtrbtf / cloudfoundry-service-broker

Sample project for Spring Cloud - Cloud Foundry Service Broker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sample Spring Boot project using the Spring Cloud - Cloud Foundry Service Broker.

Overview

This sample project uses the Spring Cloud - Cloud Foundry Service Broker to implement a MongoDB service. The MongoDB service also uses spring-boot-data-mongodb to persist service instances and bindings.

Getting Started

You need to install and run MongoDB somewhere and configure connectivity in application.yml.

Build it:

./gradlew build

After building, you can push the broker app to Cloud Foundry or deploy it some other way and then register it to Cloud Foundry.

Enable Auth in your MongoDB instance

Add the Initial Admin User:

$ mongo
> db.createUser({ user: 'admin', pwd: 'password', roles: [{"role" : "readWriteAnyDatabase","db" : "admin"},{"role" : "userAdminAnyDatabase","db" : "admin"}] });

Update your mongod.conf file to enable authorization. For example, add lines like these:

security:
  authorization: enabled

Restart your Mongo service and test that authentication is working as expected:

mongo --authenticationDatabase "admin" -u "admin" -p "password"

Refer to the MongoDB docs for more details: https://docs.mongodb.com/manual/tutorial/enable-authentication/

Deploy the Service Broker to Cloud Foundry

The service broker is configured via environment variables, which are defined in the manifest.yml file. Make the necessary changes to the MongoDB config in order to connect to your Mongo instance.

Push the service broker as an app to Cloud Foundry: cf push

Register the service broker using the default username and the password obtained from the previous step: cf csb mongodb admin admin http://mongodb-service-broker.local.pcfdev.io

Enable access to the service broker: cf enable-service-access mongodb

Create a service instance: cf cs mongodb default mymongodb

About

Sample project for Spring Cloud - Cloud Foundry Service Broker

License:Apache License 2.0


Languages

Language:Java 78.9%Language:Shell 12.3%Language:Batchfile 8.7%