Deploy your application to OpenShift

OpenShift provides free Tomcat application server hosting, which could be useful for hosting a demo application.

Deploying a web application can be done in many ways. You can use Git to push application code on the server, or use an Openshift IDE plugin, or connect with an SSH connection to checkout your code, build your application and deploy it.


Golden Gate Bridge

In this post, I present another way to deploy a web application on Openshift by using tomcat maven plugin and tomcat manager.

Add OpenShift application

If you don’t have an OpenShift account, you have to sign up in this link
Create your application on the OpenShift online user interface, Click “Add new Application” button. Choose Tomcat 7 as application type.

Connect to the server

Use ssh connection to connect to thes server

Install and configure Tomcat Manager

cd jbossews/
mkdir tomcat
cp -avr apache-tomcat-7.0.62/webapps/manager/ ../webapps/
cd ..
rm -r tomcat/

Next, configure tomcat users file.
Under /var/lib/openshift/OPENSHIFT_APP_UUID/jbossews/conf directory edit the tomcat-users.xml

<?xml version='1.0' encoding='utf-8'?>
  <role rolename="tomcat"/>
  <role rolename="manager-script"/>
  <role rolename="manager-gui"/>
  <user username="tomcat" password="changeit" roles="tomcat,manager-script,manager-gui"/>

Deploy your application

You can access the manager user interface in this link to deploy your application or a third party war files.

Configure the tomcat maven plugin as shown in the pom file bellow.

<project xmlns="" xmlns:xsi=""
	<!-- project config -->

Finally, build and deploy your application.

mvn clean install tomcat7:redeploy 

One thought on “Deploy your application to OpenShift

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s