vaporz / turbo Goto Github PK
View Code? Open in Web Editor NEWA lightweight microservice tool, turn your grpc|thrift APIs into HTTP APIs!
Home Page: https://vaporz.github.io
License: MIT License
A lightweight microservice tool, turn your grpc|thrift APIs into HTTP APIs!
Home Page: https://vaporz.github.io
License: MIT License
error message:panic: no such component: LogInterceptor, forget to register?
components.go中按照文档说明增加注册方法
func RegisterComponents(s *turbo.GrpcServer){
s.RegisterComponent("LogInterceptor", i.LogInterceptor{})
}
try to replace glide with dep
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?
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
为啥不用grpc+grpc-gateway?
练手么?
那这个和自己写一个对应接口的rpc转http的区别是?
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
$ 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)
Release go-module support as soon,plz~~~ ORZ
使用 turbo generate package/Service -r grpc -I path
让其使用 xxx.proto 文件创建后,其创建的 gen/proto/grpcswitcher.go 文件 import 引入处会使用 g 引入绝对路径,这个没有使用 mod 名,导致每次都需要手工修正。
panic: open C/src/C/src/package/path/to/yourservice/service.yaml: The system cannot find the file specified.
RT
make install, make test
Try using those more advanced features in text/template
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
# : ~/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
请问怎么在服务之间进行调用?
如果采用http方式的话,这样的开销有点大,因为假设如果我在一台机器上部署了多个service,然后在多个service之间需要互相调用的话,这样的开销确实有点大,因为涉及到了 两次的http 转 grpc, 然后grpc 转 http相当于本机调用本机的接口。
能否开放一个api,本机的service之间可以互相调用,两台机器之间通过http方式
Setup component mappings via service.yaml.
1, marshal "data" into a struct
2, set path params into that struct
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
And upgrade to go 1.14
java grpc可以吗?
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)
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
Reload component mappings on config change.
Investigate and find a better way for docs.
1, https://readthedocs.org
example:
http://ksp-kos.github.io/KOS_DOC/
2, github.io
...
下载了 release后, 无法使用turbo命令。 是不是还需要什么设置?
My services are implemented in Python, could I use turbo to turn them into restful?
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...)`
ps: How to do this in thrift?
Have sufficient logs which trace through the whole lifecycle of a request.
Change the mappings on a web page, drag to customize the components over an API, I think it's cool.
I found there are LICENSEs for source code files...
Learn from and integrate with other open source projects, such as go-kit, go-micro, etc.
An investigation result report is necessary.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.