sherifabdlnaby / elastdocker
- пятница, 4 октября 2019 г. в 00:20:04
Dockerfile
🐳 Elastic Stack (ELK) on Docker, with preconfigured Security, Tools, Self-Monitoring, and Prometheus Metrics Exporters.
Elastic Stack (AKA ELK) Docker Composition, preconfigured with Security, Monitoring, Tools such as ElastAlert for alerting and Curator.
Based on Official Elastic Docker Images
Stack Version: 7.4.0.
You can change Elastic Stack version by setting
ELK_VERSIONin.envfile and rebuild your images. Any version >= 7.0.0 is compatible with this template.
.env to configure your stack.$ make setup$ make elk
---- OR ----
$ docker-compose up -dUsername: elastic Password: changeme (or ELASTIC_PASSWORD value in .env)
Modify
.envfile for your needs, most importantlyELASTIC_PASSWORDthat setup your superuserelastic's password,ELASTICSEARCH_HEAP&LOGSTASH_HEAPfor Elasticsearch & Logstash Heap Size andELK_VERSIONfor, yk, Stack Version.
$ make monitoring$ make tools$ make all
$ make nodes$ make build$ make buildMake sure to run
make setupif you changedELASTIC_PASSWORDand to restart the stack after changing anything in.env.
Adding Two Extra Nodes to the cluster will make the cluster depending on them and won't start without them again.
Makefile is a wrapper around Docker-Compose commands, use make help to know every command.
Elasticsearch will save its data to a volume named elasticsearch-data
Elasticsearch Keystore (that contains passwords and credentials) and SSL Certificate are generated in the ./secrets directory by the setup command.
Linux Users must set the following configuration as root
sysctl -w vm.max_map_count=262144
By default, Virtual Memory is not enough.
.env file.
ELASTIC_PASSWORD, user elastic's password (default: changeme pls).ELK_VERSION Elastic Stack Version (default: 7.3.0)ELASTICSEARCH_HEAP, how much Elasticsearch allocate from memory (default: 1GB -good for development only-)LOGSTASH_HEAP, how much Logstash allocate from memory.elasticsearch.yml at ./elasticsearch/config.logstash.yml at ./elasticsearch/config/logstash.yml.main.conf at ./elasticsearch/pipeline/main.conf.kibana.yml at ./kibana/config../tools/elastalert/config../tools/elastalert/rules, head to ElastAlert docs to lookup how to create alerts../tools/curator/actions and ./tools/curator/crontab.You can extend the Keystore generation script by adding keys to ./setup/keystore.sh script. (e.g Add S3 Snapshot Repository Credentials)
To Re-generate Keystore:
make keystore
If you started Prometheus Exporters using make monitoring command. Prometheus Exporters will expose metrics at the following ports.
| Prometheus Exporter | Port | Note |
|---|---|---|
elasticsearch-exporter |
9114 |
- |
logstash-exporter |
9304 |
- |
cadvisor-exporter |
8080 |
- To Monitor Each Container stats and metrics. |
Head to Stack Monitoring tab in Kibana to see cluster metrics for all stack components.
In Production, cluster metrics should be shipped to another dedicated monitoring cluster.
MIT License Copyright (c) 2019 Sherif Abdel-Naby
PR(s) are Open and Welcomed.