Meteo Airport is a comprehensive project that simulates a weather station at an airport. It collects data from various sensors, including temperature, humidity, wind speed, and pressure. The data is then published to an MQTT broker and stored in InfluxDB. The project also includes an alert manager that listens to the MQTT broker and triggers alerts based on predefined conditions.
- Sensor data simulation for temperature, humidity, wind speed, and pressure
- MQTT publisher for sensor data
- Storage manager for storing sensor data in InfluxDB or in CSV files
- Alert manager for triggering alerts based on predefined conditions
- REST API for retrieving sensor data and alerts
- Swagger documentation for the REST API
- Test suite for validating the project
- Linter for ensuring code quality
- Docker Compose for running services locally
- Makefile for automating common tasks
- CI/CD pipeline for automating the build and test process
The project is structured into several packages, each responsible for a specific functionality:
cmd/contains the mains applications(Storage manager, Alert manager, Sensor data simulation, REST API)internal/contains the internal packages used by the applicationsconfig/contains the configuration files for the applicationsscripts/contains the scripts for building, testing, and other operationstest/contains the tests for the projectexternal/contains the external packages used by the project
- Go 1.21.4 or compatible
- Make 3.81 or compatible
- Docker 24.0.6 or compatible
- An MQTT broker( e.g. Mosquitto, HiveMQ, EMQ X)
- An InfluxDB database)
-
Clone the repository:
git clone https://github.com/jarhead-killgrave/imt-2023-go-project-ZEBIAN-KITSOUKOU-MILLION-LEBRAS-ACHEK.git
-
Navigate to the project directory:
cd imt-2023-go-project-ZEBIAN-KITSOUKOU-MILLION-LEBRAS-ACHEK -
Copy the
.env.devfile to.env, and edit it to match your configuration:cp .env.dev .env
or for Windows:
copy .env.dev .env
-
Build the applications:
make build
-
Initialize all necessary services:
make init
Alternatively, you can initialize each service without using
make:docker compose up -d
After initialization, you should be able to access the following services:
- http://localhost:8086 for InfluxDB
- http://localhost:1883 for the MQTT broker
-
For running a specific application, you can use the following commands:
./<application_name> <configuration_file>
For example, to run the storage manager:
./storage-manager config/storage-manager.yaml
or for Windows:
.\<application_name>.exe <configuration_file>
For example, to run the storage manager:
.\storage-manager.exe config\storage-manager.yaml
You can run all the applications at once by running the following command:
make runThe project uses YAML files for configuration. You can find the configuration files in the config/ directory.
Each application has its own configuration file. The configuration contains all the necessary information for running
the application, including the MQTT broker address, the InfluxDB address, the topic names...
The project includes a test suite for validating the project. The tests are located in the test/ directory.
You can run the tests with the following command:
make testor with command line:
go test ./test/...Before your branch is merged, golangci-lint will be run on your code on the CI server.
First, you need to install it locally:
docker pull golangci/golangci-lintAfter You can run it locally with docker by running the following command:
docker run -t --rm -v $(pwd):/app -w /app golangci/golangci-lint golangci-lint run -vor with make:
make lintIf you want to fix the issues automatically, you can run the following command:
docker run -t --rm -v $(pwd):/app -w /app golangci/golangci-lint golangci-lint run -v --fixor with make:
make lint-fix