Skip to content

Commit

Permalink
Merged with latest 19.0 snapshot changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ankit authored and Ankit committed Apr 24, 2020
2 parents d66ee7d + 66ad9f8 commit 4e8e026
Show file tree
Hide file tree
Showing 162 changed files with 508 additions and 988 deletions.
60 changes: 60 additions & 0 deletions .ci/podSpecs/distribution.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
metadata:
labels:
agent: zeebe-ci-build
spec:
nodeSelector:
cloud.google.com/gke-nodepool: agents-n1-standard-32-netssd-preempt
tolerations:
- key: "agents-n1-standard-32-netssd-preempt"
operator: "Exists"
effect: "NoSchedule"
volumes:
- name: shared-data
emptyDir: {}
containers:
- name: maven
image: maven:3.6.0-jdk-11
command: ["cat"]
tty: true
env:
- name: LIMITS_CPU
valueFrom:
resourceFieldRef:
resource: limits.cpu
- name: JAVA_TOOL_OPTIONS
value: |
-XX:+UseContainerSupport
- name: DOCKER_HOST
value: tcp://localhost:2375
- name: ZEEBE_CI_SHARED_DATA
value: /home/shared
resources:
limits:
cpu: 2
memory: 4Gi
requests:
cpu: 2
memory: 4Gi
securityContext:
privileged: true
volumeMounts:
- name: shared-data
mountPath: /home/shared
mountPropagation: Bidirectional
- name: docker
image: docker:18.09.4-dind
args: ["--storage-driver=overlay2"]
securityContext:
privileged: true
tty: true
resources:
limits:
cpu: 2
memory: 4Gi
requests:
cpu: 2
memory: 4Gi
volumeMounts:
- name: shared-data
mountPath: /home/shared
mountPropagation: Bidirectional
4 changes: 4 additions & 0 deletions .ci/scripts/distribution/prepare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh -eux

apt-get -qq update
apt-get install --no-install-recommends -qq -y jq libatomic1
19 changes: 0 additions & 19 deletions .ci/scripts/docker-release.sh

This file was deleted.

16 changes: 0 additions & 16 deletions .ci/scripts/docker-snapshot.sh

This file was deleted.

21 changes: 10 additions & 11 deletions .ci/scripts/github-release.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
#!/bin/bash -xeu

cd target

export PROJECT_NAME="Zeebe Simple Monitor"
export GITHUB_TOKEN=${GITHUB_TOKEN_PSW}
export GITHUB_ORG=zeebe-io
export GITHUB_REPO=zeebe-simple-monitor

# do github release
curl -sL https://github.com/aktau/github-release/releases/download/v0.7.2/linux-amd64-github-release.tar.bz2 | tar xjvf - --strip 3
./github-release release --user ${GITHUB_ORG} --repo ${GITHUB_REPO} --tag ${RELEASE_VERSION} --draft --name "Zeebe Simple Monitor ${RELEASE_VERSION}" --description ""

# upload app
cd app/target

export ARTIFACT=zeebe-simple-monitor-app-${RELEASE_VERSION}.jar
export ARTIFACT=zeebe-simple-monitor-${RELEASE_VERSION}.jar
export CHECKSUM=${ARTIFACT}.sha1sum

# create checksum files
sha1sum ${ARTIFACT} > ${CHECKSUM}

../../github-release upload --user ${GITHUB_ORG} --repo ${GITHUB_REPO} --tag ${RELEASE_VERSION} --name "${ARTIFACT}" --file "${ARTIFACT}"
../../github-release upload --user ${GITHUB_ORG} --repo ${GITHUB_REPO} --tag ${RELEASE_VERSION} --name "${CHECKSUM}" --file "${CHECKSUM}"
# do github release
curl -sL https://github.com/aktau/github-release/releases/download/v0.7.2/linux-amd64-github-release.tar.bz2 | tar xjvf - --strip 3

