Coder Social home page Coder Social logo

lanchongyizu / service-broker-mongodb Goto Github PK

View Code? Open in Web Editor NEW

This project forked from michaelsteven/service-broker-mongodb

0.0 3.0 0.0 121 KB

Sample project for Spring Cloud - Cloud Foundry Service Broker

License: Apache License 2.0

Smarty 0.54% Shell 12.22% Batchfile 8.66% Java 78.58%

service-broker-mongodb's Introduction

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
> use admin
> 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

service-broker-mongodb's People

Contributors

scottfrederick avatar spgreenberg avatar michaelbannister avatar michaelsteven avatar vtrbtf avatar

Watchers

James Cloos avatar Jamie Zhuang 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.