Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Play detection of RDBMS services is broken #30

Closed
scottfrederick opened this Issue · 9 comments

5 participants

@scottfrederick
Collaborator

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 referenced this issue from a commit
@ramnivas ramnivas Fix issue #30
Change-Id: Ie455c8e10051310718515e4422fa819579f2b05f
7c75b1d
@ramnivas
Collaborator

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

@rmorgan
Owner

@ramnivas Looks like this can be closed out?

@ramnivas ramnivas closed this
@thisismana

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.

@rmorgan
Owner

@ramnivas Any ideas on this one?

@ramnivas
Collaborator

@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?

@scottfrederick
Collaborator

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.

@scottfrederick
Collaborator

Moved this to issue #37.

@thisismana
@andypiper

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
Something went wrong with that request. Please try again.