./github-release release --user ${GITHUB_ORG} --repo ${GITHUB_REPO} --tag ${RELEASE_VERSION} --draft --name "${PROJECT_NAME} ${RELEASE_VERSION}" --description ""
./github-release upload --user ${GITHUB_ORG} --repo ${GITHUB_REPO} --tag ${RELEASE_VERSION} --name "${ARTIFACT}" --file "${ARTIFACT}"
./github-release upload --user ${GITHUB_ORG} --repo ${GITHUB_REPO} --tag ${RELEASE_VERSION} --name "${CHECKSUM}" --file "${CHECKSUM}"
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.idea
target/*
!target/*.jar
.classpath
.checkstyle
.project
Expand Down
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM maven:3.6.3-jdk-11 AS BUILD_IMAGE
COPY src usr/local/src
COPY pom.xml usr/local
RUN mvn -f usr/local/pom.xml clean package

FROM openjdk:11-jre
EXPOSE 8082
ARG JAR=usr/local/target/zeebe-simple-monitor-*-SNAPSHOT.jar
COPY --from=BUILD_IMAGE ${JAR} /usr/local/zeebe-simple-monitor.jar
ENTRYPOINT ["java", "-jar", "/usr/local/zeebe-simple-monitor.jar"]
64 changes: 14 additions & 50 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,51 +7,12 @@ pipeline {
cloud 'zeebe-ci'
label "zeebe-ci-build_${buildName}"
defaultContainer 'jnlp'
yaml '''\
apiVersion: v1
kind: Pod
metadata:
labels:
agent: zeebe-ci-build
spec:
nodeSelector:
cloud.google.com/gke-nodepool: agents-n1-standard-32-netssd-preempt
tolerations:
- key: "agents-n1-standard-32-netssd-preempt"
operator: "Exists"
effect: "NoSchedule"
containers:
- name: maven
image: maven:3.6.0-jdk-11
command: ["cat"]
tty: true
resources:
limits:
cpu: 1
memory: 2Gi
requests:
cpu: 1
memory: 2Gi
- name: docker
image: docker:18.09.4-dind
args: ["--storage-driver=overlay2"]
securityContext:
privileged: true
tty: true
resources:
limits:
cpu: 1
memory: 1Gi
requests:
cpu: 500m
memory: 512Mi
'''
yamlFile '.ci/podSpecs/distribution.yml'
}
}

options {
buildDiscarder(logRotator(numToKeepStr: '10'))
skipDefaultCheckout()
timestamps()
timeout(time: 15, unit: 'MINUTES')
}
Expand All @@ -70,12 +31,15 @@ spec:
stages {
stage('Prepare') {
steps {
checkout scm
container('maven') {
configFileProvider([configFile(fileId: 'maven-nexus-settings-zeebe', variable: 'MAVEN_SETTINGS_XML')]) {
sh '.ci/scripts/distribution/prepare.sh'
sh 'mvn clean install -B -s $MAVEN_SETTINGS_XML -DskipTests'
}
}
container('docker') {
sh 'docker login --username ${DOCKER_HUB_USR} --password ${DOCKER_HUB_PSW}'
}
}
}

Expand Down Expand Up @@ -104,10 +68,6 @@ spec:
sh 'mvn -B -s $MAVEN_SETTINGS_XML generate-sources source:jar javadoc:jar deploy -DskipTests'
}
}

container('docker') {
sh '.ci/scripts/docker-snapshot.sh'
}
}
}

Expand All @@ -122,25 +82,29 @@ spec:
GITHUB_TOKEN = credentials('camunda-jenkins-github')
RELEASE_VERSION = "${params.RELEASE_VERSION}"
DEVELOPMENT_VERSION = "${params.DEVELOPMENT_VERSION}"
DOCKER_HUB = credentials("camunda-dockerhub")
}

steps {
container('maven') {
configFileProvider([configFile(fileId: 'maven-nexus-settings-zeebe', variable: 'MAVEN_SETTINGS_XML')]) {
sshagent(['camunda-jenkins-github-ssh']) {
sshagent(['camunda-jenkins-github-ssh']) {
sh 'gpg -q --import ${GPG_PUB_KEY} '
sh 'gpg -q --allow-secret-key-import --import --no-tty --batch --yes ${GPG_SEC_KEY}'
sh 'git config --global user.email "ci@camunda.com"'
sh 'git config --global user.name "camunda-jenkins"'
sh 'mkdir ~/.ssh/ && ssh-keyscan github.com >> ~/.ssh/known_hosts'
sh 'mvn -B -s $MAVEN_SETTINGS_XML -DskipTests source:jar javadoc:jar release:prepare release:perform -Prelease'
sh '.ci/scripts/github-release.sh'
}
}
}
}

container('docker') {
sh '.ci/scripts/docker-release.sh'
container('maven') {
configFileProvider([configFile(fileId: 'maven-nexus-settings-zeebe', variable: 'MAVEN_SETTINGS_XML')]) {
sshagent(['camunda-jenkins-github-ssh']) {
sh 'mvn jib:build -Djib.to.tags=latest,${RELEASE_VERSION} -Djib.to.auth.username=${DOCKER_HUB_USR} -Djib.to.auth.password=${DOCKER_HUB_PSW}'
}
}
}
}
}
Expand Down
96 changes: 49 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,75 +9,77 @@ A monitoring application for [Zeebe](https://zeebe.io). It is designed for devel

The application imports the data from Zeebe using the [Hazelcast exporter](https://github.com/zeebe-io/zeebe-hazelcast-exporter). It aggregates the data and store it into a (in-memory) database. The data is display on server-side rendered HTML pages.

![how-it-works](app/docs/how-it-works.png)
![how-it-works](docs/how-it-works.png)

## Install

### Docker

The following command will build the project, pull images and start containers with default settings.
The docker image for the worker is published to [DockerHub](https://hub.docker.com/r/camunda/zeebe-simple-monitor).

1. Run the following command in your terminal (in the root project folder):

```bash
docker/run
```

If you don't have the right to launch `docker/run` try:
```
docker pull camunda/zeebe-simple-monitor:latest
```

```bash
chmod +x docker/run
```
2. Go to http://localhost:8080
* ensure that a Zeebe broker is running with a Hazelcast exporter (>= 0.8.0-alpha1)
* forward the Hazelcast port to the docker container (default: `5701`)
* configure the connection to the Zeebe broker by setting `zeebe.client.broker.contactPoint` (default: `localhost:26500`)
* configure the connection to Hazelcast by setting `zeebe.worker.hazelcast.connection` (default: `localhost:5701`)

### Manually
For a local setup, the repository contains a [docker-compose file](docker/docker-compose.yml). It starts a Zeebe broker with the Hazelcast exporter and the application.

1. Download the latest [Hazelcast exporter JAR](https://github.com/zeebe-io/zeebe-hazelcast-exporter/releases) _(zeebe-hazelcast-exporter-%{VERSION}-jar-with-dependencies.jar)_
```
mvn clean install -DskipTests
cd docker
docker-compose up
```

2. Copy the JAR into the broker folder `~/zeebe-broker-%{VERSION}/lib`
Go to http://localhost:8082

3. Add the exporter to the broker configuration `~/zeebe-broker-%{VERSION}/conf/zeebe.cfg.toml`.
```
[[exporters]]
id = "hazelcast"
className = "io.zeebe.hazelcast.exporter.HazelcastExporter"
[exporters.args]
# comma separated list of io.zeebe.protocol.record.ValueType
enabledValueTypes = "JOB,WORKFLOW_INSTANCE,DEPLOYMENT,INCIDENT,TIMER,VARIABLE,MESSAGE,MESSAGE_SUBSCRIPTION,MESSAGE_START_EVENT_SUBSCRIPTION"
```
### Manual

4. Start the broker
5. Download the latest [application JAR](https://github.com/zeebe-io/zeebe-simple-monitor/releases)
1. Download the latest [application JAR](https://github.com/zeebe-io/zeebe-simple-monitor/releases) _(zeebe-simple-monitor-%{VERSION}.jar
)_

6. Start the application
`java -jar zeebe-simple-monitor-app-{VERSION}.jar`
1. Start the application
`java -jar zeebe-simple-monitor-{VERSION}.jar`

7. Go to http://localhost:8080
1. Go to http://localhost:8082

### Configuration

The configuration of the application can be changed via `application.properties`, `application.yaml` or command line arguments.
The worker is a Spring Boot application that uses the [Spring Zeebe Starter](https://github.com/zeebe-io/spring-zeebe). The configuration can be changed via environment variables or an `application.yaml` file. See also the following resources:
* [Spring Zeebe Configuration](https://github.com/zeebe-io/spring-zeebe#configuring-zeebe-connection)
* [Spring Boot Configuration](https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-external-config)

By default, the port is set to `8082` and the database is only in-memory (i.e. not persistent).

```
# application database
spring.datasource.url=jdbc:h2:mem:zeebe-monitor;DB_CLOSE_DELAY=-1
spring.datasource.user=sa
spring.datasource.password=
spring.jpa.hibernate.ddl-auto=create
zeebe:
worker:
hazelcast:
connection: localhost:5701
client:
broker.contactPoint: 127.0.0.1:26500
security.plaintext: true
# connection to Zeebe broker
io.zeebe.monitor.connectionString=localhost:26500
spring:
# connection to Hazelcast
io.zeebe.monitor.hazelcast.connection=localhost:5701
datasource:
url: jdbc:h2:mem:zeebe-monitor;DB_CLOSE_DELAY=-1
user: sa
password:
driverClassName: org.h2.Driver
# logging
logging.level.io.zeebe.zeebemonitor=DEBUG
logging.level.com.hazelcast=WARN
jpa:
database-platform: org.hibernate.dialect.H2Dialect
hibernate:
ddl-auto: update
server:
port: 8082
```

## Build from Source
Expand All @@ -98,4 +100,4 @@ this code. Please report unacceptable behavior to code-of-conduct@zeebe.io.

## About

![screencast](app/docs/zeebe-simple-monitor.gif)
![screencast](docs/zeebe-simple-monitor.gif)
Loading

0 comments on commit 4e8e026

Please sign in to comment.