Unverified Commit ddf99d33 authored by gotjoshua's avatar gotjoshua Committed by Antoine Cotten

Set ELK components version from .env file

Closes #189
parent cbc8833a
ELK_VERSION=5.6.3
...@@ -52,6 +52,8 @@ Existing users: ...@@ -52,6 +52,8 @@ Existing users:
6. [JVM tuning](#jvm-tuning) 6. [JVM tuning](#jvm-tuning)
* [How can I specify the amount of memory used by a service?](#how-can-i-specify-the-amount-of-memory-used-by-a-service) * [How can I specify the amount of memory used by a service?](#how-can-i-specify-the-amount-of-memory-used-by-a-service)
* [How can I enable a remote JMX connection to a service?](#how-can-i-enable-a-remote-jmx-connection-to-a-service) * [How can I enable a remote JMX connection to a service?](#how-can-i-enable-a-remote-jmx-connection-to-a-service)
7. [Updates](#updates)
* [Using a newer stack version](#using-a-newer-stack-version)
## Requirements ## Requirements
...@@ -67,7 +69,7 @@ On distributions which have SELinux enabled out-of-the-box you will need to eith ...@@ -67,7 +69,7 @@ On distributions which have SELinux enabled out-of-the-box you will need to eith
into Permissive mode in order for docker-elk to start properly. For example on Redhat and CentOS, the following will into Permissive mode in order for docker-elk to start properly. For example on Redhat and CentOS, the following will
apply the proper context: apply the proper context:
```bash ```console
$ chcon -R system_u:object_r:admin_home_t:s0 docker-elk/ $ chcon -R system_u:object_r:admin_home_t:s0 docker-elk/
``` ```
...@@ -77,13 +79,13 @@ $ chcon -R system_u:object_r:admin_home_t:s0 docker-elk/ ...@@ -77,13 +79,13 @@ $ chcon -R system_u:object_r:admin_home_t:s0 docker-elk/
Start the ELK stack using `docker-compose`: Start the ELK stack using `docker-compose`:
```bash ```console
$ docker-compose up $ docker-compose up
``` ```
You can also choose to run it in background (detached mode): You can also choose to run it in background (detached mode):
```bash ```console
$ docker-compose up -d $ docker-compose up -d
``` ```
...@@ -112,7 +114,7 @@ By default, the stack exposes the following ports: ...@@ -112,7 +114,7 @@ By default, the stack exposes the following ports:
Now that the stack is running, you will want to inject some log entries. The shipped Logstash configuration allows you Now that the stack is running, you will want to inject some log entries. The shipped Logstash configuration allows you
to send content via TCP: to send content via TCP:
```bash ```console
$ nc localhost 5000 < /path/to/logfile.log $ nc localhost 5000 < /path/to/logfile.log
``` ```
...@@ -135,7 +137,7 @@ about the index pattern configuration. ...@@ -135,7 +137,7 @@ about the index pattern configuration.
Run this command to create a Logstash index pattern: Run this command to create a Logstash index pattern:
```bash ```console
$ curl -XPUT -D- 'http://localhost:9200/.kibana/index-pattern/logstash-*' \ $ curl -XPUT -D- 'http://localhost:9200/.kibana/index-pattern/logstash-*' \
-H 'Content-Type: application/json' \ -H 'Content-Type: application/json' \
-u kibanaserver:kibanaserver \ -u kibanaserver:kibanaserver \
...@@ -144,8 +146,8 @@ $ curl -XPUT -D- 'http://localhost:9200/.kibana/index-pattern/logstash-*' \ ...@@ -144,8 +146,8 @@ $ curl -XPUT -D- 'http://localhost:9200/.kibana/index-pattern/logstash-*' \
This command will mark the Logstash index pattern as the default index pattern: This command will mark the Logstash index pattern as the default index pattern:
```bash ```console
$ curl -XPUT -D- 'http://localhost:9200/.kibana/config/5.6.2' \ $ curl -XPUT -D- 'http://localhost:9200/.kibana/config/5.6.3' \
-H 'Content-Type: application/json' \ -H 'Content-Type: application/json' \
-u kibanaserver:kibanaserver \ -u kibanaserver:kibanaserver \
-d '{"defaultIndex": "logstash-*"}' -d '{"defaultIndex": "logstash-*"}'
...@@ -279,3 +281,18 @@ logstash: ...@@ -279,3 +281,18 @@ logstash:
environment: environment:
LS_JAVA_OPTS: "-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=18080 -Dcom.sun.management.jmxremote.rmi.port=18080 -Djava.rmi.server.hostname=DOCKER_HOST_IP -Dcom.sun.management.jmxremote.local.only=false" LS_JAVA_OPTS: "-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=18080 -Dcom.sun.management.jmxremote.rmi.port=18080 -Djava.rmi.server.hostname=DOCKER_HOST_IP -Dcom.sun.management.jmxremote.local.only=false"
``` ```
## Updates
### Using a newer stack version
To use a different Elastic Stack version than the one currently available in the repository, simply change the version
number inside the `.env` file, and rebuild the stack with:
```console
$ docker-compose build
$ docker-compose up
```
**NOTE**: Always pay attention to the [upgrade instructions](https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-upgrade.html)
for each individual component before performing a stack upgrade.
...@@ -3,7 +3,10 @@ version: '2' ...@@ -3,7 +3,10 @@ version: '2'
services: services:
elasticsearch: elasticsearch:
build: elasticsearch/ build:
context: elasticsearch/
args:
ELK_VERSION: $ELK_VERSION
volumes: volumes:
- ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml - ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
ports: ports:
...@@ -15,7 +18,10 @@ services: ...@@ -15,7 +18,10 @@ services:
- elk - elk
logstash: logstash:
build: logstash/ build:
context: logstash/
args:
ELK_VERSION: $ELK_VERSION
volumes: volumes:
- ./logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml - ./logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml
- ./logstash/pipeline:/usr/share/logstash/pipeline - ./logstash/pipeline:/usr/share/logstash/pipeline
...@@ -29,7 +35,10 @@ services: ...@@ -29,7 +35,10 @@ services:
- elasticsearch - elasticsearch
kibana: kibana:
build: kibana/ build:
context: kibana/
args:
ELK_VERSION: $ELK_VERSION
volumes: volumes:
- ./kibana/config/:/usr/share/kibana/config - ./kibana/config/:/usr/share/kibana/config
ports: ports:
......
ARG ELK_VERSION
# https://github.com/elastic/elasticsearch-docker # https://github.com/elastic/elasticsearch-docker
FROM docker.elastic.co/elasticsearch/elasticsearch:5.6.3 FROM docker.elastic.co/elasticsearch/elasticsearch:${ELK_VERSION}
COPY config/ config/ COPY config/ config/
COPY bin/ bin/ COPY bin/ bin/
# Search Guard plugin # Search Guard plugin
# https://github.com/floragunncom/search-guard/wiki # https://github.com/floragunncom/search-guard/wiki
RUN elasticsearch-plugin install --batch com.floragunn:search-guard-5:5.6.3-16 \ ARG ELK_VERSION
RUN elasticsearch-plugin install --batch com.floragunn:search-guard-5:${ELK_VERSION}-16 \
&& chmod +x \ && chmod +x \
plugins/search-guard-5/tools/hash.sh \ plugins/search-guard-5/tools/hash.sh \
plugins/search-guard-5/tools/sgadmin.sh plugins/search-guard-5/tools/sgadmin.sh
......
ARG ELK_VERSION
# https://github.com/elastic/kibana-docker # https://github.com/elastic/kibana-docker
FROM docker.elastic.co/kibana/kibana:5.6.3 FROM docker.elastic.co/kibana/kibana:${ELK_VERSION}
# Search Guard plugin # Search Guard plugin
# https://github.com/floragunncom/search-guard-docs/blob/master/kibana.md # https://github.com/floragunncom/search-guard-docs/blob/master/kibana.md
RUN kibana-plugin install https://github.com/floragunncom/search-guard-kibana-plugin/releases/download/v5.6.3-4/searchguard-kibana-5.6.3-4.zip ARG ELK_VERSION
RUN kibana-plugin install https://github.com/floragunncom/search-guard-kibana-plugin/releases/download/v${ELK_VERSION}-4/searchguard-kibana-${ELK_VERSION}-4.zip
# Add your kibana plugins setup here # Add your kibana plugins setup here
# Example: RUN kibana-plugin install <name|url> # Example: RUN kibana-plugin install <name|url>
ARG ELK_VERSION
# https://github.com/elastic/logstash-docker # https://github.com/elastic/logstash-docker
FROM docker.elastic.co/logstash/logstash:5.6.3 FROM docker.elastic.co/logstash/logstash:${ELK_VERSION}
# Add your logstash plugins setup here # Add your logstash plugins setup here
# Example: RUN logstash-plugin install logstash-filter-json # Example: RUN logstash-plugin install logstash-filter-json
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment