camunda-community-hub / zeebe-simple-monitor

A monitoring application to show insides of Zeebe for developers
Apache License 2.0
169 stars 105 forks source link

Zeebe simple monitor connected to PostgreSQL #67

Closed kadirbekov closed 5 years ago

kadirbekov commented 5 years ago

As developer, I want to use Zeebe simple monitor, connected to PostgreSQL(or any DB).

Acceptance criteria:

1.In docker-compose.yml in camunda/zeebe-simple-monitor image I can add environment variables:

    environment:
      - spring.datasource.url=jdbc:postgresql://pgdb-zeebe:5432/zeebe
      - spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
      - spring.datasource.username=zeebe
      - spring.datasource.password=zeebe

and volumes:

    volumes:
      - ./lib/postgresql-42.2.5.jar:/usr/local/zeebe/lib/postgresql-42.2.5.jar

and application will start and will connect to postgres zeebe DB

saig0 commented 5 years ago

Hi @kadirbekov,

it should be possible to connect to PostgreSQL. You need to set the connection for the exporter (https://github.com/zeebe-io/zeebe-simple-monitor/tree/master/exporter#configure-the-exporter) and the web-app (https://github.com/zeebe-io/zeebe-simple-monitor/tree/master/app#configuration).

Did you try it out?

kadirbekov commented 5 years ago

@saig0 , I've tried, but there is dependency in pom.xml to h2 driver. When I changed driver class name to postgres, application crashes with no class found error. It will be excellent, If there will be possibility to add library as volume, in docker-compose.

saig0 commented 5 years ago

@kadirbekov , is it not possible to add the driver JAR file as volume? For example:

zeebe:
    container_name: zeebe_broker
    image: camunda/zeebe:0.17.0
    volumes:
      - ./zeebe-simple-monitor-exporter-0.13.0.jar:/usr/local/zeebe/lib/zeebe-simple-monitor-exporter.jar
      - ./postgresql-9.1-901.jdbc4.jar:/usr/local/zeebe/lib/postgresql-9.1-901.jdbc4.jar
kadirbekov commented 5 years ago

@saig0, for broker I did it already, and it works. But for simple monitor I didn't found way to do the same.

Zelldon commented 5 years ago

You need to add the postgres driver to the simple monitor app class path, for example if you run it with jar -jar just add -cp $PATH_TO_JAR.

jelleklaver commented 5 years ago

I don't really know Java, but I've got it working by adding the JAR driver and changing the monitor entrypoint to execute the following command:

java -cp /usr/local/zeebe-simple-monitor.jar:/usr/local/zeebe/lib/postgresql.jar org.springframework.boot.loader.JarLauncher

I believe using -jar and -cp toghether is not possible from what I found on StackOverflow. Hope this helps.

bekbergenb commented 4 years ago

Are there any solutions with zeebe simple monitor project which work with Postgres database ? If I want to connect postgres I have to change only docker-compose to store my bpmn's in DB or I have to change monitor app also?

bekbergenb commented 4 years ago

Hi @kadirbekov,

it should be possible to connect to PostgreSQL. You need to set the connection for the exporter (https://github.com/zeebe-io/zeebe-simple-monitor/tree/master/exporter#configure-the-exporter) and the web-app (https://github.com/zeebe-io/zeebe-simple-monitor/tree/master/app#configuration).

Did you try it out?

@saig0 could you put updated links please?

saig0 commented 4 years ago

The configuration is described here: https://github.com/zeebe-io/zeebe-simple-monitor#configuration

In order to change the database, you would need to change the following properties.

spring:

  datasource:
    url: jdbc:h2:mem:zeebe-monitor;DB_CLOSE_DELAY=-1
    user: sa
    password:
    driverClassName: org.h2.Driver

  jpa:
    database-platform: org.hibernate.dialect.H2Dialect
    hibernate:
      ddl-auto: update