Continous Deployment with Apache Sling

September 2, 2014

Today I had the pleasure to attend the Master’s thesis defense of our intern Artyom Stetsenko, titled Continous Deployment of Apache Sling Applications.

Coaching Artyom for this project has been a pleasure, he did a great job and worked independently while listening very well to our advice. He got an excellent mark for his thesis and that was well deserved. Also due to an excellent no-bullets presentation!

I have uploaded Artyom’s thesis paper here, with his permission. The code is available at As the name indicates that’s experimental code, but the resulting Sling-based cluster with automated atomic deployment is functional. Just push an updated crankstart file to the Git repository and the cluster is updated atomically and without downtime.

For me the main goal was to see how we can improve Apache Sling‘s support of modern operations, with continuous deployment, immutable instances etc. I’m continuing my explorations with a Docker-based Sling cluster, the main goal being to create simple clustered environments that allow us to play with these things.

Update: I forgot to mention that my Docker cluster prototype is the basis for my upcoming talk at adaptTo() 2014 on September 23rd in Berlin. The talk’s title is “Apache Sling and devops – the next frontier” and I’ll talk about how Sling can be made more operations-friendly.

Google Summer Of Code 2009 – Real Soon Now!

March 6, 2009

The 2009 logo is fantastic, isn’t it? Flower power is not dead apparently.

Google Summer Of Code 2009 starts soon, open source organizations can sign up starting March 9th (a very important date planet-wide anyway), and students can sign up starting March 23rd.

An A4 flyer is available to display in your school, or anywhere geeks graze.

Assuming we’re accepted as an organization, projects of the Apache Software Foundation will be listed on our wiki. I’m probably going to suggest one or two Sling-related projects.

Philip Johnson’s video presentation (below) gives a good overview of the program and of its requirements, for students.

Sling RESTful scripting elevator pitch

January 31, 2009

Just sent the explanation below to the newly created Server-side Javascript discussion group (thanks Lars for the ping).

Such a compact explanation of how Sling processes requests using scripts could be useful on an elevator (you’d need a few floors though), so here it is:

Sling stores data in a JCR repository, which is basically a (potentially large) tree of Nodes and Properties attached to those Nodes, adressable by paths like in a filesystem.

An incoming URL maps to a Resource, which is usually a Node in the JCR repository. That mapping is 1:1 at the path level. Plus extension and “selectors”: a path like /content/foo.print.a4.html points to the /content/foo Node, print.a4 are selectors and html is the extension.

The Resource then defines a “resource type”, usually via a Property of the Node. If our /content/foo Node has a sling:resourceType Property with value “bar”, Sling looks for scripts under /apps/bar to process the request. For the html extension, for example, /apps/bar/html.js is used, if it exists. That could also be /apps/bar/html.rb for a Ruby script, if that scripting engine is installed. For other method names than GET, Sling looks for scripts named after the method, like POST.js or DELETE.js, under /apps/bar in our example.

This gives you RESTful interactions with content, with no configurations or annotations – just drop a script under the right path.

Using the JCR-Explorer with Sling

January 6, 2009

jcr-explorer-with-sling-200.jpgHere’s how to configure the JCR-Explorer tool under Tomcat, to use it with Sling.

Tested with Tomcat 6.0.18, JDK 1.5 and the Sling launchpad/webapp from revision 731934.

Starting with a fresh Tomcat install, add this to conf/server.xml, inside <GlobalNamingResources>:

<Resource name="jcr/globalRepository"

Add this to conf/context.xml, inside <Context>:

<ResourceLink name="jcr/repository"

Copy the jcr-explorer.war file to the tomcat webapps folder, start tomcat,
stop it (so that the webapp is expanded) and add this at the end of webapps/jcr-explorer/WEB-INF/web.xml, inside <web-app>:

<ResourceLink name="jcr/repository"

Copy these two jar files to the lib folder (or common/lib for Tomcat 5):
jackrabbit-jcr-rmi-1.5.0.jar and jcr-1.0.jar.

Start Sling with the RMI export of the repository enabled. That’s standard if you start the Sling launchpad/webapp module with mvn jetty:run, for example. Sling can either run inside Tomcat, or standalone, as the connection is made via RMI.

On the jcr-explorer login page (http://localhost:8080/jcr-explorer/login.jsf), use java:comp/env/jcr/repository as the JNDI URL, and admin/admin for login and password.

You should now see the JCR-Explorer page, as in our screenshot, displaying the contents of the Sling repository in the left pane (index.html, sling-logo.png, etc.).

This JCR-Explorer setup can be used to access any Jackrabbit repository accessible via rmi://, that should work with plain Jackrabbit setups as well, of course.

See the JCR-Explorer website for more info about how to use that tool.

Sling gets Python scripting support

December 17, 2008

Thanks to Renaud Richardet, who contributed a Python scripting engine for Sling, based on Jython.

A Sling-based blog in 46 lines of code

December 15, 2008

That’s the topic of my first post at It’s a simple introduction to the “take the J out of JCR” Sling features.

QOTD: Sling allows you to forget about the “J” in “JCR”

November 28, 2008

Sling allows you to forget about the “J” in “JCR” – I love that quote from Adam Constabaris’s excellent Apache Sling Overview slides.

I’m sure the Siing project would welcome such contributions (and Adam’s Sling POST servlet description as well) as part of our (currently lacking) documentation. Hear, hear!

Free Sling polo shirts! (NOT)

November 5, 2008

We’ll be giving away nice Sling polo shirts at the end of my talk today, be there!

The complete source code of the mini blog application that I’m going to create, in stages, during the talk, is available below.

Update: slides are available on the conference website.

Stop press: the shirts are held by customs in Memphis, we hope to have them by Friday but there’s no guarantee…sigh

Update: the shirts have finally arrived, grab them at the Day booth at ApacheCon!

Read the rest of this entry »

Sling at, that’s tomorrow!

September 24, 2008

We’re talking about Sling at tomorrow, together with Michael Marth, Day’s technology evangelist.

A number of Apache folk are talking there today and tomorrow, see the program – and meet us at tonight’s 6PM social event if you’re around!

Here are our slides, but it’s much better live on stage, so be there anyway!

Update: the demo code is available at SLING-673.

Why I love unixish configs

June 30, 2008

I wrote this today while discussing configuration mechanisms with my colleagues.

I love the unixish way of configurating things because the configs are:

With find, xargs and grep I can (very often) find out where something
is configured in my unixish system, with minimal initial knowledge.
It is easy to add comments to configuration items in a text-based
config, and comments are not mangled when that config is later
modified from a GUI, if that’s available.

Copying the right config files from one system to another allows
configs to be cloned.

By putting my configs under subversion control, I know what happened to them.
Processing my configs with simple tools allows me to create reports or
dashboards easily.

The opposite of this is the M$ hell of opaque configurations managed by (sometimes even more opaque) GUIs, and unfortunately Sling leans more towards that opposite at the moment. We’ll have to fix this.