diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e7685b5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM camunda/zeebe:latest + +ARG EXPORTERJAR + +COPY ${EXPORTERJAR} /usr/local/zeebe/lib/zeebe-hazelcast-exporter-jar-with-dependencies.jar +COPY zeebe.cfg.toml /usr/local/zeebe/conf/zeebe.cfg.toml diff --git a/README.md b/README.md index 06d4e4b..428f6de 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,20 @@ Example usage: ## Install +### Docker + +A bundled docker image is available under https://hub.docker.com/repository/docker/zelldon/zeebe-hazelcast. + +It is based on the Zeebe image and adds the Hazelcast exporter to it. + +Run the Docker command: + +``` +docker run zelldon/zeebe-hazelcast:TAG +``` + +### Manually + Before you start the broker, copy the exporter JAR into the lib folder of the broker. ``` @@ -127,6 +141,22 @@ The exporter and the Java connector can be built with Maven `mvn clean install` +## Build Docker image + +The docker image can build like this: + +``` +docker build --build-arg EXPORTERJAR=exporter/target/zeebe-hazelcast-exporter-0.8.0-alpha1-jar-with-dependencies.jar . +``` + +To publish the latest version: + +``` +docker build --build-arg EXPORTERJAR=exporter/target/zeebe-hazelcast-exporter-0.8.0-alpha1-jar-with-dependencies.jar -t /repo:TAG . +docker publish /repo:TAG +``` + + ## Code of Conduct This project adheres to the Contributor Covenant [Code of diff --git a/zeebe.cfg.toml b/zeebe.cfg.toml new file mode 100644 index 0000000..6dbeb45 --- /dev/null +++ b/zeebe.cfg.toml @@ -0,0 +1,323 @@ +# Zeebe broker configuration file + +# Overview ------------------------------------------- + +# This file contains a complete list of available configuration options. + +# Default values: +# +# When the default value is used for a configuration option, the option is +# commented out. You can learn the default value from this file + +# Conventions: +# +# Byte sizes +# For buffers and others must be specified as strings and follow the following +# format: "10U" where U (unit) must be replaced with K = Kilobytes, M = Megabytes or G = Gigabytes. +# If unit is omitted then the default unit is simply bytes. +# Example: +# sendBufferSize = "16M" (creates a buffer of 16 Megabytes) +# +# Time units +# Timeouts, intervals, and the likes, must be specified as strings and follow the following +# format: "VU", where: +# - V is a numerical value (e.g. 1, 1.2, 3.56, etc.) +# - U is the unit, one of: ms = Millis, s = Seconds, m = Minutes, or h = Hours +# +# Paths: +# Relative paths are resolved relative to the installation directory of the +# broker. + +# ---------------------------------------------------- + +[network] + +# This section contains the network configuration. Particularly, it allows to +# configure the hosts and ports the broker should bind to. the broker exposes 3 +# ports: 1. client: the port on which client (Java, CLI, Go, ...) connections +# are handled 2. management: used internally by the cluster for the gossip +# membership protocol and other management interactions 3. replication: used +# internally by the cluster for replicating data across nodes using the raft +# protocol + +# Controls the default host the broker should bind to. Can be overwritten on a +# per binding basis for client, management and replication +# +# This setting can also be overridden using the environment variable ZEEBE_HOST. +# host = "0.0.0.0" + +# If a port offset is set it will be added to all ports specified in the config +# or the default values. This is a shortcut to not always specifying every port. +# +# The offset will be added to the second last position of the port, as Zeebe +# requires multiple ports. As example a portOffset of 5 will increment all ports +# by 50, i.e. 26500 will become 26550 and so on. +# +# This setting can also be overridden using the environment variable ZEEBE_PORT_OFFSET. +# portOffset = 0 + +# Controls the default size of the buffers that are used for buffering outgoing +# messages. Can be overwritten on a per binding basis for client, management and +# replication +# defaultSendBufferSize = "16M" + +[network.gateway] + +# Enables embedded gateway to start +# enabled = true +# +# Overrides the host the gateway binds to +# host = "localhost" +# +# Sets the port the gateway binds to +# port = 26500 + +[network.client] + +# Allows to override the host the client api binds to +# host = "localhost" +# +# The port the client api binds to +# port = 26501 +# +# Overrides the size of the buffer used for buffering outgoing messages to +# clients +# sendBufferSize = "16M" +# +# Sets the size of the buffer used for receiving control messages from clients +# (such as management of subscriptions) +# controlMessageBufferSize = "8M" + +[network.management] + +# Overrides the host the management api binds to +# host = "localhost" +# +# Sets the port the management api binds to +# port = 26502 +# +# Overrides the size of the buffer to be used for buffering outgoing messages to +# other brokers through the management protocols +# sendBufferSize = "16M" +# +# Sets the buffer size used for receiving gossip messages and others +# receiveBufferSize = "8M" + +[network.replication] + +# Overrides the host the replication api binds to +# host = "localhost" +# +# Sets the port the replication api binds to +# port = 26503 +# +# Sets the buffer size used for buffering outgoing raft (replication) messages +# sendBufferSize = "16M" + +[network.subscription] + +# Overrides the host the subscription api binds to +# host = "localhost" +# +# Sets the port the subscription api binds to +# port = 26504 +# +# Overrides the size of the buffer to be used for buffering outgoing messages to +# other brokers through the subscription protocols +# sendBufferSize = "16M" +# +# Sets the buffer size used for receiving subscription messages and others +# receiveBufferSize = "8M" + + +[data] + +# This section allows to configure Zeebe's data storage. Data is stored in +# "partition folders". A partition folder has the following structure: +# +# internal-system-0 (root partition folder) +# ├── partition.json (metadata about the partition) +# ├── segments (the actual data as segment files) +# │ ├── 00.data +# │ └── 01.data +# └── snapshots (snapshot data) +# + +# Specify a list of directories in which data is stored. Using multiple +# directories makes sense in case the machine which is running Zeebe has +# multiple disks which are used in a JBOD (just a bunch of disks) manner. This +# allows to get greater throughput in combination with a higher io thread count +# since writes to different disks can potentially be done in parallel. +# +# This setting can also be overridden using the environment variable ZEEBE_DIRECTORIES. +# directories = [ "data" ] + +# The default size of data segments. +# defaultSegmentSize = "512M" + +# How often we take snapshots of streams (time unit) +# snapshotPeriod = "15m" + +# How often follower partitions will check for new snapshots to replicate from +# the leader partitions. Snapshot replication enables faster failover by +# reducing how many log entries must be reprocessed in case of leader change. +# snapshotReplicationPeriod = "5m" + + +[cluster] + +# This section contains all cluster related configurations, to setup an zeebe cluster + +# Specifies the unique id of this broker node in a cluster. +# The id should be between 0 and number of nodes in the cluster (exclusive). +# +# This setting can also be overridden using the environment variable ZEEBE_NODE_ID. +# nodeId = 0 + +# Controls the number of partitions, which should exist in the cluster. +# +# This can also be overridden using the environment variable ZEEBE_PARTITIONS_COUNT. +# partitionsCount = 1 + +# Controls the replication factor, which defines the count of replicas per partition. +# The replication factor cannot be greater than the number of nodes in the cluster. +# +# This can also be overridden using the environment variable ZEEBE_REPLICATION_FACTOR. +# replicationFactor = 1 + +# Specifies the zeebe cluster size. This value is used to determine which broker +# is responsible for which partition. +# +# This can also be overridden using the environment variable ZEEBE_CLUSTER_SIZE. +# clusterSize = 1 + +# Allows to specify a list of known other nodes to connect to on startup +# The contact points of the management api must be specified. +# The format is [HOST:PORT] +# Example: +# initialContactPoints = [ "192.168.1.22:26502", "192.168.1.32:26502" ] +# +# This setting can also be overridden using the environment variable ZEEBE_CONTACT_POINTS +# specifying a comma-separated list of contact points. +# +# Default is empty list: +# initialContactPoints = [] + +[threads] + +# Controls the number of non-blocking CPU threads to be used. WARNING: You +# should never specify a value that is larger than the number of physical cores +# available. Good practice is to leave 1-2 cores for ioThreads and the operating +# system (it has to run somewhere). For example, when running Zeebe on a machine +# which has 4 cores, a good value would be 2. +# +# The default value is 2. +#cpuThreadCount = 2 + +# Controls the number of io threads to be used. These threads are used for +# workloads that write data to disk. While writing, these threads are blocked +# which means that they yield the CPU. +# +# The default value is 2. +#ioThreadCount = 2 + +[metrics] + +# Path to the file to which metrics are written. Metrics are written in a +# text-based format understood by prometheus.io +# metricsFile = "metrics/zeebe.prom" + +# Controls the interval at which the metrics are written to the metrics file +# reportingInterval = "5s" + +[gossip] + +# retransmissionMultiplier = 3 +# probeInterval = "1s" +# probeTimeout = "500ms" +# probeIndirectNodes = 3 +# probeIndirectTimeout = "1s" +# suspicionMultiplier = 5 +# syncTimeout = "3s" +# syncInterval = "15s" +# joinTimeout = "1s" +# joinInterval = "5s" +# leaveTimeout = "1s" +# maxMembershipEventsPerMessage = 32 +# maxCustomEventsPerMessage = 8 + +[raft] + +# heartbeatInterval = "250ms" +# electionInterval = "1s" +# leaveTimeout = "1s" + +# Configure exporters below; note that configuration parsing conventions do not apply to exporter +# arguments, which will be parsed as normal TOML. +# +# Each exporter should be configured following this template: +# +# id: +# property should be unique in this configuration file, as it will server as the exporter +# ID for loading/unloading. +# jarPath: +# path to the JAR file containing the exporter class. JARs are only loaded once, so you can define +# two exporters that point to the same JAR, with the same class or a different one, and use args +# to parametrize its instantiation. +# className: +# entry point of the exporter, a class which *must* extend the io.zeebe.exporter.Exporter +# interface. +# +# A nested table as [exporters.args] will allow you to inject arbitrary arguments into your +# class through the use of annotations. +# +# Enable the following exporter to get debug output of the exporter records +# +# [[exporters]] +# id = "debug" +# className = "io.zeebe.broker.exporter.DebugExporter" +# [exporters.args] +# logLevel = "debug" +# prettyPrint = false +# +# An example configuration for the elasticsearch exporter: +# +#id = "elasticsearch" +#className = "io.zeebe.exporter.ElasticsearchExporter" +# +# [exporters.args] +# url = "http://localhost:9200" +# +# [exporters.args.bulk] +# delay = 5 +# size = 1_000 +# +# [exporters.args.index] +# prefix = "zeebe-record" +# createTemplate = true +# +# command = false +# event = true +# rejection = false +# +# deployment = true +# incident = true +# job = true +# message = false +# messageSubscription = false +# raft = false +# workflowInstance = true +# workflowInstanceSubscription = false + +[[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" + + # If true, the exporter update its position after publish the record to Hazelcast. + # Otherwise, it never update its position. On broker start, it will always start from the begin of the log. + # CAUTION! The broker can't delete data and may run out of disk space if set to false. + updatePosition = false