build microservices with solutions stack with :
- Golang
- MongoDB
- GRPC
- Docker
- Mono Repo With 3 Microservice
# Authentication
protogen-microservice-authentication:
@rm -Rf microservice-authentication/pkg/pbuff
@protoc --proto_path=microservice-authentication/protobuf --go_out=plugins=grpc:. microservice-authentication/protobuf/*.proto
@echo generating protbuff finished..
# Product
protogen-microservice-product:
@rm -Rf microservice-product/pkg/pbuff
@protoc --proto_path=microservice-product/protobuf --go_out=plugins=grpc:. microservice-product/protobuf/*.proto
@echo generating protbuff finished..
# Order
protogen-microservice-order:
@rm -Rf microservice-order/pkg/pbuff
@protoc --proto_path=microservice-order/protobuf --go_out=plugins=grpc:. microservice-order/protobuf/*.proto
@echo generating protbuff finished..
# Deploy
dockerize-microservice-authentication:
@docker build --build-arg server=microservice-authentication -f ./microservice-authentication/Dockerfile -t microservice-authentication:latest .
@docker images --filter=reference='microservice-authentication:latest'
dockerize-microservice-product:
@docker build --build-arg server=microservice-product -f ./microservice-product/Dockerfile -t microservice-product:latest .
@docker images --filter=reference='microservice-product:latest'
dockerize-microservice-order:
@docker build --build-arg server=microservice-order -f ./microservice-order/Dockerfile -t microservice-order:latest .
@docker images --filter=reference='microservice-order:latest'
dockerize-all-service: dockerize-microservice-authentication dockerize-microservice-product dockerize-microservice-order
start-gocommerce-docker:
@docker-compose up -d
stop-gocommerce-docker:
@docker-compose down
test-run:
go test gocommerce/microservice-authentication/services
go test gocommerce/microservice-order/services
go test gocommerce/microservice-product/services
test-build-run: test-run dockerize-all-service start-gocommerce-docker
build-stop: stop-gocommerce-docker
make test-build-run
erysiregar@ery gocommerce % make test-build-run
go test gocommerce/microservice-authentication/services
ok gocommerce/microservice-authentication/services (cached)
go test gocommerce/microservice-order/services
ok gocommerce/microservice-order/services 0.829s
go test gocommerce/microservice-product/services
ok gocommerce/microservice-product/services (cached)
[+] Building 24.7s (18/18) FINISHED
[+] Running 5/5
⠿ Container dbtwo Running 0.0s
⠿ Container dbone Running 0.0s
⠿ Container microservice-order Started 2.1s
⠿ Container microservice-product Running 0.0s
⠿ Container microservice-authentication Running
make build-stop
for download : https://insomnia.rest/download
for using : https://docs.insomnia.rest/insomnia/grpc
name file of collection insomnia:
COLLECTION-Insomnia_2022-07-06.json
after login, use accessToken, and put in to Header with key Authorization : Bearer {accessToken}
{"Authorization": "Bearer accessToken"}
Notes : if asset not load perfectly, you can get it in folder V-README-asset