Play detection of RDBMS services is broken #30

Closed
scottfrederick opened this Issue Jul 16, 2013 · 9 comments

Comments

Projects
None yet
5 participants
Member

scottfrederick commented Jul 16, 2013

When trying to auto-configure RDBMS database connections in Play apps, the auto-reconfig jar can't properly detect and set up the database connection.

The db.deafult.driver field in the config can't be properly set because of the way the label is being used to tell the difference between Postgres and MySQL: https://github.com/cloudfoundry/vcap-java/blob/master/auto-reconfiguration/src/main/java/org/cloudfoundry/reconfiguration/play/Configurer.java#L152.

It appears that the db.default.url field in the config isn't being set properly either, but not getting the driver set makes this hard to verify.

This can be tested using this sample app: https://github.com/cloudfoundry-samples/zentasks-scala-cloudfoundry.

remove these three lines: https://github.com/cloudfoundry-samples/zentasks-scala-cloudfoundry/blob/master/conf/application.conf#L20-L22

and comment in these three lines: https://github.com/cloudfoundry-samples/zentasks-scala-cloudfoundry/blob/master/conf/application.conf#L16-L18

@ramnivas ramnivas added a commit that referenced this issue Jul 16, 2013

@ramnivas ramnivas Fix issue #30
Change-Id: Ie455c8e10051310718515e4422fa819579f2b05f
7c75b1d
Contributor

ramnivas commented Jul 20, 2013

Fixed and works with https://github.com/ramnivas/cloudfoundry-buildpack-java. Will close when the corresponding PR (cloudfoundry/cloudfoundry-buildpack-java#9) is merged.

Contributor

rmorgan commented Aug 15, 2013

@ramnivas Looks like this can be closed out?

ramnivas closed this Aug 15, 2013

Maybe this is a different issue, but I stumbled upon the following issue that sounds quite the same as mentioned above:

We have recently installed a private PCF installation. Using playframework, the db.default.url seems not to get auto-configured correctly.

db.default.url = ${?cloud.services.p-mysql-geoip.connection.url} does not get set. The other properties (e. g. connection.user seems to work just fine.

If I put the database URL manually into the configuration, everything just works as expected.

Contributor

rmorgan commented Dec 10, 2013

@ramnivas Any ideas on this one?

Contributor

ramnivas commented Dec 10, 2013

@thisismana a couple of questions:

  1. Does the same app work fine on api.run.pivotal.io?
  2. What does the VCAP_SERVICES payload for service look like in your private PCF installation?
Member

scottfrederick commented Dec 10, 2013

Auto-configuration of services in a Spring or Play app will not work with Pivotal CF services. The auto-reconfiguration support lib currently uses the older cloudfoundry-runtime library to detect services, and this library detects service by label (https://github.com/cloudfoundry/vcap-java/blob/master/cloudfoundry-runtime/src/main/java/org/cloudfoundry/runtime/env/CloudEnvironment.java#L64-L65). The labels known to cloudfoundry-runtime lib work for run.pivotal.io but not for PCF.

cloudfoundry-runtime is being deprecated in favor of Spring Cloud for this and other reasons.

The auto-reconfiguration support lib has been updated to use Spring Cloud instead of cf-runtime-lib (57b7049), but this change needs to be merged into master and released. @rmorgan or @ramnivas might be able to comment on the timeline for this.

In the meantime, apps running on PCF should use manual configuration of services instead of auto-config.

Member

scottfrederick commented Dec 10, 2013

Moved this to issue #37.

Thanks for this information. Is there an example on how to use Spring-Cloud
in combination with Playframework already? The official documentation is
not up to date and therefor leading directly to this issue:
http://www.playframework.com/documentation/2.2.x/Deploying-CloudFoundry

Member

andypiper commented Dec 11, 2013

Yes that Play doc definitely needs updating - I'll look into what is required to get them to change their site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment