These are chat archives for spring-cloud/spring-cloud

25th
Jul 2015
Leon Radley
@leon
Jul 25 2015 08:45

I’ve got a simple app that connects to mongodb, and I’m trying to connect it with the cloud connectors to pivotals cloud foundry.
The strange thing is that I’m getting not authorized on CloudFoundry_*** to execute command { createIndexes

But If I copy the mongolab connection url to my machine and run the app via gradle the everything starts up and the indexes are created correctly.

I’n not specifying any connection information for mongo since the documentation tells me that It is going to figure it out by itself. and since the app seems to be connecting to the right db, shouldn’t the password and permissions also be set accordingly?

Dave Syer
@dsyer
Jul 25 2015 08:48
It's a bug in the connectors
The existing released versions don't work with spring data mongo 1.8
You can try a snapshot of the connectors, or go back to s-d-mongo 1.6 (spring boot 1.2)
Or don't use the connectors
I put a workaround in the stores sample in spring-cloud-samples/customers-stores
Leon Radley
@leon
Jul 25 2015 08:51
Ahh that explains a lot. thought I was going mad :)
thanks!
Dave Syer
@dsyer
Jul 25 2015 08:51
So that would work as well (you disable the autoconfig for connectors and then use the environment to bind to mongo).
Leon Radley
@leon
Jul 25 2015 08:51
ok
Dave Syer
@dsyer
Jul 25 2015 08:51
Spring Boot 1.3 will get it right on its own if you can provide a mongo uri
(And Cloud Foundry will give you one)
You need to switch off the build pack autoreconfiguration in any case
Since it has an old version of the connectors embedded in it
Leon Radley
@leon
Jul 25 2015 08:55
can I turn off the buildpack’s in the manifest.yml?
Dave Syer
@dsyer
Jul 25 2015 09:04
I don't think so. Not unless you want to provide your own build pack
I could be wrong about that, but I'm not aware of any manifest switches for autoreconfiguration
Leon Radley
@leon
Jul 25 2015 09:11
Even though I removed the cloud connectors as a dependency it’s downloading Downloading Spring Auto Reconfiguration 1.7.0_RELEASE
when you say I should bind mongo to the env variable, does that mean I have to override a class?
I tried setting spring.data.mongodb.uri: ${VCAP_SERVICES.mongolab.credentials.uri} in application-cloud.yml
Dave Syer
@dsyer
Jul 25 2015 09:44
That's half the solution
Look at the StoreApp (or my blog from a few weeks ago)
And it's vcap.services.monglab.credentials.uri (assuming a service named "mongolab")
Leon Radley
@leon
Jul 25 2015 13:31
I got it working after lunch. thanks for the help @dsyer :)