Java EE7 Development and Hosting on OpenShift with Wildfly: Part 1

This is the first blog post in a series where I will cover how to build web applications in Java using Java EE 7. Java EE 7 is the latest release of the Java Enterprise Platform, with a focus on HTML 5 and developer productivity.

Java EE 7 introduced five new specifications covering WebSockets (JSR-356), JSON Processing (JSR-353), Batch Applications (JSR-352), Concurrency Utilities (JSR-236), and Caching (JSR-107). Apart from these new specifications, three existing specifications (JAX-RS 2.0JMS 2.0, and EL 3.0) have major updates and a few other specifications have minor updates. We will cover most of these specifications in detail in this blog post series.

Read full blog here https://www.openshift.com/blogs/java-ee7-development-and-hosting-on-openshift-with-wildfly-part-1

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 https://www.openshift.com/blogs/how-to-host-your-java-ee-application-with-auto-scaling

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

#!/bin/bash
# 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 ]
then
        mkdir $OPENSHIFT_DATA_DIR/.grails
        cd $OPENSHIFT_DATA_DIR
        wget http://dist.springframework.org.s3.amazonaws.com/release/GRAILS/grails-2.3.4.zip
        unzip grails-2.3.4.zip
        rm -f grails-2.3.4.zip
fi

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

#!/bin/bash
# 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_HOME=$OPENSHIFT_DATA_DIR/grails-2.3.4
export PATH=$GRAILS_HOME/bin:$PATH
cd $OPENSHIFT_REPO_DIR
export GRAILS_OPTS="-Xmx512m -Xms256m -XX:MaxPermSize=256m"
grails -Dgrails.work.dir=$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 https://github.com/shekhargulati/grails-jenkins-openshift-example

Day 28: OpenShift Eclipse Integration for Java Developers

Today for my 30 days challenge I decided to write about OpenShift Eclipse integration. The application will run on OpenShift, and from the onset we will be using the OpenShift Eclipse plugin to develop and deploy the application. We will be using Eclipse Kepler for most of the series, please download Eclipse Kepler before moving ahead. Lets gets started! Read the full blog here https://www.openshift.com/blogs/day-28-openshift-eclipse-integration-for-java-developers

Day 27: Restify–Build Correct REST Web Services in Node.js

Today for my 30 day challenge, I decided to learn a Node.js module called restify.The restify module makes it very easy to write correct RESTful APIs in Node.js and provides out-of-the-box support for features like versioning, error handling, CORS, and content negotiation. It borrows heavily from Express (intentionally) as that is more or less the de facto API for writing web applications on top of node.js. In this blog post, we will develop a RESTful API for storing jobs. We will store the data in MongoDB. Read full blog here https://www.openshift.com/blogs/day-27-restify-build-correct-rest-web-services-in-nodejs

Day 25: Tornado–Combining Tornado, MongoDB, and AngularJS to Build an App

Today for my 30 day challenge, I decided to take a break from JavaScript and learn a web framework called Tornado. I decided to learn Tornado so that I can write web applications in Python. I only know Flask framework so I thought Tornado would be a good addition to my Python web development skills. The application that we will write in this blog post will use Tornado for the REST backend, MongoDB as the database , AngularJS as the client side JavaScript MV* framework, and OpenShift as deployment platform. Read the full blog here https://www.openshift.com/blogs/day-25-tornado-combining-tornado-mongodb-and-angularjs-to-build-an-app

Day 22: Developing Single Page Applications with Spring, MongoDB, and AngularJS

Today for my 30 day challenge, I decided to develop a single page web application using the Spring frameworkMongoDB, and AngularJS. I have a good understanding of Spring and MongoDB but I have never used AngularJS with the Spring framework. So, in today’s blog post we will develop a social bookmarking application like the one we developed with EmberJS a few days ago. I have already covered AngularJS basics on day 2 so please refer to my blog for more information. This blog will cover the latest version of the Spring framework i.e. 3.2.5.RELEASE and will use no XML approach(not even web.xml). We will configure everything using Spring annotation support. The Spring MVC(along with Spring framework) will be used to create the RESTful backend. AngularJS will be used as the client side MVC framework to develop the frond-end of the application. Read full blog here https://www.openshift.com/blogs/day-22-developing-single-page-applications-with-spring-mongodb-and-angularjs