Developing Single Page Web Applications using Java 8, Spark, MongoDB, and AngularJS

In this post you will learn how to use a micro framework called Spark to build a RESTful backend. The RESTful backend is consumed by a single page web application using AngularJS and MongoDB for data storage. I’ll also show you how to run Java 8 on OpenShift. Read the full blog here

How to Host your Java EE Application with Auto-scaling

OpenShift is an auto-scalable Platform as a Service. Auto-scalable means OpenShift can horizontally scale your application up or down depending on the number of concurrent connections. OpenShift supports the JBoss application server, which is a certified platform for Java EE 6 development. As an OpenShift user, you have access to both the community version of JBoss and JBoss EAP 6(JBoss Enterprise Application Platform) for free. In this blog post, we will learn how to host a scalable Java EE 6 application using a JBoss EAP 6 server cluster running on OpenShift. Read the full blog here

How to run Grails Application with Jenkins on OpenShift

Yes, you can run Grails applications on OpenShift. Follow the steps mentioned below to deploy Grails apps via Jenkins on OpenShift.

Step 1 : Create Tomcat 7 application with Jenkins

$ rhc app-create grailsapp tomcat-7 --enable-jenkins

Step 2 : Delete template code

$ cd grailsapp
$ git rm -rf src/ pom.xml
$ git commit -am "deleted template code"

Step 3: Generate Grails app
Use grails command line or IDE to generate a Grails project.

Step 4: Copy the Grails app
Copy the source code of your grails app in the grailsapp folder. The grailsapp corresponds to OpenShift application.

Step 5: Create pre_build action hook
Create an OpenShift action hook

touch .openshift/action_hooks/pre_build
chmod +x .openshift/action_hooks/pre_build

Copy the following in pre_build hook

# This is a simple script and will be executed on your CI system if
# available.  Otherwise it will execute while your application is stopped
# before the build step.  This script gets executed directly, so it
# could be python, php, ruby, etc.
set -x
if [ ! -d $OPENSHIFT_DATA_DIR/grails-2.3.4 ]
        mkdir $OPENSHIFT_DATA_DIR/.grails
        rm -f

Step 6: Create build action hook
Create an OpenShift action hook

touch .openshift/action_hooks/build
chmod +x .openshift/action_hooks/build

Copy the following in build hook

# This is a simple script and will be executed on your CI system if
# available.  Otherwise it will execute while your application is stopped
# before the build step.  This script gets executed directly, so it
# could be python, php, ruby, etc.
set -x
export GRAILS_OPTS="-Xmx512m -Xms256m -XX:MaxPermSize=256m"
grails$OPENSHIFT_DATA_DIR.grails prod war

Step 7: Commit and push the changes

Commit and push the changes

$ git add .
$ git commit -am "app"
$ git push

Now watch your Jenkins build. If it fails, I guess it would be because of memory issues. Try and use bigger gear sizes. Grails is memory hungry.

Github repository with sample app code

Build Your App on OpenShift Using Flask, SQLAlchemy, and PostgreSQL 9.2

Deploy Flask Python Apps on OpenShift

Let me start this blog by confessing that I am a Java guy who first learned Python three years back but haven’t used it much in my day to day work. So, after three long years, I have decided to brush up on my Python skills by developing a simple web application. By simple I don’t mean “Hello World” application but an application which does some work like storing data to a database. After spending some time googling “best web framework in Python,” I zeroed in on Flask. Flask is a microframework for Python based on Werkzeug and Jinja 2. It is a very easy to learn framework and is based on convention over configuration, which means that many things are preconfigured with sensible defaults.

You can read full blog here

Deploy WebSocket Web Applications With JBoss Wildfly

Wildfly application server on OpenShift

Wildfly is the new name for the community edition of the JBoss Application Server. The current development version of Wildfly (8.0) will be adding support for Java EE 7. Java EE 7 brings a lot of goodies for Java(EE) developers. One of the features of Java EE 7 is the JSR 356 Java API for WebSockets, which specifies a Java API that developers can use to integrate WebSockets into their applications — both on the server side as well as on the Java client side. In case you are new to WebSockets or JSR 356, please refer to my earlier blog post on this subject. In this blog post, we will install Wildfly on OpenShift using the DIY cartridge and look at the sample WebSocket application bundled with the quickstart.

OpenShift already has best in class Java support with Tomcat 6Tomcat 7JBoss AS7, and JBoss EAP 6 bundled with it. You can also run Jetty or GlassFish on it using the DIY cartridges. In addition, OpenShift provides support for Jenkins continuous integration server.

Read full blog at

How to Build and Deploy OpenShift Java Projects using Travis CI

Recently, Travis CI announced support for deploying OpenShift applications from Travis builds. is a free hosted continuous integration server for open source applications. Commercial non-opensource project developers can use the Travis CI commercial offering. This blog shows how developers can use to build and deploy OpenShift Java applications. These instructions also apply to commercial offerings

Please note that out-of-the-box OpenShift provides support for Jenkins based deployments. You can refer to my blog on Jenkins for more information.

Read full blog

Run Gradle Builds on OpenShift

OpenShift has supported Apache Maven as default build system for Java based projects since the first release. All the Java projects created by OpenShift are maven based. A few months ago we also added support for Apache Ant. All OpenShift gears now have Apache Ant installed on them. So, using Apache Ant to build your project is as easy as updating the OpenShift build action hook. You can refer to my blog post to learn how you can use Ant to build your OpenShift projects.

Lately I have seen lot of developers asking how they can use Gradle to build their projects. Gradle combines the power and flexibility of Ant with the dependency management and conventions of Maven into a more effective way to build. A lot of open source projects and enterprises are using Gradle as their build system. The Spring Framework is one popular example of an open source project using Gradle. In this blog post, we will learn how we can configure an OpenShift Java project to use Gradle instead of Apache Maven to build the project.

Read full blog here

Download OpenShift Origin Virtual Image

In case you wish to download OpenShift Origin virtual image using wget and get the error shown below then you should use command shown below.

Connecting to||:443... connected.
OpenSSL: error:14077458:SSL routines:SSL23_GET_SERVER_HELLO:reason(1112)
Unable to establish SSL connection.
wget --secure-protocol=SSLv3

If you wish to use another name for the file, you can use –O option as shown below.

wget --O --secure-protocol=SSLv3