Knot.x Example Project
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 Added changelog and community support files Oct 10, 2018
acme-cluster Change version to 1.5.0-SNAPSHOT Oct 18, 2018
acme-forms-adapter-http change adapter attributes Oct 23, 2018
acme-gateway Change version to 1.5.0-SNAPSHOT Oct 18, 2018
acme-handlebars-ext Change version to 1.5.0-SNAPSHOT Oct 18, 2018
acme-sample-service Change version to 1.5.0-SNAPSHOT Oct 18, 2018
acme-stack Configuration changes: CR fixes. Nov 19, 2018
documentation/.dataobjects rename Oct 11, 2018
gradle/wrapper gradle version fix Oct 11, 2018
.editorconfig Example knotx project based on Starter Apr 16, 2018
.gitignore introducing gradle support Jun 29, 2018
.travis.yml Adding travis configuration for gradlew. Jul 3, 2018
CHANGELOG.md Merge branch 'master' into bugfix/multiforms Oct 25, 2018
CODE_OF_CONDUCT.md Added changelog and community support files Oct 10, 2018
CONTRIBUTING.md Added changelog and community support files Oct 10, 2018
Dockerfile Added acme-stack build, dockerized cluster, enabled releases Apr 20, 2018
LICENSE Example knotx project based on Starter Apr 16, 2018
README.md update readme Oct 24, 2018
build.gradle Add publish to maven task in gradle Oct 11, 2018
gradle.properties Change version to 1.5.0-SNAPSHOT Oct 18, 2018
gradlew introducing gradle support Jun 29, 2018
gradlew.bat gradle version fix Oct 11, 2018
pom.xml Change version to 1.5.0-SNAPSHOT Oct 18, 2018
release.gradle Add publish to maven task in gradle Oct 11, 2018
settings.gradle rename Oct 11, 2018

README.md

Knot.x example project

The example project shows how you can use Knot.x and develop it in a real project. Uses the Knot.x Stack distribution and provides custom configuration files, sample content and modules.

Prerequisites

  • JDK 8+
  • Maven or Gradle

Getting started

The example project consists of:

  • acme-stack - contains all configuration files and the sample content
  • acme-forms-adapter-http - handles forms submit requests (POSTs), executes business logic and redirects to the next step / confirmation page / stay on the same page
  • acme-gateway - provides the Gateway API interface that can be used by front-end integration
  • acme-handlebars-ext - adds custom Handlebars directives
  • acme-sample-service - runs the HTTP server on the 3000 port, which mocks real JSON service responses

The acme-stack module contains all required artifacts to build the example distribution. The result of the build process is a ZIP file that you can deploy to the server, extract and run with bin\knotx run-knotx. The run-knotx command starts all Knot.x modules, configures logs, and sets Java options. Note that all dependencies like acme-forms-adapter-http, acme-gateway, acme-handlebars-ext and acme-sample-service are build and copied to the distribution.

How to build

Clone the repository and build the example project:

Maven build

Let's run the command below:

$> mvn package

The distribution ZIP file location is acme-stack/target/knotx-example-project-stack-X.X.X.zip.

Gradle build

Let's run the command below:

$> gradlew

The distribution ZIP file location is acme-stack/build/distributions/knotx-example-project-stack-X.X.X.zip

How to run

Run locally:

Go to the acme-stack folder in the unpacked zip file and run the Knot.x script

Unix and MacOS
$> bin/knotx run-knotx
Windows
$> bin\knotx.bat run-knotx

Run docker

Build image from dockerfile being in the knotx-example-project folder

$> docker build -t acme/knotx-example .

Run Knot.x container in background

$> docker run -d -p8092:8092 acme/knotx-example knotx-example

Follow logs

$> docker logs -f knotx-example

Run Knot.x cluster

Clone this repository and go to acme-cluster folder and run the Knot.x cluster

$> docker-compose up

How to verify

Knot.x works in two modes: