Skip to content

Commit 5957912

Browse files
committed
Introduced working cerebro
1 parent 750963a commit 5957912

11 files changed

Lines changed: 161 additions & 58 deletions

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,16 @@ The command below applies [`es-env.yaml`](es-env.yaml) config and [`es-data.yaml
179179

180180
# Monitoring the cluster state
181181

182-
We use `kopf` plugin for elasticsearch. You can view the cluster state using links below:
182+
The `kopf` plugin is used for Elasticsearch 2.4 monitoring. You can view the cluster state using links below:
183183

184184
* [https://elasticsearch.example.com/_plugin/kopf/](https://elasticsearch.example.com/_plugin/kopf/)
185185
* [https://kibana.example.com/status](https://kibana.example.com/status)
186186

187+
The `cerebro` is used for Elasticsearch 5.x monitoring. You can view the cluster state using links below:
188+
189+
* [https://elasticsearch.example.com/cerebro/](https://elasticsearch.example.com/cerebro/)
190+
* [https://kibana.example.com/status](https://kibana.example.com/status)
191+
187192
# Kibana and GEO data
188193

189194
Fluentd container is already configured to import indices templates. If templates were not improted, you can import them manually:

docker/cerebro/Dockerfile

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,20 @@
1-
FROM alpine:3.4
1+
FROM debian:jessie
22

33
ENV JAVA_HOME=/usr/lib/jvm/default-jvm/jre
44

5-
# install envsubst
6-
ENV \
7-
BUILD_DEPS="gettext" \
8-
RUNTIME_DEPS="libintl"
9-
RUN \
10-
apk add --update $RUNTIME_DEPS && \
11-
apk add --virtual build_deps $BUILD_DEPS && \
12-
cp /usr/bin/envsubst /usr/local/bin/envsubst && \
13-
apk del build_deps
5+
COPY jessie-backports.list /etc/apt/sources.list.d
146

15-
# install java and bash
16-
RUN apk upgrade --update-cache && \
17-
apk add openjdk8-jre bash && \
18-
rm -rf /tmp/* /var/cache/apk/*
19-
20-
############################################################# ELK Docker
7+
# install dependencies
8+
RUN apt-get update -qqq && apt-get dist-upgrade -yqqq && \
9+
apt-get install -t jessie-backports -yqqq openjdk-8-jre bash gettext-base curl ca-certificates sudo jq
2110

2211
EXPOSE 9000
2312

24-
ENV VERSION 0.4.1
13+
ENV VERSION 0.6.5
2514
ENV GOSU_VERSION 1.7
2615

27-
# Install Elasticsearch.
28-
RUN apk add --update curl ca-certificates sudo jq gnupg && \
29-
curl -Lso /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-amd64" && \
16+
# Install Cerebro
17+
RUN curl -Lso /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-amd64" && \
3018
curl -Lso /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-amd64.asc" && \
3119
export GNUPGHOME="$(mktemp -d)" && \
3220
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 && \
@@ -35,11 +23,12 @@ RUN apk add --update curl ca-certificates sudo jq gnupg && \
3523
chmod +x /usr/local/bin/gosu && \
3624
( curl -Lsj https://github.com/lmenezes/cerebro/releases/download/v${VERSION}/cerebro-${VERSION}.tgz | \
3725
gunzip -c - | tar xf - ) && \
38-
mv /cerebro-$VERSION /cerebro && \
39-
apk del gnupg
26+
mv /cerebro-$VERSION /cerebro
4027

4128
COPY conf /cerebro/conf
4229

4330
COPY run.sh /
4431

32+
VOLUME /cerebro/logs
33+
4534
CMD ["/run.sh"]
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
FROM alpine:3.5
2+
3+
ENV JAVA_HOME=/usr/lib/jvm/default-jvm/jre
4+
5+
# install envsubst
6+
ENV \
7+
BUILD_DEPS="gettext" \
8+
RUNTIME_DEPS="libintl"
9+
RUN \
10+
apk add --update $RUNTIME_DEPS && \
11+
apk add --virtual build_deps $BUILD_DEPS && \
12+
cp /usr/bin/envsubst /usr/local/bin/envsubst && \
13+
apk del build_deps
14+
15+
# install java and bash
16+
RUN apk upgrade --update-cache && \
17+
apk add openjdk8-jre bash && \
18+
rm -rf /tmp/* /var/cache/apk/*
19+
20+
# Install glibc to resolve sqlite's "__isnan: symbol not found"
21+
ADD https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.25-r0/glibc-2.25-r0.apk /tmp
22+
RUN apk add --allow-untrusted /tmp/glibc-2.25-r0.apk
23+
24+
############################################################# ELK Docker
25+
26+
EXPOSE 9000
27+
28+
ENV VERSION 0.6.5
29+
ENV GOSU_VERSION 1.7
30+
31+
# Install Cerebro
32+
RUN apk add --update curl ca-certificates sudo jq gnupg && \
33+
curl -Lso /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-amd64" && \
34+
curl -Lso /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-amd64.asc" && \
35+
export GNUPGHOME="$(mktemp -d)" && \
36+
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 && \
37+
gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu && \
38+
rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc && \
39+
chmod +x /usr/local/bin/gosu && \
40+
( curl -Lsj https://github.com/lmenezes/cerebro/releases/download/v${VERSION}/cerebro-${VERSION}.tgz | \
41+
gunzip -c - | tar xf - ) && \
42+
mv /cerebro-$VERSION /cerebro && \
43+
apk del gnupg
44+
45+
COPY conf /cerebro/conf
46+
47+
COPY run.sh /
48+
49+
VOLUME /cerebro/logs
50+
51+
CMD ["/run.sh"]

docker/cerebro/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
IMG=kayrus/docker-elasticsearch-cerebro:0.4.1
1+
IMG=kayrus/docker-elasticsearch-cerebro:0.6.5
22
docker build -t $IMG .
33
docker push $IMG

docker/cerebro/conf/application.conf.tmpl

Lines changed: 43 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,48 @@
1-
# This is the main configuration file for the application.
2-
# ~~~~~
3-
4-
# Secret key
5-
# ~~~~~
6-
# The secret key is used to secure cryptographics functions.
7-
# If you deploy your application to several instances be sure to use the same key!
8-
application.secret="${CEREBRO_SECRET}"
9-
10-
# The application languages
11-
# ~~~~~
12-
application.langs="en"
13-
1+
# Secret will be used to sign session cookies, CSRF tokens and for other encryption utilities.
2+
# It is highly recommended to change this value before running cerebro in production.
3+
secret = "${CEREBRO_SECRET}"
4+
5+
# Application base path
6+
basePath = "${SERVER_BASEPATH}"
7+
8+
# Defaults to RUNNING_PID at the root directory of the app.
9+
# To avoid creating a PID file set this value to /dev/null
10+
#pidfile.path = "/var/run/cerebro.pid"
11+
12+
# Rest request history max size per user
13+
rest.history.size = 50 // defaults to 50 if not specified
14+
15+
# Path of local database file
16+
data.path = "./cerebro.db"
17+
18+
# Authentication
19+
auth = {
20+
# Example of LDAP authentication
21+
#type: ldap
22+
#settings: {
23+
#url = "ldap://host:port"
24+
#base-dn = "ou=active,ou=Employee"
25+
#method = "simple"
26+
#user-domain = "domain.com"
27+
#}
28+
# Example of simple username/password authentication
29+
#type: basic
30+
#settings: {
31+
#username = "admin"
32+
#password = "1234"
33+
#}
34+
}
35+
36+
# A list of known hosts
1437
hosts = [
1538
#{
16-
# host = "http://some-authenticated-host:9200",
39+
# host = "http://localhost:9200"
40+
# name = "Some Cluster"
41+
#},
42+
# Example of host with authentication
43+
#{
44+
# host = "http://some-authenticated-host:9200"
45+
# name = "Secured Cluster"
1746
# auth = {
1847
# username = "username"
1948
# password = "secret-password"
@@ -23,17 +52,3 @@ hosts = [
2352
host = "${ELASTICSEARCH_URL}"
2453
}
2554
]
26-
27-
# Logger
28-
# ~~~~~
29-
# You can also configure logback (http://logback.qos.ch/), by providing a logger.xml file in the conf directory .
30-
31-
# Root logger:
32-
logger.root=ERROR
33-
34-
# Logger used by the framework:
35-
logger.play=INFO
36-
37-
# Logger provided to your application:
38-
logger.application=DEBUG
39-

docker/cerebro/conf/logback.xml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<configuration>
2+
3+
<conversionRule conversionWord="coloredLevel" converterClass="play.api.libs.logback.ColoredLevel"/>
4+
5+
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
6+
<file>${application.home:-.}/logs/application.log</file>
7+
<encoder>
8+
<pattern>%date - [%level] - from %logger in %thread %n%message%n%xException%n</pattern>
9+
</encoder>
10+
</appender>
11+
12+
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
13+
<encoder>
14+
<pattern>%coloredLevel %logger{15} - %message%n%xException{5}</pattern>
15+
</encoder>
16+
</appender>
17+
18+
<logger name="play" level="INFO"/>
19+
<logger name="application" level="INFO"/>
20+
21+
<!-- Off these ones as they are annoying, and anyway we manage configuration ourself -->
22+
<logger name="com.avaje.ebean.config.PropertyMapLoader" level="OFF"/>
23+
<logger name="com.avaje.ebeaninternal.server.core.XmlConfigLoader" level="OFF"/>
24+
<logger name="com.avaje.ebeaninternal.server.lib.BackgroundThread" level="OFF"/>
25+
<logger name="com.gargoylesoftware.htmlunit.javascript" level="OFF"/>
26+
27+
<root level="ERROR">
28+
<appender-ref ref="STDOUT"/>
29+
<appender-ref ref="FILE"/>
30+
</root>
31+
32+
</configuration>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
deb http://ftp.debian.org/debian jessie-backports main

docker/cerebro/run.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
#!/bin/sh
22

3-
addgroup sudo
4-
adduser -D -g '' cerebro
5-
adduser cerebro sudo
3+
adduser --home /cerebro --system --ingroup sudo cerebro
64
chown -R cerebro /cerebro
75
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
86

7+
export SERVER_BASEPATH=${SERVER_BASEPATH:-/}
98
export ELASTICSEARCH_URL=${ELASTICSEARCH_URL:-"http://localhost:9200"}
109
export CEREBRO_SECRET=${CEREBRO_SECRET:-'ki:s:[[@=Ag?QI`W2jMwkY:eqvrJ]JqoJyi2axj3ZvOv^/KavOT4ViJSv?6YY4[N'}
1110
echo ELASTICSEARCH_URL=${ELASTICSEARCH_URL}

es5/es-cerebro.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ spec:
3434
spec:
3535
containers:
3636
- name: cerebro
37-
image: kayrus/docker-elasticsearch-cerebro:0.4.1
37+
image: kayrus/docker-elasticsearch-cerebro:0.6.5
3838
imagePullPolicy: Always
3939
readinessProbe:
4040
httpGet:
@@ -48,8 +48,6 @@ spec:
4848
configMapKeyRef:
4949
name: es-env
5050
key: es-client-endpoint
51-
- name: SERVER_BASEPATH
52-
value: "/cerebro"
5351
ports:
5452
- containerPort: 9000
5553
name: ui

es5/images

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../images

0 commit comments

Comments
 (0)