Zero redeployment with JRebel




                          Minh Hoang TO

                          Portal Team
Agenda

 1. JRebel


 2. GateIn zero-redeployment


 3. How does JRebel work?




             www.exoplatform.com - Copyright 2012 eXo Platform   2
JRebel



www.exoplatform.com - Copyright 2012 eXo Platform   3
- Developer(s): Zero Turnaround

- Written in: Java

- License: Proprietary

- Highlighted features:

   Immediately visible code changes without redeploying

   Easy installation and simple configuration



                          www.exoplatform.com - Copyright 2012 eXo Platform   4
Free license plans


OSS plan

Commiters of Open Source projects have access to free license


Social plan


Free license in exchange of privileged to post on Twitter/Facebook account




                    www.exoplatform.com - Copyright 2012 eXo Platform        5
GateIn zero-deployment



     www.exoplatform.com - Copyright 2012 eXo Platform   6
GateIn code changes in IDE are reflected immediately on browser without the
need of redeploying. Say GOODBYE to tedious redeploy work



 Productive dev environment applicable to any eXo product:

         Social, Wiki, Forum, ECMS, Platform




                     www.exoplatform.com - Copyright 2012 eXo Platform        7
Demo



- Targeted Maven artifacts:

 exo.portal.webui.portal (basic UI components of GateIn portal)

 exo.portlet.exoadmin (core portlets of GateIn)


- Expectation:

 Code changes on portal/portlet components from those two artifacts take
 effect on browser without the need of redeploying .war to Tomcat




                      www.exoplatform.com - Copyright 2012 eXo Platform    8
Before demo

1. Customize packaging/tomcat/pkg/src/main/resources/tomcat/bin/gatein-dev.sh




2. Generate rebel.xml in targeted Maven artifacts


3. Build and run GateIn




                      www.exoplatform.com - Copyright 2012 eXo Platform     9
rebel.xml




            www.exoplatform.com - Copyright 2012 eXo Platform   10
rebel.xml




            www.exoplatform.com - Copyright 2012 eXo Platform   11
JRebel agent starts




               www.exoplatform.com - Copyright 2012 eXo Platform   12
Demo starting ...



  www.exoplatform.com - Copyright 2012 eXo Platform   13
How does JRebel work?



     www.exoplatform.com - Copyright 2012 eXo Platform   14
Object & Class

        MyObject obj = new MyObject();

        Class<?> type = obj.getClass();


1. Behavior of method call on 'obj' is determined by 'type'

2. 'type' is identified by MyObject.class bytecode and context ClassLoader of the
   code MyObject obj = new MyObject();

3. Once loaded, 'type' could not be unloaded or changed (class loader holds a
vector of loaded classes)

4. JRebel approach to redefine 'type'

   Black box as JRebel is not open source! But described as a combination of

       Instrumentation API + Byte code handling + Class loader

                       www.exoplatform.com - Copyright 2012 eXo Platform        15
Class redefinition




               www.exoplatform.com - Copyright 2012 eXo Platform   16
MANIFEST.MF




              www.exoplatform.com - Copyright 2012 eXo Platform   17
JRebel agent


The code in AgentInstall is likely to be




                       www.exoplatform.com - Copyright 2012 eXo Platform   18

Zero redeployment with JRebel

  • 1.
    Zero redeployment withJRebel Minh Hoang TO Portal Team
  • 2.
    Agenda 1. JRebel 2. GateIn zero-redeployment 3. How does JRebel work? www.exoplatform.com - Copyright 2012 eXo Platform 2
  • 3.
  • 4.
    - Developer(s): ZeroTurnaround - Written in: Java - License: Proprietary - Highlighted features: Immediately visible code changes without redeploying Easy installation and simple configuration www.exoplatform.com - Copyright 2012 eXo Platform 4
  • 5.
    Free license plans OSSplan Commiters of Open Source projects have access to free license Social plan Free license in exchange of privileged to post on Twitter/Facebook account www.exoplatform.com - Copyright 2012 eXo Platform 5
  • 6.
    GateIn zero-deployment www.exoplatform.com - Copyright 2012 eXo Platform 6
  • 7.
    GateIn code changesin IDE are reflected immediately on browser without the need of redeploying. Say GOODBYE to tedious redeploy work Productive dev environment applicable to any eXo product: Social, Wiki, Forum, ECMS, Platform www.exoplatform.com - Copyright 2012 eXo Platform 7
  • 8.
    Demo - Targeted Mavenartifacts: exo.portal.webui.portal (basic UI components of GateIn portal) exo.portlet.exoadmin (core portlets of GateIn) - Expectation: Code changes on portal/portlet components from those two artifacts take effect on browser without the need of redeploying .war to Tomcat www.exoplatform.com - Copyright 2012 eXo Platform 8
  • 9.
    Before demo 1. Customizepackaging/tomcat/pkg/src/main/resources/tomcat/bin/gatein-dev.sh 2. Generate rebel.xml in targeted Maven artifacts 3. Build and run GateIn www.exoplatform.com - Copyright 2012 eXo Platform 9
  • 10.
    rebel.xml www.exoplatform.com - Copyright 2012 eXo Platform 10
  • 11.
    rebel.xml www.exoplatform.com - Copyright 2012 eXo Platform 11
  • 12.
    JRebel agent starts www.exoplatform.com - Copyright 2012 eXo Platform 12
  • 13.
    Demo starting ... www.exoplatform.com - Copyright 2012 eXo Platform 13
  • 14.
    How does JRebelwork? www.exoplatform.com - Copyright 2012 eXo Platform 14
  • 15.
    Object & Class MyObject obj = new MyObject(); Class<?> type = obj.getClass(); 1. Behavior of method call on 'obj' is determined by 'type' 2. 'type' is identified by MyObject.class bytecode and context ClassLoader of the code MyObject obj = new MyObject(); 3. Once loaded, 'type' could not be unloaded or changed (class loader holds a vector of loaded classes) 4. JRebel approach to redefine 'type' Black box as JRebel is not open source! But described as a combination of Instrumentation API + Byte code handling + Class loader www.exoplatform.com - Copyright 2012 eXo Platform 15
  • 16.
    Class redefinition www.exoplatform.com - Copyright 2012 eXo Platform 16
  • 17.
    MANIFEST.MF www.exoplatform.com - Copyright 2012 eXo Platform 17
  • 18.
    JRebel agent The codein AgentInstall is likely to be www.exoplatform.com - Copyright 2012 eXo Platform 18