Billing services for car parking slot using microservices
- Database
- Consumer
- Billing
- Zookeeper
- Broker(Kafka)
git clone [email protected]:goakshit/gandalf.git
cd gandalf
docker-compose -f ./build/docker/docker-compose.yaml up -d --build
Docker-compose starts up the services mentioned above.
Database(Postgres)
: Docker container boots up and executes the sql file in ./build/scripts/db which creates the table where data is persisted from kafka.Zookeeper
: Runs at port 2181.Broker(Kafka)
: Exposes 29092(Internal network) & 9092 (Host Network)Consumer
: Listens to kafka messages and persists the data in db.Billing
: Exposes two api(s) at port 80 -> /api/duration/{id} & /api/cost/{id}. Eg: curl -XGET http://localhost:80/api/duration/5client
: Pushes the vehicle information to Kafka. To exec: go run ./cmd/client
To generate swagger json:
Need to have the swagger CLI then swagger generate spec -o ./swagger.json --scan-models
or exec make
Mocks are added for persistence(DB layer). Tests are added for billing service. To exec: go test ./internal/pkg/billing