Wondering how can you have a custom application on cloud. We will go through few steps and make it work 🙂

In this example we are going to deploy an exploded war file say “test.war”. Assuming the fact that you have a valid OpenShift account.

1. Create a directory in which you are going to keep all the files related to project. For example I created below directory on my machine :


2. We need to create an application entity here, run below commad from the directory you have created for your project :

cd /home/nikhil/OpenShift/

rhc app create -a test -t jbossas-7

enter the password that you use to login for OpenShift Account.

It generates a directory with your application name, in this case “test”

3. Navigate to the app directory and as we are using an exploded war deployment we will delete “pom.xml”

rm -f  pom.xml

Note : We can also build an archive application using ant … and pom.xml serve the purpose. That we are not doing in this example.

4. Now copy your war inside deployments folder.

cp -r test.war /home/nikhil/OpenShift/test/deployments

5. Create a blank file as “<war-file name>.war.dodeploy.”

ex :
cd /home/nikhil/OpenShift/test/deployments

touch test.war.dodeploy

This file is needed to deploy the war as it is in exploded format. (Its feature of JBoss AS-7 ad we need not to worry much about it :P)

6. Now sync your local repository with OpenShift server using below command :

rsync -avz <deployments directory> <ssh-key of your application>@<application url>:~<application name>/repo/deployments

for example :

rsync -avz /home/nikhil/OpenShift/test/deployments/ pqrs7b6d3cf24ce12345a1ec3c1b7d99@test-testdomain.rhcloud.com:~/test/repo/deployments

where “pqrs7b6d3cf24ce12345a1ec3c1b7d99@test-testdomain.rhcloud.com” is the ssh key of your application which you can get by signing in to OpenShift MyApplications page.
“/test/repo/deployments” is the remote directory on server to which you always need to sync your app, whenever you make any change. Basically it is a symlink for OpenShift JBoss server’s “deployents” directory

Hit the application as :

http://<application name>-<domain name/name-space>.rhcloud.com/index.html

ex :


Enjoy clouding !! 🙂

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.