I'm working in R.H. to get the Vaadin framework on cloud.gov to work with cloud.gov and oracleDB.
What we have:
- cloud.gov + spring-music + postgres = works
- cloud.gov + spring-music + oracle = works
- cloud.gov + vaadinApp + jboss buildpack + H2 = works
- cloud.gov + vaadinApp + jboss buildpack + postgres != works
- I thought it worked but in fact it was just falling back to H2
- cloud.gov + vaadinApp + jboss buildpack + oracle != works
The vaadinApp I'm deploying is git@github.com:vaadin/framework-bluemix-example.git (and my fork at git@github.com:pburkholder/framework-bluemix-example.git)
Some tacks to consider:
- get vaadinApp + pg working on bluemix
- get vaadinApp + pg working on cloud.gov
- get access to the vaadin admin console so R.H. can set up connections
You'll need licenses. If you set set up your manifest.yml
like this:
---
applications:
- name: vaadin-ora
instances: 1
memory: 1024M
path: target/vaadin-jpa-application.war
env:
IBM_JVM_LICENSE: foo
IBM_LIBERTY_LICENSE: bar
services:
- vaadinora
random-route: true
buildpack: https://github.com/cloudfoundry/ibm-websphere-liberty-buildpack.git
and when the push fails, you'll get the URL for license(s)
From https://github.com/vaadin/framework-bluemix-example,
Name the database "vaadindb" and Bluemix will automatically configure driver, DataSource and setup a proper JNDI entry the database.
git clone bluemix vaadin example
export CF_HOME=~/.cf-bluemix/
cf login
...
cf create-service compose-for-postgresql Standard vaadindb
Bluemix no longer offers free pgsql plans
Update manifest.yml to not use declared services
cf push # works after fix for random-route
cf env vaadinApp
# get uri_direct_1
psql postgres://admin:PASSWORD@sl-us-south-1-portal.29.dblayer.com:50XX2/compose
Append to manifest.yml:
env:
IBM_JVM_LICENSE: L-SMKR-AVSEUH
IBM_LIBERTY_LICENSE: L-CTUR-AYBK6Z
buildpack: https://github.com/cloudfoundry/ibm-websphere-liberty-buildpack.git
cf push
output includes:
- buildpack: Liberty for Java(TM) (WAR, liberty-18.0.0_2, buildpack-v3.23-20180628-1052, ibmjdk-1.8.0_20180524, env)
+ buildpack: https://github.com/cloudfoundry/ibm-websphere-liberty-buildpack.git
....
The logs on BlueMix include:
2018-07-21T15:05:36.06-0400 [APP/PROC/WEB/0] OUT [INFO ] J2CA8050I: An authentication alias should be used instead of defining a user name and password on dataSource[compose-postgresql-vaadindb].
2018-07-21T15:05:36.15-0400 [APP/PROC/WEB/0] OUT [WARNING ] DSRA8020E: Warning: The property 'id' does not exist on the DataSource class org.postgresql.ds.PGConnectionPoolDataSource.
2018-07-21T15:05:36.22-0400 [APP/PROC/WEB/0] OUT [INFO ] CWRLS0010I: Performing recovery processing for local WebSphere server (defaultServer).
2018-07-21T15:05:36.26-0400 [APP/PROC/WEB/0] OUT [INFO ] CWRLS0007I: No existing recovery log files found in /home/vcap/app/wlp/usr/servers/defaultServer/tranlog//tranlog. Cold starting the recovery log.
2018-07-21T15:05:36.26-0400 [APP/PROC/WEB/0] OUT [INFO ] CWRLS0006I: Creating new recovery log file /home/vcap/app/wlp/usr/servers/defaultServer/tranlog//tranlog/log1.
2018-07-21T15:05:36.39-0400 [APP/PROC/WEB/0] OUT [INFO ] CWRLS0006I: Creating new recovery log file /home/vcap/app/wlp/usr/servers/defaultServer/tranlog//tranlog/log2.
2018-07-21T15:05:36.73-0400 [APP/PROC/WEB/0] OUT [INFO ] CWRLS0007I: No existing recovery log files found in /home/vcap/app/wlp/usr/servers/defaultServer/tranlog//partnerlog. Cold starting the recovery log.
2018-07-21T15:05:36.73-0400 [APP/PROC/WEB/0] OUT [INFO ] CWRLS0006I: Creating new recovery log file /home/vcap/app/wlp/usr/servers/defaultServer/tranlog//partnerlog/log1.
2018-07-21T15:05:36.73-0400 [APP/PROC/WEB/0] OUT [INFO ] CWRLS0006I: Creating new recovery log file /home/vcap/app/wlp/usr/servers/defaultServer/tranlog//partnerlog/log2.
2018-07-21T15:05:36.76-0400 [APP/PROC/WEB/0] OUT [INFO ] WTRN0135I: Transaction service recovering no transactions.
2018-07-21T15:05:36.76-0400 [APP/PROC/WEB/0] OUT [INFO ] CWRLS0012I: All persistent services have been directed to perform recovery processing for this WebSphere server (defaultServer).
Then both entities have:
2018-07-21T15:11:43.89-0400 [APP/PROC/WEB/0] OUT [INFO ] CWWJP9990I: Detected server platform: org.eclipse.persistence.platform.server.was.WebSphere_Liberty_Platform.
2018-07-21T15:11:43.90-0400 [APP/PROC/WEB/0] OUT [INFO ] CWWJP9990I: EclipseLink, version: Eclipse Persistence Services - 2.6.6.WAS-v20180515-0ab4033
BlueMix:
2018-07-21T15:05:39.31-0400 [APP/PROC/WEB/0] OUT [INFO ] DSRA8203I: Database product name : PostgreSQL
2018-07-21T15:05:39.31-0400 [APP/PROC/WEB/0] OUT [INFO ] DSRA8204I: Database product version : 9.6.6
2018-07-21T15:05:39.31-0400 [APP/PROC/WEB/0] OUT [INFO ] DSRA8205I: JDBC driver name : PostgreSQL Native Driver
2018-07-21T15:05:39.31-0400 [APP/PROC/WEB/0] OUT [INFO ] DSRA8206I: JDBC driver version : PostgreSQL 9.4.1212
2018-07-21T15:05:39.55-0400 [APP/PROC/WEB/0] OUT [INFO ] CWWJP9990I: myapp/file:/home/vcap/app/wlp/usr/servers/defaultServer/apps/myapp.war/WEB-INF/classes/_customer-pu login successful
cloud.gov:
2018-07-21T15:11:43.91-0400 [APP/PROC/WEB/0] OUT [INFO ] CWWJP9990I: Not able to detect platform for vendor name [Generic Component Context DataSource0Generic Component Context DataSource : jdbc/vaadindb]. Defaulting to [org.eclipse.persistence.platform.database.DatabasePlatform]. The database dialect used may not match with the database you are using. Please explicitly provide a platform using property "eclipselink.target-database".
When you cf ssh vaadinApp
in ~/app/wlp/usr/servers/defaultServer
you'll find runtime-vars.xml
in each entity but server.xml
on BlueMix has:
<dataSource id='compose-postgresql-vaadindb' jdbcDriverRef='compose-postgresql-driver' jndiName='jdbc/vaadindb' transactio
nal='true' type='javax.sql.ConnectionPoolDataSource'>
<properties id='compose-postgresql-vaadindb-props' databaseName='${cloud.services.vaadindb.connection.db}' user='${clo
ud.services.vaadindb.connection.user}' password='${cloud.services.vaadindb.connection.password}' portNumber='${cloud.services.
vaadindb.connection.port}' serverName='${cloud.services.vaadindb.connection.host}' ssl='true' sslMode='verify-ca' sslRootCert=
'/home/vcap/app/.compose_postgresql/cacert.pem'/>
</dataSource>
<jdbcDriver id='compose-postgresql-driver' libraryRef='compose-postgresql-library' javax.sql.XADataSource='org.postgresql.
xa.PGXADataSource' javax.sql.ConnectionPoolDataSource='org.postgresql.ds.PGConnectionPoolDataSource'/>
<library id='compose-postgresql-library'>
<fileset id='compose-postgresql-fileset' dir='${server.config.dir}/lib' includes='postgresql-jdbc-9.4.1212.jar'/>
</library>
So... seems Liberty detects some vars, but not ours.
http://ryanjbaxter.com/2015/03/02/bluemix-java-developers-your-life-just-got-a-little-easier/
Some notes from Ramon:
Here are some of my research findings so far. I'm still looking into it, but I hope the Cloud.gov engineering group can make use of this information.
https://github.com/cloudfoundry/javabuildpack/issues/189
This is a request to see if it's possible to add jndi to the java build pack. They indicated that they would not be moving in that direction and other solutions such as spring cloud connector might be a better approach.
https/youtu.be/T8SPV4rnxjg -- this is a very good presentation from a conference that explains a lot of the concepts behind Spring cloud project and the integration with various cloud platforms such as cloud foundary and others.
The idea seems to be a little different from what people like myself, who have limited experience with cloud platforms, are uyse to doing. Normally we configure local application servers with data sources that provide access to some database. You create a jndi entry in the application, deploy to the same server and everything works.
The spring project seems to be able to parse the various cloud environmental vcap variables, etc and connect to the data service. Using the API from the project you would expose the data source directly in the application that you are deploying and the rest should work as before.
http://ryanjbaxter.com/2015/03/02/bluemix-java-developers-your-life-just-got-a-little-easier/
Simplify Cloud Applications using Spring Cloud Connectors
-- this is a project on ibm bluemix platform ( also cloud foundary) that builds on the spring cloud connector project. You can just add a maven entry to use it. You can also use Maven entries that point directly to the official spring cloud connector project.
The bluemix project is just an extension of the spring project the official spring project. It gives you all the functionality of the official project with some custom functionality on the bluemix platform.
This might be an interesting approach for Cloud.gov. If Cloud.gov published a similar library in the public maven repository, it would be a easy reference to find and hopefully use.