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 https://www.openshift.com/blogs/developing-single-page-web-applications-using-java-8-spark-mongodb-and-angularjs
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
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
You can read full blog here https://www.openshift.com/blogs/build-your-app-on-openshift-using-flask-sqlalchemy-and-postgresql-92
OpenShift already has best in class Java support with Tomcat 6, Tomcat 7, JBoss 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.
Recently, Travis CI announced support for deploying OpenShift applications from Travis builds. Travis-CI.org 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 Travis-CI.org to build and deploy OpenShift Java applications. These instructions also apply to commercial offerings Travis-CI.com
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.
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 https://www.openshift.com/blogs/run-gradle-builds-on-openshift
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 mirror.openshift.com|184.108.40.206|:443... connected. OpenSSL: error:14077458:SSL routines:SSL23_GET_SERVER_HELLO:reason(1112) Unable to establish SSL connection.
wget https://mirror.openshift.com/pub/origin-server/release/3/images/openshift-origin.zip --secure-protocol=SSLv3
If you wish to use another name for the file, you can use –O option as shown below.
wget --O openshift_origin_3.zip https://mirror.openshift.com/pub/origin-server/release/3/images/openshift-origin.zip --secure-protocol=SSLv3