mysql - Configure a Wildfly 10 MSQL datasource in OpenShift v3 -
i have application working on local dev machine. uses wildfly 10, mysql 5.7 , hibernate. application looks 'appds' datasource within wildfly.
i've created wildfly 10 container , mysql container on openshift v3. typically, log wildfly , configure datasource, configuration lost when container restarts. thought matter of finding connection environment settings, , using pre-configured database connections, can't find variables should set to, , default connections don't work without them.
i downloaded , read openshift developers, side-step issue creating direct database connection, rather going through datasource.
exporting environment variables failed because 'no matches apps.openshift.io/, kind=deploymentconfig'. book out of date? not using deployment config store environment variables?
i appreciate if point me in right direction.
i have project running locally on machine uses wildfly 10, mysql 5.7 , hibernate. found documentation incomplete. after few days of working it, have figured out how deploy simple j2ee project stack.
i updating question step-by-step wish i'd had. hope saves time in future.
- create new openshift user
- create project dbtest
add mysql dbtest project: following service(s) have been created in project: mysql:
username: test password: test database name: testdb connection url: mysql://mysql:3306/
add wildfly project:
oc login https://api.starter-us-west-1.openshift.com oc project dbtest oc status
- scale current wildfly pod 0. (you won't have enough cpu run 3 pods, , redeploy tries start new 1 , hot swap them)
- from left menu: applications->deployments->(dbtest)wildfly10 pod->environment(tab)-> add: mysql_database=testdb mysql_db_enabled=true mysql_user:test mysql_password: test
- push wildfly pod 1.
- use terminal in wildfly run ./add-user.sh
- oc port-forward wildfly10-6-rkr58 :9990 (replace wildfly10-6-rkr58 pod name, found clicking on running pod [circle 1 in it] , noting pod name in upper left corner])
- login wildfly 127.0.0.1: , test mysqlds. should connect.
wiki
Comments
Post a Comment