This project creates a single node ElasticSearch and Kibana instance secured by TLS with XPack using docker-compose
.
The environment variables are stored in the env file.
The demo ElasticSearch/Kibana passwords are stored in the passwords.txt file. These entries were generated by the elasticsearch-setup-passwords
command.
Setup of host machine:
sudo apt update
sudo apt upgrade
sudo apt install docker.io
sudo usermod -aG docker ubuntu
You need to logout and log back in...
Test things are working:
docker run hello-world
df -h
sudo apt install docker-compose
If you need to use Docker swarm for some reason:
#docker swarm init
The vm.max_map_count kernel setting must be set to at least 262144 for production use:
sudo sysctl -w vm.max_map_count=262144
Add to /etc/sysctl.conf/etc/sysctl.conf
to make permanent.
Increase ulimits for nofile and nproc:
docker run --rm centos:8 /bin/bash -c 'ulimit -Hn && ulimit -Sn && ulimit -Hu && ulimit -Su'
If required, adjust limits on docker run command by e.g. --ulimit nofile=65535:65535
Disable swapping on the host or do this instead:
"-e 'bootstrap.memory_lock=true' --ulimit memlock=-1:-1"
Optionally, build your custom images:
#docker build -t custom/mariadb mariadb --rm #--no-cache
Optionally, pull newer versions of public images:
#docker-compose pull
Create the TLS certificates for the ElasticSearch and Kibana:
docker-compose -f create-certs.yml run --rm create_certs
Create the ElasticSearch and Kibana containers:
docker-compose up -d #--force
To setup the system users automatically inside the container:
docker exec -it es01 bash
elasticsearch-setup-passwords auto
exit
Save these passwords to the passwords.txt file.
To execute bash inside the container:
docker exec -it es01 bash
docker exec -it kib01 bash
Tail the logs:
docker logs -f es01
docker logs -f kib01
The server is now available on:
- Kibana
- ElasticSearch
- https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html
- https://www.elastic.co/guide/en/elasticsearch/reference/current/configuring-tls-docker.html
- https://www.elastic.co/guide/en/elastic-stack-get-started/7.10/get-started-docker.html
- https://www.elastic.co/guide/en/elasticsearch/reference/7.10/ldap-realm.html
- https://www.elastic.co/guide/en/elasticsearch/reference/7.10/pki-realm.html
- https://www.elastic.co/guide/en/elasticsearch/reference/7.10/custom-realms.html
- https://www.elastic.co/blog/security-for-elasticsearch-is-now-free