Intershop Enfinity template hot deployment

12.06.2012.

This blog entry describes the process of deploying templates code directly to the Intershop server. During the “hot deployment” of templates the application server doesn’t need to be restarted, which means application is available to customers during the time of deployment and changes are visible as soon as new files are uploaded to the server.

Templates processing

To understand how the deployment works it is necessary to understand the file structure and the processing system of templates in the Enfinity architecture.

A source code of every template in Enfinity is represented by an ISML file. ISML is a markup language that performs a greater amount of JSP functionality underneath. All ISML tags in a file are translated into JSP code fragments during compilation. At a later stage, Tomcat translates JSP files into Java classes and then Java compiles them into .class files that are used to produce http response which is in the end returned to the client.

By default application server behavior, when template processor cannot find the necessary class file or the date of the file is older than the date of ISML files, it invokes the ISML processor, which begins the steps of generating the class file:
• ISML processor prepares JSP file (converting all the specific Enfinity ISML tags into JSP fragments)
• A JSP compiler is then invoked to convert JSP to Java source code
• Finally, Java compiler converts the Java Source code into Java classes, used by the template processor

Deployment procedure

The deployment procedure varies depending on the properties of the application server. There are two general cases:

  1. Source checking is disabled in properties – template processor will always use the precompiled class file it finds on the file system
  2. Source checking is enabled in properties – template processor will check whether class file is older than the ISML file and will generate a new JSP/Java/class files from it.

The source checking can be enabled through file appserver.properties, which can be found in the following folder on the server file system:

<eserver>/share/system/config/cluster

The following line in the file enables the source checking:

intershop.template.CheckSource=true

In case when the source checking is enabled, the deployment is pretty simple. It is enough to copy the ISML file from the source system to the target and the template processor will take care of compiling the java class when template is invoked the next time.

Since source checking is typically disabled on production servers due to the performance impact, the more common scenario is the hot deployment with precompiled classes. Since both the JSP and java/class files are being generated during compile of the source code, it is possible to simply copy the compiled java classes to the target directory on the server and overwrite the old files. Tomcat JSP processor will then use the new JSP files to generate the response, since their date is newer then the date of the JSP files used before. To ensure that the deployment is complete and that the new code will not be replaced by the old one in future, it is recommended to copy the whole template file structure from the source to target system. A compiled template is consisted of 4 parts:

  • ISML file (Same as source code, .isml)
  • JSP file (Generated from ISML, .jsp)
  • Java Source Code (Java file generated from JSP, .java)
  • Java Class (Class file generated from Java source code, .class)

All site-related resources are deployed in the eserver cartridges target folder on the file system (for example – <eserver>/cartridges/ target).

For each cartridge, ISML file can be found in following folder:

<cartridge>/release/templates/<template folder>

JSP file can be found in folder:

<cartridge>/release/pagecompile/<template folder>

While Java source and class files can be found in folder:

<cartridge>/release/pagecompile/ish/cartridges/<cartridge>/<template folder>

Once the JSP file has been overwritten on target file system (either by copying only JSP file or all files), the deployment is complete and the result will be presented to users, without the need of restarting the server and with application being available through the whole time. For more information check the article about Intershop architecture regarding hot-deployment.