Deploy simple tomcat webapp in Openshift

1. Create an account with OpenShift.

2. Add application in free tier.

3. Within that application you are free to create Tomcat 7 , Web Load Balancer and MySQL instance.

4. Create the war file.

5. Copy  the war file to a location where you have the permission

eg .  scp -i your_certificate war_file.war      user_xxxx@yyyyy-zzzzzz.rhcloud.com:/var/lib/openshift/user_xxxx/app-root/data

6. ssh -i your_certificate user_xxxx@yyyy-zzzzzz.rhcloud.com

7. cp  war file to /var/lib/openshift/user_xxxx/app-root/dependencies/jbossews/webapps

8. Now restart all service using ctl_all restart in command line . ( or use the web front end )

9. Make sure all DB access variables are taken from the env variables

eg.   String dbHost = System.getenv(“OPENSHIFT_MYSQL_DB_HOST”);
String dbPort = System.getenv(“OPENSHIFT_MYSQL_DB_PORT”);
String appName = System.getenv(“OPENSHIFT_APP_NAME”);

10. Create the db first or configure hibernate config file to auto create the DB.

11. Its done and check the url ( will take some time )

Advertisements

About buminda

buminda.com
This entry was posted in MySQL, openshift, tomcat. Bookmark the permalink.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s