Skip to content
Knot.x Starter Kit is a template project that you can use when creating some Knot.x extensions.
Kotlin Java Dockerfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
buildSrc
docker
functional/src/test/java/com/project/test/functional
gradle
knotx/conf
modules
.gitignore
LICENSE
README.md
azure-pipelines.yml
build.gradle.kts
gradle.properties
gradlew
gradlew.bat
settings.gradle.kts

README.md

Build Status

Knot.x Starter Kit

Knot.x Starter Kit is a template project that simplifies Knot.x project setup. It allows you to customize the Knot.x distribution with your own modules and configuration entries. Then it builds and validates your custom Docker image.

How to build

To start a new Knot.x project simply download the chosen ZIP version from https://github.com/Knotx/knotx-starter-kit/tags. To use the latest DEV version download this ZIP and switch to SNAPSHOT version.

In the unziped folder run

$> ./gradlew build

to:

  • build all your custom Knot.x modules
  • prepare your custom Docker image with all required dependencies (including your custom modules and its transitive dependencies)
  • validate your Docker image with system tests

How to run

Start Docker container

docker run -p8092:8092 knotx/knotx-starter-kit

and validate urls:

How to debug

Normal debugging

Edit Dockerfile in docker folder by adding

RUN sed -i 's/# JVM_DEBUG=/JVM_DEBUG=/g' /usr/local/knotx/bin/knotx

Start Docker container with additional port

docker run -p8092:8092 -p18092:18092 knotx/knotx-starter-kit

Startup debugging - use this when debugging start() methods

In addition to above edit Dockerfile by adding

RUN sed -i 's/suspend=n/suspend=y/g' /usr/local/knotx/bin/knotx

Comment out health-check section from Dockerfile

#HEALTHCHECK --interval=5s --timeout=2s --retries=12 \
#  CMD curl --silent --fail localhost:8092/healthcheck || exit 1

IMPORTANT ! - Make sure that CMD [ "knotx", "run-knotx" ] is a last command in Dockerfile

What does it contain

Custom modules

All modules are built into JAR files and copied to the KNOTX_HOME/lib folder in the project Docker image. Also all transitive dependencies are automatically downloaded and added to the Docker image.

Configuration

You can also override the default Knot.x configuration with your custom settings. All files from the /conf directory are copied to KNOTX_HOME/conf. So you can easily modify the Knot.x configuration, reconfigure the logger or update an Open API specification.

If you want to add a dependency that is not connected with any custom module such as Knot.x Dashboard you can add this entry in /build.gradle.kts:

dependencies {
    subprojects.forEach { "dist"(project(":${it.name}")) }
    "dist"("io.knotx:knotx-dashboard:${project.version}")
}

Dockerfile

Dockerfile is defined in the docker folder and extends the Base Knot.x Docker image.

How to work with SNAPSHOT

You need to build SNAPSHOT Docker image locally. The easiest approach is to use Knot.x Aggregator to clone and build all Knot.x modules. Then you need to build base Knot.x Docker image.

Now you can update gradle.properties with SNAPSHOT version.

You can’t perform that action at this time.