GStones / moke-layout

template for moke-kit

Home Page:https://github.com/GStones/moke-kit/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Moke Project Template

Go Report Card Go Reference Release

Introduction

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.

How to run

  • 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

How to test

Integration Test

  • build your interactive client:
      go build -o client.exe ./cmd/demo/client/main.go 
  • run your interactive client:
     # 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.
    tips: http client use Postman to connect localhost:8081.

Load Test

  • install k6
  • run k6 load test
        k6 run ./tests/demo/demo.js

Proto file Manage

  • 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

About

template for moke-kit

https://github.com/GStones/moke-kit/wiki

License:MIT License


Languages

Language:Go 93.6%Language:JavaScript 3.7%Language:Dockerfile 2.7%