Adam Bien's Weblog

How To Push Java EE 6 Applications To The Cloud In 5 Minutes

  1. Sign up: http://openshift.redhat.com/app/ (~ 1 min)
  2. Create environment https://openshift.redhat.com/app/express#quickstart (~2 min on Mac)
  3. Bind a domain name to your account:
    rhc-create-domain -n adambien -l [USER_NAME] -p [PASSWORD]
  4. Create an application. It will create a (git) repository remotely and clone it:
    rhc-create-app -l [USER_NAME] -p [PASSWORD] -t jbossas-7.0 -a [APP_NAME] (serversmoke)

    (...)
    Confirming application serversmoke is available
      Attempt # 1
    
    Success!  Your application is now published here:
    
          http://serversmoke-adambien.rhcloud.com/
    
    

  5. Remove maven artifacts to deploy a WAR: git rm -r src pom.xml
  6. Rename your war into ROOT.war and copy it into the ./deployments folder (this is important)
  7. Deploy your application with: git push
    
    remote: Stopping application...
    remote: done
    remote: Found .openshift/config/standalone.xml... copying to /var/lib/libra/...1/serversmoke/jbossas-7.0/standalone/configuration/
    remote: running .openshift/action_hooks/build
    remote: Starting application...done
    To ssh:/...@serversmoke-adambien.rhcloud.com/~/git/serversmoke.git/
       0959209..c2d3edd  master -> master
    
    
After ~2 seconds the application becomes available under http://[APPLICATION-NAME]-[DOMAIN-NAME].rhcloud.com. The ServerSmokeTest application used for this class test is available under: http://serversmoke-adambien.rhcloud.com/: it is the same application used for smoke tests of the other Java EE 6 servers previously: Glassfish v3, JBoss 6m5, SIwpas-1.0.0-CR4, resin-4.0.12 and "on premise" JBoss 7

So there is no smoke in the clouds: it works almost identical to a local Jboss 7 deployment.

What can be improved:
  1. The documentation at the website is out of sync with the implementation. E.g. the jbossas-7.0 application type is not even mentioned in the docs
  2. The domain registration offered in the website seems to be useless - use the command line. It is easier and works immediately.
  3. I would expect with "git pull" to get the actual log files. It is not the case.

Good news: The installation process and command line tools are easy and intuitive. The command line help is good and accurate. So do not read too much docs for now and enjoy hacking and deploying your Java EE 6 apps into the cloud! :-)


NEW online workshop: WebStandards Igniter (online)

Airport MUC workshops: Java EE 7: Bootstrap, Effective, Architectures, Web, React and Angular, Testing and Microservices

Newsletter: airhacks.news

A book about rethinking Java EE Patterns

Comments:

Sirs,
I like to remove the title bar completely from a container in swing, leave nothing, leaving no "maximize, restore, minimize" at the corner, to make a "desktop" gadget, similar to Windows 7 clock gadget, with a small toolbar at the side that becomes unhidden on hovering the mouse; very elegant. Such could be a textfield bared with no container to be visible; container peeled off. By clicking on the "spanner-options" then whatever rough gui opens is not important. Do you have an example for them, Sir?
Now I have installed Java 7 SE and I am using NetBeans 7.0.1.
Best Regards
YH

Posted by yanis on August 18, 2011 at 04:02 PM CEST #

Thanks for testing out OpenShift, Adam! If you're going to expand the list of PaaS platforms you're smoke testing, RUN@cloud may also be one to consider.
Deployment using the Maven plugin is pretty straightforward and easy to hook up both with your IDE and your Continuous Integration.

Lest this sound too much like a marketing blurb, we worked with Makara (now morphed into OpenShift Flex) too and that was a good experience as well ;-)

Posted by apwashere on August 18, 2011 at 09:46 PM CEST #

Hi, nice article.
Maybe it's in the documentation and I just missed it - but how can I deploy a database to express? Docs say I am granted about 128MB of database space and says sth about a "data" folder, do you have an idea?

TIA,
Jens

Posted by Jens on August 19, 2011 at 09:44 PM CEST #

thanks Adam !

Posted by Ray on September 06, 2011 at 02:13 PM CEST #

I followed the steps. It really works from ubuntu too. I had to first build the smoketest by "mvn clean" and "mvn install" before copying the war as ROOT.war. I had to "git add ROOT.war","git commit -a -m 'Some commit message'", "cd .." and then "git push". Proof that it works "http://msoscltest-msoscldomain.rhcloud.com/"
Thanks Adam!

Posted by smk on September 07, 2011 at 06:50 AM CEST #

Hi!

I tried to deploy a jee 6 application which uses jsf, richfaces, ejb 3, seam and jpa/hibernate.

But due to the limited memory restrictions (PermGen: 85MB, heap: 95MB), my applications throws a Permgenspace exception.

Do you have some suggestions how to stay between these limits...

Greets

Posted by Stijn Cremers on October 13, 2011 at 05:49 PM CEST #

you are just the best i've ever seen.......

Posted by 80.248.5.110 on June 26, 2012 at 06:49 PM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed
realworldpatterns.com
Online Workshops
...the last 150 posts
...the last 10 comments
License