This project sets up a monitoring system using Grafana and Prometheus with Docker. It includes CI/CD configuration with GitHub Actions to ensure the services are always up-to-date and functioning correctly.
- Prometheus: Collects and stores metrics.
- Grafana: Visualizes the metrics collected by Prometheus.
- Node Exporter: Provides OS metrics for Prometheus.
- Alertmanager: Manages alerts sent by Prometheus.
- CI/CD with GitHub Actions: Automates the deployment and testing of the system.
- Docker and Docker Compose installed on the system.
- A Docker Hub account.
- Environment variables configured for Docker Hub and Grafana authentication.
Create a .env
file in the root of the project with the following variables:
-
GF_SECURITY_ADMIN_USER=admin
-
GF_SECURITY_ADMIN_PASSWORD=admin
- Clone the repository.
- Navigate to the project folder.
- Create a .env file in the root directory with the necessary environment variables.
- Run docker-compose up -d to start the services.
- Access Prometheus at http://localhost:9090.
- Access Grafana at http://localhost:3000 and use the credentials defined in the .env file.
The CI/CD pipeline is defined in .github/workflows/ci-cd.yml and performs the following actions:
- Builds and pushes Docker images.
- Deploys the system using Docker Compose.
- Checks that the services are running correctly.
- Checks that the out of the box dashboards are working with data from the datasource(prometheus).
To set up GitHub secrets for the CI/CD pipeline, follow these steps:
- Navigate to your forked repository on GitHub.
- Go to Settings > Secrets and variables > Actions.
- Add the following secrets:
DOCKER_USERNAME
: Your Docker Hub username.DOCKER_PASSWORD
: Your Docker Hub password.GF_SECURITY_ADMIN_USER
: Your Grafana admin username.GF_SECURITY_ADMIN_PASSWORD
: Your Grafana admin password.
- Prometheus: Access Prometheus at http://localhost:9090.
- Grafana: Access Grafana at http://localhost:3000 and use the credentials defined in the .env file.
Contributions are welcome. Please open an issue or submit a pull request.
This project is licensed under the MIT License.