Skip to main content

Toolkit - Installation and Configuration

This post if part of a series about the File System Toolkit - a custom content delivery API for SDL Tridion.

The File System Toolkit consists of two parts: a Deployer extension and the Content Delivery API itself. This post describes installing and configuring both.

Toolkit JARs are available under the GitHub repository of the File System Toolkit project, in folder /distributable. Alternatively, you can build your JARs using the sources available on GitHub.

Toolkit Deployer Installation

This deployer extension handles the creation of JSON files on the file system. The Toolkit CD API then reads these JSON files and creates model objects from them.

In order to obtain these JSON files, a deployer extension must be installed on top of a functional Tridion Content Delivery Deployer. The Toolkit deployer extension works for both file system-based or database-based Tridion Deployers.

1. In the Tridion Deployer /lib folder, copy files:
  • toolkit-api.jar
  • toolkit-deployer.jar
  • toolkit-model.jar
2. Also to folder /lib, copy files:
  • ehcache-2.8.3.jar
  • jackson-annotations-2.6.4.jar
  • jackson-core-2.6.4.jar
  • jackson-databind-2.6.4.jar
  • logback-classic.jar
  • logback-core.jar
  • slfj-api.jar
3. Edit or create if it doesn't exist, file toolkit.properties and place it in the class-path of the Deployer (/WEB-INF/classes for an HTTP deployer). The following properties are relevant for deployer extension:
  • cacheEnabled - boolean whether to use cache or not;
  • cacheMaxEntriesLocalHeap - integer the size of the cache;
  • cacheMonitorSeconds - integer the interval in seconds to perform cache stale checks;
  • cacheTimeToLiveSeconds - integer the number of seconds to keep an item in cache;
  • cacheTimeToIdleSeconds - integer the number of seconds to keep an idle item in cache;
  • cleanup - boolean whether to delete empty directories after unpublish;
  • contentRoot - string the path where the published Tridion pages are published (this path is defined in cd_storage_conf.xml);
  • jsonRoot - string the path where the JSON files are stored under;
  • prettyPrintJson - boolean whether to space indent JSON files for better human-reading or not;
4. Edit file cd_deployer_conf.xml. Add the following lines before the end tag </Processors>

<!-- Toolkit JSon Modules -->
<Processor Action="Deploy" Phase="post-transaction" Class="com.tridion.deployer.Processor">
    <Module Type="PageDeploy" Class="com.mitza.toolkit.deployer.JSonPageDeploy"/>
    <Module Type="ComponentDeploy" Class="com.mitza.toolkit.deployer.JSonComponentDeploy"/>
    <Module Type="ComponentPresentationDeploy"
            Class="com.mitza.toolkit.deployer.JSonComponentPresentationDeploy"/>
    <Module Type="BinaryDeploy" Class="com.mitza.toolkit.deployer.JSonBinaryDeploy"/>
</Processor>

<Processor Action="Undeploy" Phase="post-transaction" Class="com.tridion.deployer.Processor">
    <Module Type="PageUndeploy" Class="com.mitza.toolkit.deployer.JSonPageUndeploy"/>
    <Module Type="ComponentPresentationUndeploy"
            Class="com.mitza.toolkit.deployer.JSonComponentPresentationUndeploy"/>
</Processor>
<!-- End of Toolkit JSon Modules -->

5. Edit file cd_storage_conf.xml. Add the following lines after the opening tag <Storages>

<StorageBindings>
    <Bundle src="toolkit_dao_bundle.xml"/>
</StorageBindings>

6. Restart the Deployer

Toolkit API Installation

The Toolkit is an API to be used in your web-application as middle-tier to retrieve content published from SDL Tridion. The installation implies copying the JARs and configuration files to folders available in the class-path of your web-application:

1. In your web-application /lib folder, copy files:
  • toolkit-api.jar
  • toolkit-dynamic.jar
  • toolkit-model.jar
2. Also to folder /lib, copy files:
  • ehcache-2.8.3.jar 
  • jackson-annotations-2.6.4.jar 
  • jackson-core-2.6.4.jar 
  • jackson-databind-2.6.4.jar 
  • logback-classic.jar 
  • logback-core.jar 
  • slfj-api.jar 
