This repository contains a Dockerized Node.js tweeting application along with Dockerfiles and configuration files for monitoring and logging using Filebeat, Grafana, Prometheus, Elastic Search, and Kibana. Additionally, it includes Terraform configuration to deploy the project in a DigitalOcean Spaces bucket.
The repository provides a simple Node.js tweeting application that allows users to post tweets. It leverages Docker to containerize the application, making it easy to deploy and manage across different environments.
Docker swarm is used to run and maintain the containers.
The repository also includes Dockerfiles and configuration files for the following components:
- Filebeat: A lightweight log shipper that collects and forwards logs.
- Grafana: A powerful open-source monitoring and visualization platform.
- Prometheus: A leading open-source monitoring and alerting toolkit.
- Elastic Search and Kibana: A popular combination for searching, analyzing, and visualizing data in real-time.
Furthermore, it includes Terraform configuration files to deploy the project in a DigitalOcean Spaces bucket. This enables seamless infrastructure provisioning and management.
To get started, clone the repository to your local machine:
git clone https://github.com/emigiusto/minitwit-devops-demo.git
cd minitwit-devops-demoBefore running the Node.js tweeting app, make sure you have Docker installed on your system.
To build and run the Docker container for the tweeting app, use the following command:
docker-compose up -dThis command will build the Docker image and start the container in detached mode.
Filebeat is used to collect and forward logs from the Node.js minitwit app to Elastic search.
Filebeat will be built automatically
From /minitwit-devops-demo/ run:
docker-compose -f ./docker-compose-monitoring.yml up -d --build
And follow this steps:
- Access
http://localhost::3005/ - Enter basic credentials (admin, admin)
- Go to Datasources > Add new Datasource
Choose any name
Type: Prometheus
Url:
http://localhost:9090Access: direct Click Add - Go to Dashboards
Look for "Import Dashboard" in the top menu
Copy the content of the file in
/grafana/dashboard.json
The repository includes Terraform configuration files to deploy the project in a DigitalOcean Spaces bucket. The deployment takes plae in the continous-deployment Github Actions workflow.
To succesfully execute the deployment process, these credentials should be available in Github Actions Secrets:
TF_VAR_DO_TOKEN:Digital Ocean API keySTATE_FILE:Digital Ocean space bucket state fileSPACE_NAME:Digital Ocean space bucket nameAWS_ACCESS_KEY_ID:Digital Ocean space bucket key IDAWS_SECRET_ACCESS_KEY:Digital Ocean space bucket secret keyTERRAFORM_PRIVATEKEY:ssh private keyTERRAFORM_PUBLICKEY:ssh public keyMYSQL_PASSWORD:MYSQL database passwordMYSQL_USERNAME:MYSQL database usernameMYSQL_HOST:MYSQL database hostnameMYSQL_PORT:MYSQL database port numberMYSQL_DATABASE:MYSQL database danmeDOCKER_USERNAME:Dockerhub account's username to store docker imagesDOCKER_PASSWORD:Dockerhub account's password to store docker images