ElasticSearch and Kibana setup with docker '

I am a full-stack Ruby on Rails developer with experience in PostgreSQL, Docker, Heroku, and performance optimization. I love exploring new technology stacks and have recently developed an interest in mobile app development using Flutter. My skills in test-driven development and fixing security vulnerabilities have helped me deliver high-quality, reliable code. I am also currently learning about machine learning and its applications in real-world problem-solving. I bring a unique combination of technical expertise, creative problem-solving, and a passion for learning to any team. I am committed to delivering elegant and efficient software solutions and excited to contribute to an innovative and dynamic team that shares this vision.
ElasticSearch is a full-text search engine and Kibana is a free and open user interface that lets you visualize your Elasticsearch data and navigate the Elastic Stack.
In this post, we will see a summary of how we can configure both tools using docker and access them from the browser
Docker setup
We will use docker-compose here to set up both tools, but you can also use docker CLI to achieve it.
create a docker-compose.yml file or I like to call it services.yml file where we will set up all the configuration options for both services
version: '3.7'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.2.2
container_name: elasticsearch
restart: always
environment:
- xpack.security.enabled=false
- discovery.type=single-node
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
cap_add:
- IPC_LOCK
volumes:
- elasticsearch-data:/usr/share/elasticsearch/data
ports:
- 9200:9200
- 9300:9300
kibana:
container_name: kibana_622
image: docker.elastic.co/kibana/kibana:6.2.2
restart: always
environment:
- ELASTICSEARCH_HOSTS=http://elasticsearch:9200
ports:
- 5601:5601
depends_on:
- elasticsearch
volumes:
elasticsearch-data:
driver: local
how to run it
docker-compose -f <filename.yml> up -d
And then visit http://localhost:5601 to see Kibana dashboard. Default password is elastic
-foption allows us to provide a file name if the file is different thandocker-compose.yml.-doption will run containers in daemon
How to clean restart these docker instance
IMPORTANT NOTE: below command will kill all processes and remove them. It will also remove all of the volumes, so you will lose previous data
docker-compose down
docker rm -f $(docker ps -a -q)
docker volume rm $(docker volume ls -q)
docker-compose -f services.yml up -d
How to fix the test environment to use elastic search using chewy
Create config/initializers/chewy.yml file and add following
Chewy.settings = { host: 'localhost:9200' }
Or change the port where your elastic search is running, if you had made any changes on the above services.yml file

