Moke is a template project for moke-kit to help you quickly build a gRPC/TCP/HTTP Microservice IOC project. It provides the following tools:
- Interact command line client
- Load test tool
- Proto file management: proto file generation, proto file push to buf Schema Registry, and SDKS generation for different languages.
-
deploy infrastructure:
# add ./deployment/docker-compose/.env file to custom your environment if you have docker compose -f ./deployment/docker-compose/infrastructure.yaml up -d
-
run service:
go run ./cmd/demo/service/main.go
- build your interactive client:
go build -o client.exe ./cmd/demo/client/main.go
- run your interactive client:
tips: http client use Postman to connect
# help ./client.exe help # run grpc client ./client.exe grpc # run tcp client ./client.exe tcp # run help to see more command options. and follow the tips to run.
localhost:8081
.
- install k6
- run k6 load test
k6 run ./tests/demo/demo.js
-
install buf
-
manage proto file
# generate proto file buf generate
# use buf Schema Registry to manage proto file # you need to sign up and login to buf Schema Registry,follow the steps below: # https://buf.build/docs/tutorials/getting-started-with-bsr#prerequisites buf registry login username # push proto file to buf Schema Registry buf push
-
generate SDKS for different languages
- visit https://buf.build/gstones/moke-layout/sdks
- choose the language you want to generate, and follow the cmd to import the SDKS to your project.