- Follow these instructions to install Elasticsearch.
- Go to
/etc/elasticsearch/
and edit the elasticsearch.yml. Replace any instances oflocalhost
with0.0.0.0
. - Follow these instructions to install Kibana.
- Like before, go to
/etc/kibana/
and edit the kibana.yml file. Replace all instances oflocalhost
with0.0.0.0
. - If kibana is installed, you can go to
<your IP>:5601/app/apm
to get instructions on how to install apm-server. - Again, go to
/etc/apm-server/
and edit the apm-server.yml file. Replace all instances oflocalhost
with0.0.0.0
. - Enable apm kibana dashboards with
apm-server setup --dashboards
. - Use the tools at
<your IP>:5601/app/apm
to verify that the apm server is correctly installed. - Use systemctl to restart all three services (elasticsearch.service, kibana.service, apm-server.service).
- Clone this repository.
- Edit the python app to point to the correct apm-server instance.
- Run the following commands to build and publish the webapp.
sudo docker build --tag=elasticwebapp .
sudo docker tag elasticwebapp <docker username>/elasticwebapp:v1
sudo docker push <docker username>/elasticwebapp:v1
- Edit the docker-compose.yml file to locate the right webapp to run. Run the following to start the webapp, Redis, and a simple visualizer to view your docker containers.
sudo docker stack deploy <stack name> --compose-file <path to docker compose.yml>
- Verify that Redis, your Flask webapp, and the visualizer are all running properly.
- Open
<your IP>:5601/app/apm
again and use the built in tools to verify that your Flask app is sending information to the apm-server.
- Run the following command to install Metricbeat.
sudo apt-get install metricbeat
- Navigate to
/etc/metricbeat/
and edit the metricbeat.yml file. In the kibana section, edit the host to match the IP of your kibana instance. In the outputs section, edit the outputs.elasticsearch hosts to point to your elasticsearch IP. Restart the metricbeat.service. - Navigate to
/etc/metricbeat/modules.d
and runcp docker.yml.disabled docker.yml
to enable docker exporting. - Restart the metricbeat service with
sudo systemctl restart metricbeat.service
. - Enable dasbhoards for kibana with
metricbeat setup --dashboards
. - Verify that your Kibana instance is receiving information from Metricbeat.
- Note that any other instances with metricbeat installed will automatically be added to the same dashboard!
You can now monitor the request volume and response time of your Flask app, along with basic information about the docker instance that's running it.