0

On next-gen OpenShift, how do I get wildfly to use PostgreSQL as my datasource?

I've tried setting the environment variables in the wildfly pod so it matches up with the standalone.xml, but that doesn't work as my WAR complains it was unable to locate the PostgreSQL datasource

jdota
  • 11
  • 3
  • Have you downloaded and read through the free OpenShift book at https://www.openshift.com/promotions/for-developers.html This covers Wildly and PostgreSQL. – Graham Dumpleton Aug 15 '16 at 07:07
  • Thank you so much! I didn't know you guys had an updated book for free – jdota Aug 21 '16 at 04:16

2 Answers2

1

I found the answer myself. You need to update the following environment variables for PostgreSQL on OpenShift Online:

  • POSTGRESQL_DATABASE=sampledb

  • POSTGRESQL_SERVICE_PORT=5432

  • POSTGRESQL_SERVICE_HOST=172.11.22.33

  • POSTGRESQL_PASSWORD=wildfly

  • POSTGRESQL_USER=wildfly

  • POSTGRESQL_DATASOURCE=PostgreSQLDS

If you rsh into your wildfly pod, take a look at /wildfly/bin/standalone.conf to see how the other environment variables are set up for other databases.

jdota
  • 11
  • 3
0

I suggest you set these 3 env vars at your OpenShift Console / Your Project / Applications / Deployment / Your Deployment (despesas in my case) / Environment:

Deployment / Environment

zyc
  • 344
  • 3
  • 7