Auto-Deploy Java Server Faces (JSF) Web Application To Amazon Web Services (AWS) cloud Using Jenkins CI
Maharishi University of Management
Web Application Architecture (WAA)
Honors Project (presentation)
Auto-Deploy Java Server Faces (JSF) Web Application To
Amazon Web Services (AWS) cloud
Using Jenkins CI
Old School way of deploying Java/JSF applications:
1. Build the project to get .war file
2. Upload the .war file to server
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.
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).
About the Application
Simple JSF (CDI) application created on NetBeans using Maven
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)
5.Git Bash (For command line interface to Git remote repository)
6.Amazon EC2 Instance (On Ubuntu 12.04 LTS 64 bit)
JSF (CDI) project created on NetBeans
The project has Junit test cases.
Project is git initialized and points to remote github repository.
Sample project: https://github.com/james-singh/jsf-maven
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.
Server Instance on Amazon EC2
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.
Sequence of Events
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
●The changes are deployed.
●Emails are received notifying about Build/Deployment success/failure.
1. Setting up a JSF Maven project in NetBeans (including working autocompletion for JSP/JSF)
2. NetBeans Maven Best Practices - Installing section
3. 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)
5. weld-jsf-jee (Github)
6. Pre-configured, ready to run image for running Jenkins on Amazon EC2
7. Glassfish Ubuntu 12.04 Ubber Quick Install Guide