Why OpenShift?

Last week I was writing down why enterprises should use OpenShift as the foundation for building their enterprise platform and I wrote down following points.

  1. When building an internal Microservices platform for an organization Kubernetes is just the foundation you need many more tools and workflows to build a platform. OpenShift is a Kubernetes superset combining over 200 open source projects into a fully integrated solution with strong focus on a developer experience, operational capabilities, monitoring, and management with strong and secure defaults. Some of the open source projects include Istio, Argo, Prometheus, Jaeger, ELK, Keycloak,etc. OpenShift is support Kubernetes along many other supported components.
  2. OpenShift is secure by default.
    1. CoreOS container Operating System. Reduce surface area for attacks.
    2. Project RBAC
    3. Hardened images
    4. You can define upgrade windows and schedule them
  3. OpenShift is certified with over 200+ ISVs. These include Finacle, CloudEra, MongoDB, SAS Viya, and many other.
  4. OpenShift is available as managed cloud offering on all the three clouds – Red Hat OpenShift for AWS, Azure Red Hat OpenShift, Red Hat OpenShift Container Platform on GCP.
  5. Allows you to manage multiple clusters through a single pane of glass

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

# 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
        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

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 -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

Day 18: BoilerPipe–Article Extraction for Java Developers

Today for my 30 day challenge, I decided to learn how to do text and image extraction from web links using the Java programming language. This is a very common requirement in most of the content discovery websites like Prismatic. In this blog, we will learn how we can use a Java library called boilerpipe to accomplish this task. Read the full blog here https://www.openshift.com/blogs/day-18-boilerpipe-article-extraction-for-java-developers

Day 17: JBoss Forge–Build and Deploy Java EE 6 AngularJS Applications using JBoss Forge and OpenShift

Today for my 30 day challenge, I decided to learn JBoss Forge. JBoss Forge is a rapid application development tool to build Maven based Java applications. It can help Java developers quickly get started with web application development. In this blog, we will develop a very simple todo application using JBoss Forge. The application will expose JaxRS based RESTful web services which will be consumed by an Angularjs based front end. All of this will be done using JBoss Forge without writing a single line of code. So lets get started. Read full blog here https://www.openshift.com/blogs/day-17-jboss-forge-java-ee-6-angularjs-application-on-openshift