spring-attic / cloudfoundry-service-broker Goto Github PK
View Code? Open in Web Editor NEWSample project for Spring Cloud - Cloud Foundry Service Broker
License: Apache License 2.0
Sample project for Spring Cloud - Cloud Foundry Service Broker
License: Apache License 2.0
I want to use your BrokerConfig.java, but the project has no license. Could you add one? I think that MIT would be the best. Also, it would be great if BrokerConfig.java would have a copyright header.
Current build.gradle specifies jar file baseName as "service-broker-mongodb", but manifest.yml tries to get "cloudfoundry-mongodb-service-broker.jar".
Hi
At the last step of creating the MongoDB service, I am getting the following error.
Environment: Macbook running BOSH v2 and CF CLI with BOSH and CF setup on VirtualBox. MongoDB running as standalone on Macbook on NAT network.
It seems that CF is not able to reach the mongodb server running on my macbook. I provided the correct MongoDB auth details and the ip address in the Manifest file.
~/workspace/cloudfoundry-service-broker> cf cs mongodb default mymongodb
Creating service instance mymongodb in org atg / space test-space as admin...
FAILED
Server error, status code: 502, error code: 10001, message: Service broker error: Timed out after 30000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. Client view of cluster state is {type=UNKNOWN, servers=[{address=192.168.50.1:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused (Connection refused)}}]; nested exception is com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. Client view of cluster state is {type=UNKNOWN, servers=[{address=192.168.50.1:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused (Connection refused)}}]
Your help will be really appreciated.
Thanks.
I've been working on this error for a while, with no result. Any idea what I missed?
Thanks
Beth Tran
Here's my set up
One VM running mongodb (192.168.250.40), exposing port 27017
I can access Guest VM mongodb with my mongodb credentials (admin/admpass)
Another VM (192.168.59.4) running CloudFoundry
application.yml has mongodb credential set as admin/admpass)
This application is deployed as service broker
cf marketplace
service plans description
Mongo DB Default Mongo Plan* A simple MongoDB service broker implementation
cf cs "Mongo DB" "Default Mongo Plan" bethMongodbserviceInstance
Log for mongodb did not log anything for the connection from step #4
"cf cs" generate this error - as Connection refused
Server error, status code: 502, error code: 10001, message: Service broker error: Timed out after 10000 ms while waiting to connect. Client view of cluster state is {type=Unknown, servers=[{address=192.168.250.40:27017, type=Unknown, state=Connecting, exception={com.mongodb.MongoException$Network: Exception opening the socket}, caused by {java.net.ConnectException: Connection refused}}]; nested exception is com.mongodb.MongoTimeoutException: Timed out after 10000 ms while waiting to connect. Client view of cluster state is {type=Unknown, servers=[{address=192.168.250.40:27017, type=Unknown, state=Connecting, exception={com.mongodb.MongoException$Network: Exception opening the socket}, caused by {java.net.ConnectException: Connection refused}}]
For catalog management, spring-boot-cf-service-broker provides a default implementation that requires the broker to just provide an implementation of a Catalog bean.
An improvement would be to enable the use of externalized configuration (properties files, YAML files, environment variables or command-line arguments) to set Catalog bean attributes.
Then, a very basic catalog definition using env variables would be :
$ export SERVICES_DEFINITIONS[MONGO_DB]_ID=mongodb-service-broker
$ export SERVICES_DEFINITIONS[MONGO_DB]_NAME=Mongo DB
$ export SERVICES_DEFINITIONS[MONGO_DB]_DESCRIPTION=A simple MongoDB service broker implementation
$ export SERVICES_DEFINITIONS[MONGO_DB]_PLANS[DEFAULT]_ID=mongo-plan
$ export SERVICES_DEFINITIONS[MONGO_DB]_PLANS[DEFAULT]_NAME=Default Mongo Plan
$ export SERVICES_DEFINITIONS[MONGO_DB]_PLANS[DEFAULT]_DESCRIPTION=This is a default mongo plan. All services are created equally
This feature can be extended by enabling a remote externalized configuration
Hi,
I pushed this broker to my private CF as an app. while I'm trying to connect it asks for user name and password.
The message: "The server XXX requires username and password. The servers says:Spring".
There is any user & pwd in order to use it?
I have mongodb running at localhost:27017 and able to connect to it using robomongo.
Also, I deploy cloudfoundry-service-broker to CF and register this app as a mongo service broker.
"cf apps" returns
After register with CF, "cf marketplace" returns
However, "cf cs "Mongo DB" "Default Mongo Plan" testMongodbInstance" returns follow ERROR
I've tried to look at this error for a while; but could not find out why. Command using curl to query for the broker's catalog is successful and return the catalog.
Any tips?
Thanks
Beth
--------ERROR--------
Server error, status code: 502, error code: 10001, message: Service broker error: Timed out after 10000 ms while waiting to connect. Client view of cluster state is {type=Unknown, servers=[{address=localhost:27017, type=Unknown, state=Connecting, exception={com.mongodb.MongoException$Network: Exception opening the socket}, caused by {java.net.ConnectException: Connection refused}}]; nested exception is com.mongodb.MongoTimeoutException: Timed out after 10000 ms while waiting to connect. Client view of cluster state is {type=Unknown, servers=[{address=localhost:27017, type=Unknown, state=Connecting, exception={com.mongodb.MongoException$Network: Exception opening the socket}, caused by {java.net.ConnectException: Connection refused}}]
Hi,
I am trying to push mongo db service broker app to PCF. Under MongoConfig.java, I changed localhost to my host (domain is registered in our PCF account) and changed in application.yml file. When I trying to push an application it throws me exception.
2016-07-23T21:30:08.88+0530 [APP/0] ERR java.lang.reflect.InvocationTargetException
2016-07-23T21:30:08.88+0530 [APP/0] ERR at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2016-07-23T21:30:08.88+0530 [APP/0] ERR at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2016-07-23T21:30:08.88+0530 [APP/0] ERR at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2016-07-23T21:30:08.88+0530 [APP/0] ERR at java.lang.reflect.Method.invoke(Method.java:497)
2016-07-23T21:30:08.88+0530 [APP/0] ERR at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
2016-07-23T21:30:08.88+0530 [APP/0] ERR at java.lang.Thread.run(Thread.java:745)
2016-07-23T21:30:08.89+0530 [APP/0] ERR Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mongoServiceInstanceBindingServic
e' defined in file [/home/vcap/app/org/springframework/cloud/servicebroker/mongodb/service/MongoServiceInstanceBindingService.class]: Unsatisfied dependency expressed through constructor
argument with index 0 of type [org.springframework.cloud.servicebroker.mongodb.service.MongoAdminService]: : Error creating bean with name 'mongoAdminService' defined in file [/home/vca
p/app/org/springframework/cloud/servicebroker/mongodb/service/MongoAdminService.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [com.mongodb.Mo
ngoClient]: : Error creating bean with name 'mongoClient' defined in class path resource [org/springframework/cloud/servicebroker/mongodb/config/MongoConfig.class]: Bean instantiation vi
a factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.mongodb.MongoClient]: Factory method 'mongoClient' threw exc
eption; nested exception is com.mongodb.MongoException: host and port should be specified in host:port format; nested exception is org.springframework.beans.factory.BeanCreationException
I got above exception. Again, I tried with localhost to push the app and it is running. But I can't create service instance under localhost.
Thanks in advance.
Can you please tell me where I can find the user/password to register this MongoDB broker to a CF environment
Thanks
Beth Tran
The pom.xml file version in based on spring boot 1.3 but the gradle version is based on boot 1.5.9. It might be easier to delete the pom.xml file and only keep the gradle build to make sure that the sample always work.
Also the maven wrapper is missing from the project even though it has a mvnw which seems to indicate that the wrapper is present.
Hi,
My question isn't strictly in the scope of this project – perhaps I should post to the cloud-foundry lists – but if you can answer this easily (and even update your README) I'd be very grateful!
You need to install MongoDB somewhere and configure connectivity in MongoConfig.java
If I'm running my own CF instance using bosh-lite, and MongoDB running on my host machine, what configuration do I need to mess with so that the service broker can "see" my host machine? I've tried using my router's 192.168.x.x address but I get a failure when trying to create a service instance:$ cf create-service "Mongo DB" "Default Mongo Plan" mongo-instance-1 Creating service mongo-instance-1 in org me / space development as admin... FAILED Server error, status code: 502, error code: 10001, message: Service broker error: Read operation to server /192.168.0.4:27017 failed on database test; nested exception is com.mongodb.MongoException$Network: Read operation to server /192.168.0.4:27017 failed on database test
Thanks
P.S. I might be able to submit a pull request updating this to work with service broker API 2.4 & version 2.4.0 of your spring-boot-cf-service-broker, if you don't already have that in progress. (Also latest version of MongoDB.) I'm not sure I've understood some of the API changes though so it may need some tweaking…
Hi,
I've build and pushed the app to cloud foundry.But when I try
cf create-service-broker mongobroker admin admin <>
I'm getting a
Creating service broker mongobroker as admin...
FAILED
Server error, status code: 502, error code: 10001, message: The service broker r
ejected the request to https://mongodb-service-broker.in-XXX.XXX.com/
/v2/catalog. Status Code: 404 Not Found, Body: {"timestamp":1487310707790,"statu
s":404,"error":"Not Found","message":"No message available","path":"/catalog"}
Am I missing something here ?
Thanks
Sravya
./gradlew build
The plugin id 'spring-boot' is deprecated. Please use 'org.springframework.boot' instead.
:compileJava
warning: [options] bootstrap class path not set in conjunction with -source 1.7
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 warning
:processResources
:classes
:findMainClass
:jar
:bootRepackage
:assemble
:compileTestJava
warning: [options] bootstrap class path not set in conjunction with -source 1.7
/Users/asaikali/git/demos/cloudfoundry-service-broker/src/test/java/org/springframework/cloud/servicebroker/mongodb/service/MongoServiceInstanceServiceTest.java:155: error: no suitable constructor found for CreateServiceInstanceRequest(String,String,String,String)
return new CreateServiceInstanceRequest(SVC_DEF_ID, SVC_PLAN_ID, "organizationGuid", "spaceGuid")
^
constructor CreateServiceInstanceRequest.CreateServiceInstanceRequest() is not applicable
(actual and formal argument lists differ in length)
constructor CreateServiceInstanceRequest.CreateServiceInstanceRequest(String,String,String,String,Context,Map<String,Object>) is not applicable
(actual and formal argument lists differ in length)
constructor CreateServiceInstanceRequest.CreateServiceInstanceRequest(String,String,String,String,Map<String,Object>) is not applicable
(actual and formal argument lists differ in length)
1 error
1 warning
:compileTestJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileTestJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 4.905 secs
Setting up default username and Password using application.properties.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.