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 https://github.com/ArtyomStetsenko/sling-devops-experiments. 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"
  auth="Container"
  type="javax.jcr.Repository"
  factory="org.apache.jackrabbit.rmi.client.ClientRepositoryFactory"
  url="rmi://127.0.0.1:1099/jackrabbit"/>

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

<ResourceLink name="jcr/repository"
  global="jcr/globalRepository"
  type="javax.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"
  global="jcr/globalRepository"
  type="javax.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://127.0.0.1:1099/jackrabbit, 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 dev.day.com. 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!