Since a Postgres Database is the most simple persistent datastore at Heroku, I was trying to setup a jee application example using this SQL database. If you have already read some of my previous blogposts, I am using Buildpack API to deploy the application to a Dyno.
Since I already got an example working with Wildfly and Mysql, it was an easy step to conduct a buildpack to install the Postgresql driver into the Wildfly container. It’s now available at https://github.com/mwiede/heroku-buildpack-wildfly-postgresql.
I also provide an example of the application, which uses maven properties to extract the database url and credentials from system properties and use them in persistence.xml.
Here are the build and deploy steps to make it work (compare to https://github.com/mwiede/greeter#usage)
$ git clone https://github.com/mwiede/greeter.git $ cd greeter
$ heroku create $ heroku addons:create heroku-postgresql:hobby-dev $ heroku buildpacks:clear $ heroku buildpacks:add heroku/java $ heroku buildpacks:add https://github.com/mwiede/heroku-buildpack-wildfly $ heroku buildpacks:add https://github.com/mwiede/heroku-buildpack-wildfly-postgresql
$ git push heroku master