Tuesday, March 8, 2016

Openshift - deploy Java EE7 application onto Wildlfy10

OpenShift  Wildfly  https://developers.openshift.com/en/wildfly-getting-started.html

 Create OpenShift account https://openshift.redhat.com/app/account/new?then=%2Fapp%2Faccount

Install RedHat RHC  client tools  https://developers.openshift.com/en/managing-client-tools.html


sudo yum install rubygems
rhc setup

Create application via web console or using RHC tools

Write down admin password to access cloud via SSH

Open application URL in browser http://ee7full-testjavaee.rhcloud.com/




[dave@localhost ee7full.git]$ rhc apps
ee7full @ http://ee7full-testjavaee.rhcloud.com/ (uuid: 56d97e36454545636454540026f)
---------------------------------------------------------------------------------
  Domain:          testjavaee
  Created:         Mar 04  1:23 PM
  Gears:           1 (defaults to small)
  Git URL:         ssh://5645454545367a00026f@ee7full-testjavaee.rhcloud.com/~/git/ee7full.git/
  Initial Git URL: https://github.com/dveselka/wildfly/#master
  SSH:             5645454545367a00026f@ee7full-testjavaee.rhcloud.com
  Deployment:      auto (on git push)

  jboss-wildfly-10 (WildFly Application Server 10)
  ------------------------------------------------
    From:    https://raw.github.com/openshift-cartridges/openshift-wildfly-cartridge/wildfly-10/metadata/manifest.yml
    Website: http://www.wildfly.org
    Gears:   1 small

You have access to 1 application.
[dave@localhost ee7full.git]$ 


Initial source code is taken from existing GitHub code https://github.com/dveselka/wildfly


Clone Git Repository

git clone ssh://56d93434343445456f@ee7full-testjavaee.rhcloud.com/~/git/ee7full.git/


Forward ports to local host https://developers.openshift.com/en/managing-port-forwarding.html

[dave@localhost openshift]$ rhc port-forward -a ee7full
Checking available ports ... done
Forwarding ports ...

To connect to a service running on OpenShift, use the Local address

Service Local               OpenShift
------- -------------- ---- -----------------
java    127.0.0.1:3528  =>  127.5.77.129:3528
java    127.0.0.1:3529  =>  127.5.77.129:3529
java    127.0.0.1:8080  =>  127.5.37.129:8080
java    127.0.0.1:9990  =>  127.5.77.129:9990

Press CTRL-C to terminate port forwarding



Deploy application using Maven deploy plugin

dave@localhost dave-java-ee7-wildfly-full]$ pwd
/home/dave/openshift/ee7full.git/dave-java-ee7-wildfly-full
[dave@localhost dave-java-ee7-wildfly-full]$ mvn clean package wildfly:deploy


[INFO] --- wildfly-maven-plugin:1.0.2.Final:deploy (default-cli) @ dave-java-ee7-wildfly-full-ear ---
Mar 08, 2016 7:49:14 AM org.xnio.Xnio <clinit>
INFO: XNIO version 3.2.2.Final
Mar 08, 2016 7:49:14 AM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.2.2.Final
Mar 08, 2016 7:49:14 AM org.jboss.remoting3.EndpointImpl <clinit>
INFO: JBoss Remoting version 4.0.3.Final
Authenticating against security realm: ManagementRealm
Username:


Check application server logs

2016-03-08 01:52:43,915 INFO  [org.jboss.as.repository] (management-handler-thread - 5) WFLYDR0001: Content added at location /var/lib/openshift/56d9454545450026f/wildfly/standalone/data/content/62/75d7af5656565656573/content
2016-03-08 01:52:43,934 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0027: Starting deployment of "dave-java-ee7-wildfly-full-ear.ear" (runtime-name: "dave-java-ee7-wildfly-full-ear.ear")
2016-03-08 01:52:44,090 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-6) WFLYSRV0207: Starting subdeployment (runtime-name: "dave-java-ee7-wildfly-full-ejb.jar")
2016-03-08 01:52:44,091 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0207: Starting subdeployment (runtime-name: "dave-java-ee7-wildfly-full-web.war")
2



Access application via browser using public URL  http://ee7full-testjavaee.rhcloud.com/dave-java-ee7-wildfly-full-web/