GithubHelp home page GithubHelp logo

vaporz / turbo Goto Github PK

View Code? Open in Web Editor NEW
303.0 23.0 24.0 5.22 MB

A lightweight microservice tool, turn your grpc|thrift APIs into HTTP APIs!

Home Page: https://vaporz.github.io

License: MIT License

Go 98.35% Shell 0.88% Thrift 0.50% Makefile 0.26%
microservice grpc thrift interceptor reverse-proxy grpc-gateway

turbo's People

Contributors

vaporz avatar vongang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

turbo's Issues

Support JSON API

1, marshal "data" into a struct
2, set path params into that struct

Improve config loading mechanism

1, Start service with the path to config file only.
2, change
grpc_service_address
to
gprc_service_host
gprc_service_port
3, add ServiceRootPath to config file, remove ServicePkgPath

installation issue.

when I try to run glide install as the documentation.

I got the following problem:

glide install

[WARN] The name listed in the config file (github.com/vaporz/turbo) does not match the current location (turbo)
[INFO] Lock file (glide.lock) does not exist. Performing update.
[WARN] The name listed in the config file (github.com/vaporz/turbo) does not match the current location (turbo)
[INFO] Downloading dependencies. Please wait...
[INFO] --> Fetching updates for github.com/spf13/viper
[INFO] --> Fetching updates for google.golang.org/grpc
[INFO] --> Fetching updates for github.com/golang/protobuf
[INFO] --> Fetching updates for github.com/bitly/go-simplejson
[INFO] --> Fetching updates for github.com/gorilla/mux
[INFO] --> Fetching updates for github.com/sirupsen/logrus
[INFO] --> Fetching updates for github.com/fsnotify/fsnotify
[INFO] --> Fetching updates for git.apache.org/thrift.git
[INFO] --> Fetching updates for github.com/spf13/cobra
[INFO] --> Fetching updates for github.com/stretchr/testify
[INFO] --> Setting version for github.com/bitly/go-simplejson to da1a8928f709389522c8023062a3739f3b4af419.
[INFO] --> Setting version for github.com/fsnotify/fsnotify to 4da3e2cfbabc9f751898f250b49f2439785783a1.
[INFO] --> Setting version for github.com/gorilla/mux to 18fca31550181693b3a834a15b74b564b3605876.
[INFO] --> Setting version for github.com/sirupsen/logrus to 68cec9f21fbf3ea8d8f98c044bc6ce05f17b267a.
[INFO] --> Setting version for github.com/spf13/cobra to 99ff9334bda26384b5ef4a4aaa4d444d29bdde73.
[INFO] --> Setting version for git.apache.org/thrift.git to 48ea3cde081b6343ceda2f1e3811887c1d11859b.
[INFO] --> Setting version for github.com/spf13/viper to 0967fc9aceab2ce9da34061253ac10fb99bba5b2.
[INFO] --> Setting version for github.com/stretchr/testify to f6abca593680b2315d2075e0f5e2a9751e3f431a.
[INFO] --> Setting version for github.com/golang/protobuf to 5a0f697c9ed9d68fef0116532c6e05cfeae00e55.
[INFO] --> Setting version for google.golang.org/grpc to d2a85bf7ad299df70daee28117f707025bddac22.
[INFO] Resolving imports
[INFO] --> Fetching updates for github.com/inconshreveable/mousetrap
[INFO] --> Fetching updates for github.com/spf13/pflag
[ERROR] Error scanning github.com/vaporz/turbo/turbo/cmd: cannot find package "." in:
/Users/zhaoliu/Downloads/workspace/common/src/go/src/github.com/vaporz/turbo/turbo/turbo/cmd
[ERROR] Failed to retrieve a list of dependencies: Error resolving imports

Is it expected?I think I should run glide install under:
github.com/vaporz/turbo, right?
in the doc, it's github.com/vaporz/turbo/turbo

Support non-RPC requests

Sometimes, some APIs don't need to do RPC calls.
We can just write some code in a hijacker and register it to an URL.

How to make this approach more obvious, and let it become a feature?

服务之间调用的问题

请问怎么在服务之间进行调用?
如果采用http方式的话,这样的开销有点大,因为假设如果我在一台机器上部署了多个service,然后在多个service之间需要互相调用的话,这样的开销确实有点大,因为涉及到了 两次的http 转 grpc, 然后grpc 转 http相当于本机调用本机的接口。

