From 1e6652d55e1237d97672544a2ebcb1532f5ef181 Mon Sep 17 00:00:00 2001 From: mrchainhead Date: Sat, 12 Aug 2023 21:12:33 +0530 Subject: [PATCH] Issue 18. --- README.md | 9 +++------ launch/conf/alarms.env | 9 --------- launch/conf/alerts.env | 6 ------ launch/conf/common.env | 14 ++++++++++++++ launch/conf/limits.env | 5 ++--- launch/conf/merger.env | 6 ------ launch/conf/payload.env | 3 +-- launch/conf/streamer.env | 3 +-- launch/docker-compose.yaml | 27 +++++++++------------------ launch/launch.env | 7 +++++-- 10 files changed, 35 insertions(+), 54 deletions(-) diff --git a/README.md b/README.md index 68c61d5..112bbaa 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,7 @@ This repository has instructions to launch the Maintenace Mitra application. - [Introduction](#introduction) - [Quick start](#quick-start) - - [Configuration](#configuration) - - [Limits](#limits) + - [Limits](#limits) ## Quick start @@ -28,8 +27,6 @@ docker compose --env-file launch.env up -d If the `/data` end-point is receiving data, then the dashboard will be live at [`http://localhost:1881/ui`](http://localhost:1881/ui). The `port` number is based on the configuration `UI_PORT` in `conf/dashboard.env`. -## Configuration +## Limits -The `limits` applications should be configured to generate alerts. While the configuration parameters exist for other applications - see [`conf`](./launch/conf/) - they should not be changed. Therefore, the documentation is purposely omitted. - -### Limits +The `limits` application should be configured to generate alerts. \ No newline at end of file diff --git a/launch/conf/alarms.env b/launch/conf/alarms.env index bdbe725..15e9edf 100644 --- a/launch/conf/alarms.env +++ b/launch/conf/alarms.env @@ -1,13 +1,4 @@ -# Must change - Application -MACHINE_ID=m001 -MACHINE_DATA_TOPIC=m001_data -MACHINE_ALARMS_TOPIC=m001_alarms # Must change - Quarkus QUARKUS_KAFKA_STREAMS_APPLICATION_ID=M001_ALARMS QUARKUS_KAFKA_STREAMS_CLIENT_ID=M001_ALARMS QUARKUS_KAFKA_STREAMS_TOPICS=m001_data,m001_alarms -# Do not change -QUARKUS_KAFKA_STREAMS_BOOTSTRAP_SERVERS=broker:29093 -QUARKUS_KAFKA_STREAMS_SECURITY_PROTOCOL=SASL_PLAINTEXT -QUARKUS_KAFKA_STREAMS_SASL_MECHANISM=PLAIN -QUARKUS_KAFKA_STREAMS_SASL_JAAS_CONFIG=org.apache.kafka.common.security.plain.PlainLoginModule required username="alice" password="alice-secret"; \ No newline at end of file diff --git a/launch/conf/alerts.env b/launch/conf/alerts.env index 0fc9d8f..a041444 100644 --- a/launch/conf/alerts.env +++ b/launch/conf/alerts.env @@ -2,13 +2,7 @@ MACHINE_ID=m001 MACHINE_DATA_TOPIC=m001_data MACHINE_LIMITS_TOPIC=m001_limits -MACHINE_ALERTS_TOPIC=m001_alerts # Must change - Quarkus QUARKUS_KAFKA_STREAMS_APPLICATION_ID=M001_ALERTS QUARKUS_KAFKA_STREAMS_CLIENT_ID=M001_ALERTS QUARKUS_KAFKA_STREAMS_TOPICS=m001_data,m001_alerts,m001_limits -# Do not change -QUARKUS_KAFKA_STREAMS_BOOTSTRAP_SERVERS=broker:29093 -QUARKUS_KAFKA_STREAMS_SECURITY_PROTOCOL=SASL_PLAINTEXT -QUARKUS_KAFKA_STREAMS_SASL_MECHANISM=PLAIN -QUARKUS_KAFKA_STREAMS_SASL_JAAS_CONFIG=org.apache.kafka.common.security.plain.PlainLoginModule required username="alice" password="alice-secret"; \ No newline at end of file diff --git a/launch/conf/common.env b/launch/conf/common.env index f3818ab..3b580e7 100644 --- a/launch/conf/common.env +++ b/launch/conf/common.env @@ -1 +1,15 @@ +# Application +MACHINE_ID=m001 +MACHINE_DATA_TOPIC=m001_data +MACHINE_ALARMS_TOPIC=m001_alarms +MACHINE_ALERTS_TOPIC=m001_alerts +MACHINE_EVENTS_TOPIC=m001_events +# Quarkus, Kafka +QUARKUS_KAFKA_STREAMS_BOOTSTRAP_SERVERS=broker:29093 +QUARKUS_KAFKA_STREAMS_SECURITY_PROTOCOL=SASL_PLAINTEXT +QUARKUS_KAFKA_STREAMS_SASL_MECHANISM=PLAIN +QUARKUS_KAFKA_STREAMS_SASL_JAAS_CONFIG=org.apache.kafka.common.security.plain.PlainLoginModule required username="alice" password="alice-secret"; +# NodeJs +KAFKA_BROKER=broker:29093 +# General TZ="Asia/Kolkata" \ No newline at end of file diff --git a/launch/conf/limits.env b/launch/conf/limits.env index 7e9da2a..cecb54c 100644 --- a/launch/conf/limits.env +++ b/launch/conf/limits.env @@ -3,9 +3,8 @@ MACHINE_LIMITS_TOPIC=m001_limits # May change GRACE_TIME=10000 # Do not change -KAFKA_BROKER=broker:29093 -APP_ID=LIMITS -GROUP_ID=LIMITS +APP_ID=M001_LIMITS +GROUP_ID=M001_LIMITS PORT=8080 FREQUENCY=5000 INITIAL_DELAY=10000 \ No newline at end of file diff --git a/launch/conf/merger.env b/launch/conf/merger.env index 0aa5958..9f455c5 100644 --- a/launch/conf/merger.env +++ b/launch/conf/merger.env @@ -1,12 +1,6 @@ # Must change - Application MACHINE_ALL_TOPICS=m001_alerts,m001_alarms -MACHINE_EVENTS_TOPIC=m001_events # Must change - Quarkus QUARKUS_KAFKA_STREAMS_APPLICATION_ID=M001_MERGER QUARKUS_KAFKA_STREAMS_CLIENT_ID=M001_MERGER QUARKUS_KAFKA_STREAMS_TOPICS=m001_alerts,m001_alarms,m001_events -# Do not change -QUARKUS_KAFKA_STREAMS_BOOTSTRAP_SERVERS=broker:29093 -QUARKUS_KAFKA_STREAMS_SECURITY_PROTOCOL=SASL_PLAINTEXT -QUARKUS_KAFKA_STREAMS_SASL_MECHANISM=PLAIN -QUARKUS_KAFKA_STREAMS_SASL_JAAS_CONFIG=org.apache.kafka.common.security.plain.PlainLoginModule required username="alice" password="alice-secret"; \ No newline at end of file diff --git a/launch/conf/payload.env b/launch/conf/payload.env index 9d48f65..4e14afe 100644 --- a/launch/conf/payload.env +++ b/launch/conf/payload.env @@ -3,8 +3,7 @@ MACHINE_DATA_TOPIC=m001_data # May change GRACE_TIME=10000 # Do not change -KAFKA_BROKER=broker:29093 -APP_ID=M001 +APP_ID=M001_PAYLOAD PORT=8080 FREQUENCY=5000 INITIAL_DELAY=10000 \ No newline at end of file diff --git a/launch/conf/streamer.env b/launch/conf/streamer.env index fe2ffd9..a381d0a 100644 --- a/launch/conf/streamer.env +++ b/launch/conf/streamer.env @@ -1,5 +1,4 @@ # Must change -MACHINE_EVENTS_TOPIC=m001_events CLIENT_ID=M001_STREAMER_ GROUP_ID=M001_STREAMER # Do not change @@ -7,7 +6,7 @@ QUARKUS_HTTP_HOST=localhost QUARKUS_HTTP_PORT=8080 QUARKUS_HTTP_CORS=true QUARKUS_HTTP_CORS_ORIGINS=localhost -# +# Do not change KAFKA_BOOTSTRAP_SERVERS=broker:29093 KAFKA_SECURITY_PROTOCOL=SASL_PLAINTEXT KAFKA_SASL_MECHANISM=PLAIN diff --git a/launch/docker-compose.yaml b/launch/docker-compose.yaml index 032d62e..68d0fc8 100644 --- a/launch/docker-compose.yaml +++ b/launch/docker-compose.yaml @@ -1,20 +1,9 @@ version: '3.5' services: - registry: - container_name: mitra-registry - image: ${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}/registry:${REGISTRY_TAG:-latest} - ports: - - 5000:5000 - networks: - - core - restart: always - zookeeper: container_name: mitra-zookeeper image: ${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}/zookeeper:${ZOOKEEPER_TAG:-latest} - depends_on: - - registry ports: - "2181:2181" env_file: @@ -27,7 +16,6 @@ services: container_name: mitra-broker image: ${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}/kafka:${KAFKA_TAG:-latest} depends_on: - - registry - zookeeper ports: - "29093:29093" @@ -38,8 +26,8 @@ services: restart: always init: - container_name: mitra-init - image: confluentinc/cp-kafka:7.2.2 + container_name: mitra-init-${MACHINE_ID:-M001} + image: ${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}/kafka:${KAFKA_TAG:-latest} depends_on: - broker entrypoint: [ '/bin/sh', '-c' ] @@ -94,7 +82,7 @@ services: container_name: mitra-alarms-${MACHINE_ID:-M001} image: ${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}/alarms:${ALARMS_TAG:-latest} depends_on: - - init + - payload env_file: - ./conf/common.env - ./conf/alarms.env @@ -111,7 +99,7 @@ services: container_name: mitra-alerts-${MACHINE_ID:-M001} image: ${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}/alerts:${ALERTS_TAG:-latest} depends_on: - - init + - payload env_file: - ./conf/common.env - ./conf/alerts.env @@ -128,7 +116,8 @@ services: container_name: mitra-merger-${MACHINE_ID:-M001} image: ${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}/merger:${MERGER_TAG:-latest} depends_on: - - init + - alarms + - alerts env_file: - ./conf/common.env - ./conf/merger.env @@ -145,7 +134,7 @@ services: container_name: mitra-streamer-${MACHINE_ID:-M001} image: ${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}/streamer:${STREAMER_TAG:-latest} depends_on: - - init + - merger env_file: - ./conf/common.env - ./conf/streamer.env @@ -163,6 +152,8 @@ services: dashboard: container_name: mitra-dashboard-${MACHINE_ID:-M001} image: ${CONTAINER_REGISTRY}/${CONTAINER_REPOSITORY}/dashboard:${DASHBOARD_TAG:-latest} + depends_on: + - streamer env_file: - ./conf/common.env - ./conf/dashboard.env diff --git a/launch/launch.env b/launch/launch.env index df958af..60ea35a 100644 --- a/launch/launch.env +++ b/launch/launch.env @@ -1,8 +1,11 @@ -# Do not change ! -COMPOSE_PROJECT_NAME=mitra +# May change ! MACHINE_ID=M001 EVENTS_PORT=8080 UI_PORT=1881 + +# Do not change ! +COMPOSE_PROJECT_NAME=mitra +PROXY_REGISTRY=registry CONTAINER_REGISTRY=ghcr.io CONTAINER_REPOSITORY=nsubrahm #PAYLOAD_TAG=