Open Sourcing Alfresco Docker Gradle plugin

Posted by Daniela Di Noi on 10/25/18 1:51 PM

Find me on:

This month, Xenit open sourced Gradle plugin to build Alfresco Docker images.

Lars Vierbergen (LV) and Thijs Lemmens (TL), ECM software engineers at Xenit, are the authors of the plugin. We interviewed them to learn how to easily and quickly start Alfresco integration projects.

#Q1 - Why did we develop the Alfresco Docker Gradle Plugin?


LV - At Xenit, we use Gradle to build our Java projects. Gradle provides high flexibility to build and configure our projects, because the steps are specified within Groovy or Java code.
We can quickly script extra functionalities directly in the `build.gradle` buildscript, when it is required in a specific project.

Of course, copying-pasting functions between the build scripts of multiple projects is unproductive and impossible to maintain. We moved these commonly used functions to a Gradle plugin, that is maintained separately. As a result, the plugin allows users to quickly and easily start a new Alfresco integration project. You can start a customized Alfresco by only providing a base war, amps and a docker base image. The docker-alfresco gradle plugin will run an equivalent of `apply-amps` to install Alfresco AMP packages in an Alfresco war, and then create a docker image from it.



#Q2 - How did we build the plugin?

TL - We started with a simple implementation which runs the Alfresco module management tool to install amps into an Alfresco war, and then created a docker-file to add the war files in the tomcat webapps folder. Uploading a war file to the tomcat webapps folder is not recommended, because as soon as tomcat starts up, it will automatically unpack the war to be able to serve the web application.

Although this approach is not optimal, we adopted the agile methodology, building a first version of the plugin and getting feedback from our colleagues that have used and tested it.

A first improvement we made to this process is to have the gradle plugin unpack the war before it is added to the docker image.
Using an already unpacked war avoids having tomcat unpack the war when it first starts up, and opens up the possibility for further optimizations.

Due to the fact that the plugin is configured declaratively we, as plugin authors, can freely modify and improve the plugin, without breaking everyone’s projects.


#Q3 - What is a lean image?

LV - One of the primary issues that we encountered with our plugin is that we add the content of a complete Alfresco war to the docker image every time we build a new Alfresco with AMPs.
Although storage is affordable, adding a large new layer to the base docker image, every time a small change is done to any AMP, results in a lot of storage being wasted.
Every time we build a new layer, new exploded wars for both Alfresco and Share are added to the image, consuming about 350MB of disk space.

To solve this problem of wasting disk space, which was affecting both our build server and docker registry, we added an extra flag to the plugin to create lean images.
Instead of being based on an empty tomcat image, we use a base image which has already an exploded Alfresco war in the webapps folder.
Only the changes to the base Alfresco war are added on top of the existing exploded war.

Gradle plugin

#Q4 - What are the potential use cases?

TL - At Xenit, we have two different use cases for setting up an Alfresco with docker.
We (1) develop reusable modules that are packaged in an AMP and (2) we also build custom solutions for clients, with Alfresco at the core.

For both use cases, our aim is easily set up an Alfresco container with our latest changes.
This Alfresco can then be used to run both, manual and automated, integration tests.
Being able to quickly spin up a fully configured Alfresco reduces the friction to get started with a new project. It also makes possible to revert to a known good state should anything go wrong.

For customer projects, our build server pushes the created docker images to our docker registry. This docker image is later deployed in test and production environments at our clients.
Being able to quickly use and reproduce the same environment as production is valuable for testing and reproducing issues afterwards.


We are really proud of Lars and Thijs and the entire team: with more than ten years of experience in Alfresco, we deliver, behind products and solutions, expertise, quality and reliability. 

The Alfresco Docker Gradle plugin is available on GitHub.

 Gradle Plugin





Topics: Alfresco, Alfred, gradle, Docker, plugin

About Xenit 


Xenit is a Belgium-based IT company, focusing  on content services solutions, and covering all document-related business processes, from data migration to digital archive to hybrid/cloud hosting solution, to help organizations get control of their information. Premier Partner and System Integrator of Alfresco Digital Business Platform, Xenit has more than 10 years of experience in Alfresco Content and Process Services.


Subscribe to Email Updates

Recent Posts

Posts by Topic

see all