能否开放一个api,本机的service之间可以互相调用,两台机器之间通过http方式

type error: run demo usage.

demo usage:

  • turbo create demo DemoService -r grpc

# tree . -L 2                                                                                                                                                                                           
.
├── demoservice.proto
├── gen
│   ├── grpcfields.yaml
│   ├── grpcswitcher.go
│   └── proto
├── grpcapi
│   ├── component
│   └── demoserviceapi.go
├── grpcservice
│   ├── demoservice.go
│   └── impl
├── main.go
└── service.yaml

6 directories, 7 files


run error:

# : ~/iGo/libdir/src/demo                                                                                                                                           
#  go run main.go                                                                                                                                                                                        

# demo/gen
gen/grpcswitcher.go:21:76: cannot use callOptions (type []"github.com/vaporz/turbo/vendor/google.golang.org/grpc".CallOption) as type []"google.golang.org/grpc".CallOption in argument to s.Service().("demo/gen/proto".DemoServiceClient).SayHello




Add an UI for config file

Change the mappings on a web page, drag to customize the components over an API, I think it's cool.

How to use map<string, string> in MethodNameRequest?

I defined the variable map<string,string> in the engine .proto , but when I start grpcswitcher.go it prompts an error: ..\gen\grpcswitcher.go:24:35: unknown field 'Rms' in struct literal of type "kubeensaas-engine/gen/proto".SayHelloRequest.

engine .proto:

`service Engine {
rpc Deploy (DeployRequest) returns (DeployResponse) {}
rpc sayHello (SayHelloRequest) returns (SayHelloResponse) {}
}

message SayHelloRequest {
string yourName = 1;
map<string, string> rms = 2;
}`

grpcswitcher.go:

`case "SayHello":
request := &g.SayHelloRequest{ Rms: &g.RmsEntry{}, }

err = turbo.BuildRequest(s, request, req)

if err != nil {
	return nil, err
}

rpcResponse, err = s.Service("Engine").(g.EngineClient).SayHello(req.Context(), request, callOptions...)`

E2E test for all components

Components:
interceptor, pre/postprocessor, hijacker, MessageFieldConvertor, config options, etc.

Create E2E tests:
1, create a project
2, start & stop service
3, run test suit(1)
4, change .proto/.thrift
5, re-generate
6, run test suit(2)

turbo create at windows error

$ turbo create demo DemoService -r grpc
panic: open D/src/D/src/demo/service.yaml: The system cannot find the file specified.

goroutine 1 [running]:
github.com/vaporz/turbo.panicIf(...)
D:/goWorkspace/src/github.com/vaporz/turbo/util.go:38
github.com/vaporz/turbo.(*Config).loadServiceConfig(0xc00014c3c0)

turbo命令创建服务的问题

使用 turbo generate package/Service -r grpc -I path
让其使用 xxx.proto 文件创建后,其创建的 gen/proto/grpcswitcher.go 文件 import 引入处会使用 g 引入绝对路径,这个没有使用 mod 名,导致每次都需要手工修正。

Start service issue.

I create a test grpc service by run command like this:

turbo create turbo TestService -r grpc, then run go run main.go under TestService, got following problem:

turbo/gen
gen/grpcswitcher.go:21:76: cannot use callOptions (type []"github.com/vaporz/turbo/vendor/google.golang.org/grpc".CallOption) as type []"vendor/google.golang.org/grpc".CallOption in argument to s.Service().("turbo/gen/proto".TestServiceClient).SayHello

Compiling error in generated code if there're multiple services defined in proto file

It's reported that, if there're more than one service defined in several proto files, the generated code is unable to compile successfully.

The original comment:

如果有多个proto文件 turbo generate 命令重新生成代码后,grpcswitcher.go文件会报错,
rpcResponse, err = s.Service().(g.HelloClient).SayHello(req.Context(), request, callOptions...)
多个proto文件就是有多个Service 但是每个case里面上一行代码中都是初始项目时候的那个HelloClient

win10 turbo create error

panic: open C/src/C/src/package/path/to/yourservice/service.yaml: The system cannot find the file specified.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.