Share this blog!


"OpenShift is Red Hat's Platform-as-a-Service (PaaS) that allows developers to quickly develop, host, and scale applications in a cloud environment."

Here is a list of simple guidelines that will help you if you are struggling with the complex terms and tools.

Getting started

First of all you must have an account in OpenShift, which is quite simple. In order to create applications, you must first install OpenShift Client tools. OpenShift provides many useful guidelines and this particular set of articles is quite useful when installing the client tools. Just remember, if you're installing Ruby on Windows, try Ruby versions 1.9.3 or 2.0.0  because the newer versions might cause problems during rhc setup.

So if you're a Windows guy, go through this article until the very end. It provides a detailed guide about setting SSH keys when installing client tools.

Creating the application

In order to host a JSP project, you can select Tomcat 6(JBoss EWS 1.0) or Tomcat 7(JBoss EWS 2.0). Once you create it, copy the repo link and clone it to your local machine.


Adding a database

If your project is already built and you have a database in your local machine that must be linked to the hosting, you must add relevant cartridges to your application(As shown above). As they instruct, keep a note of the credentials that are assigned for you. 

If you are using MySQL, you can simply use phpMyAdmin to import a dump file that contains the structure and data of your database. 

In your project, edit the credentials to match those assigned for you. Basically what you will need are username, password, databasename and databaseURL. In the URL, which they will inform as 
Connection URL: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/
make sure to replace the Host and Port with valid credentials. You can either use System.getenv method or directly hardcode credentials stated in phpMyAdmin. 

Uploading the war file

Once the project is all set, create a war file of the project. If you're a Netbeans fan, you can simply clean and build the project and Netbeans will create the war file in the dist folder.

In the repo cloned to your local machine, remove src folder and pom.xml file. Copy the newly created war file and paste in the webapps folder and rename the war file as ROOT.war which will set it as the root source.  

Finally go back and add, commit and push the changes to the repo using regular commands.

Good luck!
Next PostNewer Posts Previous PostOlder Posts Home