OBU Tracker with data aggregation and gateway back-end service.
Microservices, Kafka, Prometheus, Grafana
- HTTP(JSON API) - native http & net servers and listeners, no fancy packages.
- GRPC with Protobuffers
-
OBUs (On-Board Units) => Generate OBUID with coordinates and sends them to data_receiver
-
Receiver/Producer (data_receiver) => Awaits for OBU Data and produces to Kafka
-
Kafka (docker installation with zookeeper)
-
Distance Calculator (distance_calc) => Polls data from Kafka and calculates the distance base on received
coordinates. Then uses the (5. Aggregator)'s Client to store it and process via gRPC or HTTP Transport layer.
- Aggregator => CRUD operations for OBU Distance, invoicer, and data provider for the Gateway.
5.1. Prometheus implementation will only be present as the middleware for aggregator interface methods
- Gateway => User facing API, communicating with Aggregator API
Enterprise-standard implementation of the Aggregator service (go-kit-example/aggsvc)
This is a project demonstrating how to structure, connect, and build transport between microservices.
It may not include the full business logic, all endpoints or data storage (like NoSQL).
All operations are handled in memory to prove the concept and make the application work properly.
For business logic implementation, check out the Hotel API or other projects.
docker run --name kafka -p 9092:9092 -e ALLOW_PLAINTEXT_LISTENER=yes -e KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE=true bitnami/kafka:latest
Also available via included docker-compose.yml file
docker-compose up (or with daemon / background) -d
For linux users or (WSL2)
sudo apt install -y protobuf-compiler
For Mac users use Homebrew
brew install protobuf
- Protobuffers
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28
- GRPC
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2
- Set the /go/bin directory to its local dir
PATH="${PATH}:${HOME}/go/bin"
- Install the package dependencies
- Protobuffer package
go get google.golang.org/protobuf
- gRPC Package
go get google.golang.org/grpc/
- Install Prometheus (Docker)
docker run --name prometheus -d -p 127.0.0.1:9090:9090 prom/prometheus
- Install prometheus client
go get github.com/prometheus/client_golang/prometheus
docker run -d -p 3000:3000 --name=grafana grafana/grafana-enterprise