moke-layout

module
v1.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2024 License: MIT

README

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

Directories

Path Synopsis
api
gen/demo/api
Package pb is a reverse proxy.
Package pb is a reverse proxy.
cmd
internal
pkg
dfx

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL