Skip to content

somarc/sling-org-apache-sling-starter

Β 
Β 

Repository files navigation

Apache Sling

Build Status Test Status Sonarcloud Status JavaDoc Maven Central License

Apache Sling Starter (Blockchain AEM Fork)

πŸ”— This is a fork of Apache Sling Starter for the Blockchain AEM project

This fork extends the Apache Sling Starter to support Blockchain AEM, a distributed content repository that bridges Ethereum smart contracts with Apache Jackrabbit Oak's immutable segment store.

🎯 Purpose

This Sling Starter fork simulates AEM clients (authors and publishers) that connect to the global oak-chain validator network. It provides a test environment for:

  • Multi-peer AEM instances: Multiple Sling authors connecting to different validators
  • Read-only global content: Mounting the global oak-chain as a read-only composite NodeStore
  • Wallet-based writes: Testing write operations that require Ethereum wallet signatures
  • Validator network interaction: Demonstrating how AEM clients register and communicate with validators

This fork adds:

  • Oak Blockchain Feature: Composite NodeStore configuration that mounts a read-only global oak-chain via HTTP segment transfer
  • Wallet-Based Authentication: Integration with Ethereum wallet signatures for write operations
  • Agentic Chat Interface: Embedded LLM assistant for natural language queries about Oak validators and system state
  • Local Development Tools: Helper scripts for Docker-free development and testing

Note: In production, AEM instances (authors and publishers) would connect to the validator network similarly to how this Sling Starter connects. This fork provides a lightweight way to test and demonstrate the client-side integration without requiring full AEM installations.

πŸ”— Related Projects

This Sling Starter fork is part of the broader Blockchain AEM ecosystem:

  • jackrabbit-oak (feature/blockchain-aem-poc branch): Core Oak modules including oak-segment-consensus, oak-segment-http, and oak-segment-agentic
  • blockchain-aem-infra: Infrastructure scripts, Docker Compose configurations, and deployment automation
  • Blockchain-AEM: Documentation, architecture designs, and project management

πŸ“š Original Apache Sling Starter

This module is part of the Apache Sling project.

The starter project produces feature artifacts that can be launched using the Feature Launcher.

It is not meant to be a production-ready setup, more as a way to facilitate experimenting and learning Sling.

See Releasing a new version of the Sling starter for how to create a release of this module.

How to run the Sling Starter module in Standalone mode

Note This is a note "mvn clean" deletes the "launcher" work directory in the project base directory. It is advisable to use a work directory outside of the project directory.

  1. Build the Sling Starter using

    mvn clean install

    in the current directory.

    Hint You can defer stopping the instance after running the ITs with argument -Dfeature-launcher.waitForInput=true to do some manual checks.

  2. Start Sling backed by

    • Oak Blockchain (Composite NodeStore) with helper script:

      ./scripts/run-sling-local.sh 4502 http://localhost:8091

      This runs Sling on port 4502 (AEM author port) and connects to validators.

      Blockchain AEM: This configuration simulates an AEM client connecting to the global oak-chain validator network. It mounts a read-only global oak-chain via HTTP segment transfer. Writes require Ethereum wallet signatures and are routed through the validator network's Aeron Cluster consensus.

    • Oak SegmentStore with

      target/dependency/org.apache.sling.feature.launcher/bin/launcher -f target/slingfeature-tmp/feature-oak_tar.json

      If you are using Windows:

      target\dependency\org.apache.sling.feature.launcher\bin\launcher.bat -f target\slingfeature-tmp\feature-oak_tar.json
    • Oak Blockchain manually (without helper script):

      export OAK_GLOBAL_STORE_URL=http://localhost:8091
      target/dependency/org.apache.sling.feature.launcher/bin/launcher \
        -f target/slingfeature-tmp/feature-oak_blockchain.json \
        -Dorg.osgi.service.http.port=4502
    • Oak MongoDB DocumentStore with

      target/dependency/org.apache.sling.feature.launcher/bin/launcher -f target/slingfeature-tmp/feature-oak_mongo.json

      If you are using Windows:

      target\dependency\org.apache.sling.feature.launcher\bin\launcher.bat -f target\slingfeature-tmp\feature-oak_mongo.json

      This expects a MongoDB server to be running, search for mongodb:// in the feature files for the expected URL (currently mongodb://localhost:27017).

  3. Browse Sling:

How to run the Sling Starter Docker image

The following tags are supported

Tag name Supported platforms Links
12, latest amd64 Dockerfile, Release notes
11 amd64 Dockerfile, Release notes
10 amd64 Dockerfile, Release notes
9 amd64 Dockerfile, Release notes
snapshot amd64, arm64 Dockerfile
  1. Start Sling Docker image backed by
    • Oak SegmentStore with
      docker volume create sling-launcher
      docker run --rm -p 8080:8080 -v sling-launcher:/opt/sling/launcher apache/sling:snapshot
    • Oak MongoDB DocumentStore with
      docker volume create sling-launcher
      docker run --rm -p 27017:27017 mongo:4.4.6
      docker run --rm -p 8081:8080 -v sling-launcher:/opt/sling/launcher apache/sling:snapshot oak_mongo

The docker/ directory contains sample files related to container-based development.

Testing

The Sling Starter will execute two suites of tests using the maven-surefire-plugin:

  1. A small set of smoke tests, embedded in the project, that verify the basic functionality of the Starter
  2. An extensive set of end-to-end tests that verify the overall functionality of the Starter and the bundles that are embedded into it

By default, these are both executed when building the project against an Oak SegmentNodeStore backend.

Additionally, when the ci profile is enabled the smoke tests are also executed in against an Oak DocumentNodeStore backend. For technical resons, the full end-to-end tests are not executed.

Docker

The Sling Starter Docker image is only for testing/learning purposes. For your custom applications, please configure your Feature model and build your image with all dependencies and configurations built in.

Our example Docker image uses /opt/sling/bin/launch.sh script as the entrypoint. It supports the following environment variables:

Environment variable Description Example
JAVA_DEBUG_PORT Run Sling Starter in Java debug mode 5005
EXTRA_JAVA_OPTS Extra java options e.g Xmx or Xms. -Xms256m -Xmx2048m

Example running Sling Starter in debug mode with custom memory settings

docker run -p 8080:8080 -p 5005:5005 -e JAVA_DEBUG_PORT=5005 -e EXTRA_JAVA_OPTS='-Xms256m -Xmx2048m' apache/sling:snapshot

Building the Docker image

This module can optionally build a Docker image. This is achieved by running a build with the -Ddocker.skip=false argument. By default, the image is built as apache/sling:snapshot. The tag can be overrriden using the docker.image.tag Maven property.

$ mvn clean package -Ddocker.skip=false -Ddocker.image.tag=local
$ docker run --rm -p 8080:8080 apache/sling:local

Extending the Sling Starter

If you wish the extend the Sling Starter but would like to keep various application-level features out, you can start with the nosample_base aggregate, which contains:

  • all the base features
  • Oak base features, without the NodeStore setup
  • No applications ( Composum, Slingshot, etc )

For instance, launching an empty Sling Starter with segment persistence can be achieved by running

target/dependency/org.apache.sling.feature.launcher/bin/launcher -f target/slingfeature-tmp/feature-nosample_base.json,target/slingfeature-tmp/feature-oak_persistence_sns.json

Your own feature files can be added to the feature list.

Helper scripts

The scripts directory contains helper scripts that will aid with local development by simplifying the use of tools external to the Sling Starter.

Blockchain AEM Specific Scripts

  • scripts/run-sling-local.sh: Launches Sling with Oak Blockchain feature, connecting to validator network
  • blockchain-aem-content/: Custom content modules including agentic chat interface servlets

πŸš€ Getting Started with Blockchain AEM

For a complete setup guide, see the Blockchain AEM README and Quick Start Guide.

Quick Start (Simulating AEM Client Connection):

  1. Start validators: cd ../blockchain-aem-infra/scripts/local-development && ./run-validators-local.sh start
  2. Build Oak modules: cd ../../../jackrabbit-oak && mvn clean install -pl oak-segment-consensus,oak-segment-http,oak-segment-agentic -am -DskipTests
  3. Build Sling Starter: cd ../sling-org-apache-sling-starter && mvn clean package -DskipTests
  4. Start Sling (simulating AEM author): ./scripts/run-sling-local.sh 4502 http://localhost:8091
  5. Access: http://localhost:4502 (Sling/AEM client) and http://localhost:8091 (Validator Dashboard)

Multiple Clients: You can start multiple Sling instances on different ports to simulate multiple AEM authors/publishers connecting to the validator network. Each instance will mount the global oak-chain as read-only and can perform wallet-authenticated writes through the validator network.

πŸ“– Additional Resources

About

Apache Sling Starter Application

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 87.4%
  • HTML 7.1%
  • Shell 4.6%
  • Dockerfile 0.9%