Search code examples
javagitopenshift

How to deploy a Java web application on OpenShift or Git?


I have created a web site using NetBeans IDE by File -> New Project -> Java Web -> Web Aplication using apache-tomcat-7.0.67 as my Server.

The website consits of 3 .jsp pages, 1 servlet and 1 javaBean and json.org (extension is .jar)

example

Now I'm trying to deply it on http://app1-lolcheck.rhcloud.com/ but I have no idea how both to use git or Openshift.

I've installed git, ruby and OpenShift rhc Client Tools.

Finally I have already done what this video says (but using Tomcat 7 (JBoss EWS 2.0)) : https://www.youtube.com/watch?v=vbvOQ2gopwo

So what should I do?


Solution

  • Victor,

    I will try my best to answer your question in the general steps needed rather than the exact steps which will require some configuration. If you log into your OpenShiftAcount and go into your developer portal you can go into your applications settings. Among other things, listed there will be git address. What you will need to do is, assuming you have downloaded git, set it up following these steps: Getting started with git Then you need to go into your project directory and initialize the git there using:

    git init
    

    then add everything in your project folder except what's included in .gitignore (more details on the link that i provided you)

    git add .
    

    then commit everything

    git commit -m "Some commitment message here."
    

    now you need to add the application git address to your git's origin

    git remote add origin [git address like [email protected]:user/gitname.git]
    

    then you deploy using

    git push origin
    

    There are a lot of things I did quick and dirty and the actual configuration of the projects for rhc will need to be done by changing some settings file or in some cases procfiles. With everything that you need to get used to, please use this as a guideline for solving your problem.

    A good crash course on git is going to be very helpful in any development work with version control and especially so with web development since so much deployment is done using git.

    I am by no means a git expert, not even close to it, but I do use it in android development, web development and recently even in arduino programs just becasue of version controlling it offers.

    To remove existing remote origin

    git remote rm origin
    

    Then you can add it one more time using the git remote add I mentioned above.