S2I + Helm Chart and Multiple Datasources

95 views
Skip to first unread message

Jose Mayorga

unread,
Aug 22, 2022, 5:07:43 AM8/22/22
to WildFly
Hi All,

I am trying to setup an application in OpenShift using the Wildfly maven plugin and Helm Chart and adding multiple datasources to this project.


I tried adding the environment variables related to DB_SERVICE_PREFIX_MAPPING in the helm chart override values file (deploy.env) without success.

Is there an example that I can reference on how to add multiple datasources to a project?

Thanks,
Jose Mayorga.



Ken Wills

unread,
Aug 22, 2022, 4:11:28 PM8/22/22
to Jose Mayorga, WildFly
Hi Jose,

I think the helm datasources are currently limited to adding one datasource as part of the galleon layer, however you can add multiple additional datasources using s2i and .env files, see for example here: https://github.com/luck3y/eap-postgres-example/blob/master/configuration/datasources.env

These would be added to your source and run during s2i build.

Ken

 

Thanks,
Jose Mayorga.



--
You received this message because you are subscribed to the Google Groups "WildFly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wildfly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wildfly/e946cb0a-dc0b-4370-8462-e6f3f08f4ea7n%40googlegroups.com.

Jose Mayorga

unread,
Aug 22, 2022, 4:35:03 PM8/22/22
to Ken Wills, WildFly
Hi Ken,

Thanks for your response, I will give it a try!

Regards,

Jose Mayorga

Senior Application Deployment Solution Architect

Red Hat

jmay...@redhat.com      


Jean Francois Denise

unread,
Aug 23, 2022, 9:11:50 AM8/23/22
to wil...@googlegroups.com
Hi Jose,

That should work, we don't have a proper example, but feel free to setup a reproducer, we can then investigate and help you. Your reproducer could then be the base for a new example.

Thank-you.

Jose Mayorga

unread,
Aug 23, 2022, 9:32:32 AM8/23/22
to Jean Francois Denise, wil...@googlegroups.com
Hi Jean,

I have a reproducer in the github repo below:


The multiple datasources are configured in the multiple-datasources branch.

Thanks

Jose Mayorga

Senior Application Deployment Solution Architect

Red Hat

jmay...@redhat.com      


You received this message because you are subscribed to a topic in the Google Groups "WildFly" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wildfly/TgKwdl7gImc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wildfly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wildfly/dd709e0e-696c-5769-ef08-fb75a93d9d20%40redhat.com.

Jean Francois Denise

unread,
Aug 23, 2022, 10:13:33 AM8/23/22
to Jose Mayorga, wil...@googlegroups.com
Hi,
I can see some issues in the reproducer:
* Helm file is not properly formatted, you have extra spaces there: https://github.com/jlmayorga/ocp-wildfly-sample/blob/multiple-datasources/helm.yaml#L9
* You need to use the cloud feature-pack, this is the cloud feature-pack that brings the ability to configure datasources with env variables. Look at this example: https://github.com/wildfly/wildfly-s2i/blob/main/examples/postgresql/pom.xml#L53
* You should remove oracle-datasource, you are just using postgresql: https://github.com/jlmayorga/ocp-wildfly-sample/blob/multiple-datasources/pom.xml#L56

Then you should progress with your example.
Thank-you.
JF

Jose Mayorga

unread,
Aug 23, 2022, 10:15:38 AM8/23/22
to Jean Francois Denise, WildFly
Hi Jean,

Thanks for your input, I left some Oracle configuration from previous examples, I will clean it up, give it a try and keep you posted.

Regards,

Jose Mayorga

Senior Application Deployment Solution Architect

Red Hat

jmay...@redhat.com      


Jose Mayorga

unread,
Aug 23, 2022, 1:01:38 PM8/23/22
to Jean Francois Denise, WildFly
Hi Jean,

Adding the wildfly-cloud-galleon-pack feature pack did the trick, thanks for your help.

I will clean up the repository and write a README.md file with details on how to do this. I'll be happy to contribute this example to your collection.

Regards,

Jose Mayorga

Senior Application Deployment Solution Architect

Red Hat

jmay...@redhat.com      


Jean Francois Denise

unread,
Aug 24, 2022, 3:50:01 AM8/24/22
to Jose Mayorga, WildFly
Hi Jose,
good news!
We try to keep our examples aligned (README, pom, ...). You can have a look at https://github.com/wildfly/wildfly-s2i/tree/main/examples/postgresql.
It would be nice to have the deployment to make an actual use of the multiple datasources.
Thank-you.
JF
Reply all
Reply to author
Forward
0 new messages