Auto-Deploy Java Server Faces (JSF) Web Application To Amazon Web Services (AWS) cloud Using Jenkins CI

1,905 views
1,535 views

Published on

More on the steps at:
http://jmsktm.tumblr.com/post/84078298860/auto-deploy-jsf-maven-project-on-amazon-ec2-using
There are few more in my blog on the topic.
http://jmsktm.tumblr.com/

Published in: Engineering, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,905
On SlideShare
0
From Embeds
0
Number of Embeds
27
Actions
Shares
0
Downloads
11
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Auto-Deploy Java Server Faces (JSF) Web Application To Amazon Web Services (AWS) cloud Using Jenkins CI

  1. 1. James Singh Maharishi University of Management 04/23/2014 james.singh@hotmail.com http://www.twitter.com/jmsktm Web Application Architecture (WAA) Honors Project (presentation) Auto-Deploy Java Server Faces (JSF) Web Application To Amazon Web Services (AWS) cloud Using Jenkins CI
  2. 2. Old School way of deploying Java/JSF applications: 1. Build the project to get .war file 2. Upload the .war file to server Major Problems: 1.Version control isn't inherent. 2.Time consuming, and bandwidth heavy. Requires generating and uploading bulky war file during every deployment, even when the change is very small. 3.The WAR will deploy even if the test cases weren't all passing. This leads to defective application running in production.
  3. 3. The Auto deployment way 1. Commit the change in version control in desired branch. What problems does it solve? 1.Version controlled. Any branch/version can be deployed anytime. 2.Only difference (changes) get committed to version control repository. 3.Test cases are run automatically during deployment. If test cases fail, build fails, and the application isn't deployed. 4.Deployment happens automatically on commit (if configured so).
  4. 4. About the Application Simple JSF (CDI) application created on NetBeans using Maven archetype weld-jsf-jee. Tools used for auto-deployment setup 1.Apache Maven http://en.wikipedia.org/wiki/Apache_Maven 2.Git/GitHub (Options: Bitbucket, Assembla, Install gitolite/gitosis) 3.Jenkins CI http://en.wikipedia.org/wiki/Jenkins_(software) 4.Glassfish server 5.Git Bash (For command line interface to Git remote repository) 6.Amazon EC2 Instance (On Ubuntu 12.04 LTS 64 bit)
  5. 5. Three components: 1.Client Machine 2.Git Repository 3.Server Instance
  6. 6. Client Machine:  JSF (CDI) project created on NetBeans  The project has Junit test cases.  Uses Maven  Project is git initialized and points to remote github repository. Sample project: https://github.com/james-singh/jsf-maven
  7. 7. Git Repository:  The code repository resides here (GitHub in this case).  Changes committed from client machine are reflected here.  Server Instance polls git repo for changes periodically.
  8. 8. Server Instance on Amazon EC2  IP: http://54.83.62.123  Running Ubuntu 12.04 LTS.  Installed applications: Jenkins (Also the plugin: Deploy Plugin), Maven, Git, Jdk1.8, Glassfish  If any changes are pushed to Git repository, Jenkins will automatically PULL the changes, BUILD the project, TEST the project, and if successful, DEPLOY the project to Glassfish. It can be made to send emails on BUILD SUCCESS, BUILD FAILURE and successful deployment.
  9. 9. Sequence of Events Action Changes are merged and pushed to git. Internal chain of events ●Changes happen in remote git repo on Github ●Jenkins PULLs changes using Git ●Jenkins BUILDs project using Maven ●Jenkins TESTs changes using Maven ●Jenkins DEPLOYs project to Glassfish ●Jenkins sends out emails Result ●The changes are deployed. ●Emails are received notifying about Build/Deployment success/failure.
  10. 10. References: 1. Setting up a JSF Maven project in NetBeans (including working autocompletion for JSP/JSF) http://www.congiu.com/setting-up-a-jsf-maven-project-in-netbeans-including-working-autocompletion-for-jsp 2. NetBeans Maven Best Practices - Installing section http://wiki.netbeans.org/MavenBestPractices#section-MavenBestPractices-Installing 3. Get running on CDI & JSF 2 in a jiffy using Maven archetypes http://planet.jboss.org/post/get_running_on_cdi_jsf_2_in_a_jiffy_using_maven_archetypes 4. Weld maven archetype (weld-jsf-jee) for creating a Java EE 6 application using JSF 2.0, CDI 1.0, EJB 3.1 and JPA 2.0 (persistence unit included) http://mvnrepository.com/artifact/org.jboss.weld.archetypes/weld-jsf-jee/1.0.0-BETA1 5. weld-jsf-jee (Github) https://github.com/indhio/weld/tree/master/weld-jsf-jee 6. Pre-configured, ready to run image for running Jenkins on Amazon EC2 https://aws.amazon.com/marketplace/pp/B0085PMZ9Q 7. Glassfish Ubuntu 12.04 Ubber Quick Install Guide http://www.silvatechsolutions.com/tech-tips/glassfish-ubuntu-12-04-ubber-quick-install-guide/
  11. 11. Questions?

×