3. Edit or create if it doesn't exist, file toolkit.properties and place it in folder /WEB-INF/classes. The following properties are relevant:
  • cacheEnabled - boolean whether to use cache or not;
  • cacheMaxEntriesLocalHeap - integer the size of the cache;
  • cacheMonitorSeconds - integer the interval in seconds to perform cache stale checks;
  • cacheTimeToLiveSeconds - integer the number of seconds to keep an item in cache;
  • cacheTimeToIdleSeconds - integer the number of seconds to keep an idle item in cache;
  • contentRoot - string the path where the published Tridion pages are published (this path is defined in cd_storage_conf.xml);
  • jsonRoot - string the path where the JSON files are stored under;
In case dynamic tags are used, they can be configured using properties tag.name.X and tag.class.X. These tags define the tag name and tag fully qualified class name to be executed when the given tag name is encountered in the Component Presentation content. The X stands for a 1-based counter that allows us to define several tags by simply incrementing the counter.

Example:
The following definition of tags defines 2 tags. First with name mytag backed by class com.mitza.toolkit.tag.MyTag and the second with name yourtag and backed by class com.mitza.toolkit.tag.SecondTag:

tag.name.1=mytag
tag.class.1=com.mitza.toolkit.tag.MyTag
tag.name.2=yourtag
tag.class.2=com.mitza.toolkit.tag.SecondTag

At this moment, the Toolkit API can be executed in the web-application.

Logging

The Toolkit uses logback API. This can be configured in a logback.xml file in the web-application class-path (typically in WEB-INF/classes folder).

Add a logger on classes under com.mitza package and the logging will be output.

Sample logback.xml that outputs to console:

<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true">
    <property name="log.pattern" value="%date [%thread] %5p %c{1} - %m%n"/>
    <property name="log.level" value="info"/>

    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>${log.pattern}</pattern>
        </encoder>
    </appender>

    <logger name="com.mitza" level="${log.level}"/>

    <root level="OFF">
        <appender-ref ref="STDOUT"/>
    </root>
</configuration>



Comments

Popular posts from this blog

Running sp_updatestats on AWS RDS database

Part of the maintenance tasks that I perform on a MSSQL Content Manager database is to run stored procedure sp_updatestats . exec sp_updatestats However, that is not supported on an AWS RDS instance. The error message below indicates that only the sa  account can perform this: Msg 15247 , Level 16 , State 1 , Procedure sp_updatestats, Line 15 [Batch Start Line 0 ] User does not have permission to perform this action. Instead there are several posts that suggest using UPDATE STATISTICS instead: https://dba.stackexchange.com/questions/145982/sp-updatestats-vs-update-statistics I stumbled upon the following post from 2008 (!!!), https://social.msdn.microsoft.com/Forums/sqlserver/en-US/186e3db0-fe37-4c31-b017-8e7c24d19697/spupdatestats-fails-to-run-with-permission-error-under-dbopriveleged-user , which describes a way to wrap the call to sp_updatestats and execute it under a different user: create procedure dbo.sp_updstats with execute as 'dbo' as

Content Delivery Monitoring in AWS with CloudWatch

This post describes a way of monitoring a Tridion 9 combined Deployer by sending the health checks into a custom metric in CloudWatch in AWS. The same approach can also be used for other Content Delivery services. Once the metric is available in CloudWatch, we can create alarms in case the service errors out or becomes unresponsive. The overall architecture is as follows: Content Delivery service sends heartbeat (or exposes HTTP endpoint) for monitoring Monitoring Agent checks heartbeat (or HTTP health check) regularly and stores health state AWS lambda function: runs regularly reads the health state from Monitoring Agent pushes custom metrics into CloudWatch I am running the Deployer ( installation docs ) and Monitoring Agent ( installation docs ) on a t2.medium EC2 instance running CentOS on which I also installed the Systems Manager Agent (SSM Agent) ( installation docs ). In my case I have a combined Deployer that I want to monitor. This consists of an Endpoint and a

Debugging a Tridion 2011 Event System

OK, so you wrote your Tridion Event System. Now it's time to debug it. I know this is a hypothetical situtation -- your code never needs any kind of debugging ;) but indulge me... Recently, Alvin Reyes ( @nivlong ) blogged about being difficult to know how exactly to debug a Tridion Event System. More exactly, the question was " What process do I attach to for debugging even system code? ". Unfortunately, there is no simple or generic answer for it. Different events are fired by different Tridion CM modules. These modules run as different programs (or services) or run inside other programs (e.g. IIS). This means that you will need to monitor (or debug) different processes, based on which events your code handles. So the usual suspects are: dllhost.exe (or dllhost3g.exe ) - running as the MTSUser is the SDL Tridion Content Manager COM+ application and it fires events on generic TOM objects (e.g. events based on Tridion.ContentManager.Extensibility.Events.CrudEven