VOL-452 Integration of logstash in a swarm cluster
- Startup elasticsearch and logstash separately
- Added new targets in Makefile to build opennms and logstash images
- Default to the swarm kafka domain name
Change-Id: I1f7af5669b6bc270f3ed5c172f42d7e86933ef55
diff --git a/Makefile b/Makefile
index f54865e..1104d42 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@
VENVDIR := venv-$(shell uname -s | tr '[:upper:]' '[:lower:]')
-.PHONY: $(DIRS) $(DIRS_CLEAN) $(DIRS_FLAKE8) flake8 docker-base voltha chameleon ofagent podder netconf shovel onos dashd vcli portainer grafana nginx consul registrator envoy golang envoyd tools
+.PHONY: $(DIRS) $(DIRS_CLEAN) $(DIRS_FLAKE8) flake8 docker-base voltha chameleon ofagent podder netconf shovel onos dashd vcli portainer grafana nginx consul registrator envoy golang envoyd tools opennms logstash
# This should to be the first and default target in this Makefile
help:
@@ -179,6 +179,11 @@
config-push:
docker build -t cord/config-push -f docker/Dockerfile.configpush docker
+opennms:
+ docker build -t cord/opennms -f docker/Dockerfile.opennms .
+
+logstash:
+ docker build -t cord/logstash -f docker/Dockerfile.logstash .
protos:
make -C voltha/protos
diff --git a/compose/docker-compose-elasticsearch.yml b/compose/docker-compose-elasticsearch.yml
index 3bc75fe..0b190b2 100644
--- a/compose/docker-compose-elasticsearch.yml
+++ b/compose/docker-compose-elasticsearch.yml
@@ -2,7 +2,7 @@
services:
elasticsearch:
- image: docker.elastic.co/elasticsearch/elasticsearch:5.2.2
+ image: docker.elastic.co/elasticsearch/elasticsearch:5.6.0
environment:
- transport.host=localhost
- transport.tcp.port=9300
@@ -10,23 +10,3 @@
ports:
- "9200:9200"
- "9300:9300"
- networks:
- - docker_elastic
-
- logstash:
- build: ./elasticsearch/logstash
- environment:
- - log.level=info
- command: logstash -f /etc/logstash/conf.d/
- volumes:
- - ./elasticsearch/logstash/config:/etc/logstash/conf.d
- ports:
- - "5000:5000"
- networks:
- - docker_elastic
- depends_on:
- - elasticsearch
-
-networks:
- docker_elastic:
- driver: bridge
diff --git a/compose/docker-compose-logstash-swarm.yml b/compose/docker-compose-logstash-swarm.yml
new file mode 100644
index 0000000..1f566ed
--- /dev/null
+++ b/compose/docker-compose-logstash-swarm.yml
@@ -0,0 +1,20 @@
+version: '3'
+
+services:
+ logstash:
+ image: cord/logstash
+ environment:
+ - log.level=info
+ - xpack.monitoring.enabled=false
+ command: logstash -f /etc/logstash/conf.d/
+ volumes:
+ - ./compose/elasticsearch/logstash/config:/etc/logstash/conf.d
+ ports:
+ - "5000:5000"
+ networks:
+ - kafka-net
+
+networks:
+ kafka-net:
+ external:
+ name: kafka_net
diff --git a/compose/docker-compose-logstash.yml b/compose/docker-compose-logstash.yml
new file mode 100644
index 0000000..38a5881
--- /dev/null
+++ b/compose/docker-compose-logstash.yml
@@ -0,0 +1,12 @@
+version: '2'
+
+services:
+ logstash:
+ image: cord/logstash
+ environment:
+ - log.level=info
+ command: logstash -f /etc/logstash/conf.d/
+ volumes:
+ - ./elasticsearch/logstash/config:/etc/logstash/conf.d
+ ports:
+ - "5000:5000"
diff --git a/compose/docker-compose-opennms.yml b/compose/docker-compose-opennms.yml
index a1d8968..d1dbcb6 100644
--- a/compose/docker-compose-opennms.yml
+++ b/compose/docker-compose-opennms.yml
@@ -24,7 +24,7 @@
- /var/opennms/reports
opennms:
- build: ./opennms
+ image: cord/opennms
env_file:
- ./opennms/env/opennms.env
- ./opennms/env/postgres.env
diff --git a/compose/elasticsearch/logstash/config/logstash.conf b/compose/elasticsearch/logstash/config/logstash.conf
index e822fe9..cc54163 100644
--- a/compose/elasticsearch/logstash/config/logstash.conf
+++ b/compose/elasticsearch/logstash/config/logstash.conf
@@ -4,7 +4,7 @@
input {
kafka {
- bootstrap_servers => "10.100.198.220:9092"
+ bootstrap_servers => "kafka:9092"
topics => ["voltha.alarms"]
tags => [ "alarm" ]
type => "voltha_alarms"
diff --git a/compose/elasticsearch/logstash/Dockerfile b/docker/Dockerfile.logstash
similarity index 69%
rename from compose/elasticsearch/logstash/Dockerfile
rename to docker/Dockerfile.logstash
index ad7cb1c..a90ecb0 100644
--- a/compose/elasticsearch/logstash/Dockerfile
+++ b/docker/Dockerfile.logstash
@@ -1,5 +1,5 @@
# Build from latest stable load
-FROM docker.elastic.co/logstash/logstash:5.2.2
+FROM docker.elastic.co/logstash/logstash:5.6.0
# Add logstash plugins
RUN logstash-plugin install logstash-output-opennms
diff --git a/compose/opennms/Dockerfile b/docker/Dockerfile.opennms
similarity index 60%
rename from compose/opennms/Dockerfile
rename to docker/Dockerfile.opennms
index 241d4e2..31233ef 100644
--- a/compose/opennms/Dockerfile
+++ b/docker/Dockerfile.opennms
@@ -5,10 +5,13 @@
RUN yum install -y python-setuptools
RUN easy_install supervisor
RUN mkdir -p /var/log/supervisor
-COPY env/supervisord.conf /etc/supervisor/supervisord.conf
+RUN mkdir -p /var/log/opennms
+RUN mkdir -p /var/opennms/rrd
+RUN mkdir -p /var/opennms/reports
+COPY compose/opennms/env/supervisord.conf /etc/supervisor/supervisord.conf
# Copy a new startup script to override the default entrypoint script
-COPY env/opennms_start.sh /
+COPY compose/opennms/env/opennms_start.sh /
RUN chmod 755 /opennms_start.sh
ENTRYPOINT ["/usr/bin/supervisord"]