Tuesday, 10 October 2017

Tinkering with Elasticsearch and Kibana - on Docker, of course

In order to get to grips with the new world of event emission from IBM BPM, I needed to have a combined Elasticsearch / Kibana runtime to which to … emit events.

Using this as source: -

Elasticsearch and Kibana in one container

Simple and lightweight docker image for previewing Elasticsearch and Kibana.

I downloaded the repository file from here, expanded the resulting ZIP file: -

unzip ~/Downloads/nshou-elasticsearch-kibana-e07aa6ed04af.zip 

switched to the appropriate directory: -

cd ~/nshou-elasticsearch-kibana-e07aa6ed04af

took a quick look at the Dockerfile: -

cat Dockerfile

FROM openjdk:jre-alpine

LABEL maintainer "nshou <nshou@coronocoya.net>"

ENV ES_VERSION=5.6.2 \
    KIBANA_VERSION=5.6.2

RUN apk add --quiet --no-progress --no-cache nodejs wget \
 && adduser -D elasticsearch

USER elasticsearch

WORKDIR /home/elasticsearch

RUN wget -q -O - https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ES_VERSION}.tar.gz \
 |  tar -zx \
 && mv elasticsearch-${ES_VERSION} elasticsearch \
 && wget -q -O - https://artifacts.elastic.co/downloads/kibana/kibana-${KIBANA_VERSION}-linux-x86_64.tar.gz \
 |  tar -zx \
 && mv kibana-${KIBANA_VERSION}-linux-x86_64 kibana \
 && rm -f kibana/node/bin/node kibana/node/bin/npm \
 && ln -s $(which node) kibana/node/bin/node \
 && ln -s $(which npm) kibana/node/bin/npm

CMD sh elasticsearch/bin/elasticsearch -E http.host=0.0.0.0 --quiet & kibana/bin/kibana --host 0.0.0.0 -Q

EXPOSE 9200 5601


and then created the image: -

docker build -t elastic-search-kibana:elastickib .

Sending build context to Docker daemon   7.68kB
Step 1/9 : FROM openjdk:jre-alpine
jre-alpine: Pulling from library/openjdk
88286f41530e: Pull complete 
720349d0916a: Pull complete 
9431a0557160: Pull complete 
Digest: sha256:6bb5c6b7b685b63cb2d937bded1afbcc5738a5ea4b7c4e219199e55e7dda70f8
Status: Downloaded newer image for openjdk:jre-alpine
 ---> e2f6fe2dacef
Step 2/9 : LABEL maintainer "nshou <nshou@coronocoya.net>"
 ---> Running in 1e003af9f082
 ---> df191a529d94
Removing intermediate container 1e003af9f082
Step 3/9 : ENV ES_VERSION 5.6.2 KIBANA_VERSION 5.6.2
 ---> Running in c8664902a7f7
 ---> 90c47efaf56a
Removing intermediate container c8664902a7f7
Step 4/9 : RUN apk add --quiet --no-progress --no-cache nodejs wget  && adduser -D elasticsearch
 ---> Running in 9fa9ade91bc4
 ---> 5445495027dc
Removing intermediate container 9fa9ade91bc4
Step 5/9 : USER elasticsearch
 ---> Running in f15c2522650a
 ---> fd83a9e51b4b
Removing intermediate container f15c2522650a
Step 6/9 : WORKDIR /home/elasticsearch
 ---> c4b5b83af736
Removing intermediate container c834e8cbb240
Step 7/9 : RUN wget -q -O - https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ES_VERSION}.tar.gz  |  tar -zx  && mv elasticsearch-${ES_VERSION} elasticsearch  && wget -q -O - https://artifacts.elastic.co/downloads/kibana/kibana-${KIBANA_VERSION}-linux-x86_64.tar.gz  |  tar -zx  && mv kibana-${KIBANA_VERSION}-linux-x86_64 kibana  && rm -f kibana/node/bin/node kibana/node/bin/npm  && ln -s $(which node) kibana/node/bin/node  && ln -s $(which npm) kibana/node/bin/npm
 ---> Running in fdc3ce9e0fc3
 ---> 772dbe7ad146
Removing intermediate container fdc3ce9e0fc3
Step 8/9 : CMD sh elasticsearch/bin/elasticsearch -E http.host=0.0.0.0 --quiet & kibana/bin/kibana --host 0.0.0.0 -Q
 ---> Running in 19b3ae4f083c
 ---> 077e18084009
Removing intermediate container 19b3ae4f083c
Step 9/9 : EXPOSE 9200 5601
 ---> Running in 160b93b21db3
 ---> 9a2583574e8a
Removing intermediate container 160b93b21db3
Successfully built 9a2583574e8a
Successfully tagged elastic-search-kibana:elastickib

checked my Docker image repository: -

docker images

REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
elastic-search-kibana   elastickib          9a2583574e8a        2 hours ago         310MB
websphere-liberty       webProfile7         905fc63e8e9b        3 weeks ago         411MB
openjdk                 jre-alpine          e2f6fe2dacef        3 weeks ago         81.4MB
ibmcom/datapower        latest              5d04824ab687        2 months ago        758MB

started a container: -

docker run -d -p 9200:9200 -p 5601:5601 elastic-search-kibana:elastickib

checked the running container: -

docker ps -a

CONTAINER ID        IMAGE                              COMMAND                  CREATED             STATUS              PORTS                                            NAMES
82a69369a551        elastic-search-kibana:elastickib   "/bin/sh -c 'sh el..."   7 seconds ago       Up 2 seconds        0.0.0.0:5601->5601/tcp, 0.0.0.0:9200->9200/tcp   cranky_visvesvaraya

and then connected to Kibana: -



and to Elasticsearch: -


which is nice

I'm now following this: -


and will go ahead and setup my BPM 8.6 VM … 

Let's see how I get on …

No comments:

Note to self - use kubectl to query images in a pod or deployment

In both cases, we use JSON ... For a deployment, we can do this: - kubectl get deployment foobar --namespace snafu --output jsonpath="{...