Giter Club home page Giter Club logo

Comments (13)

mosuka avatar mosuka commented on May 21, 2024 1

Hi @joeblew99 ,
Sounds good.:)
I'll replace to grpc-gateway from the current HTTP server.

from blast.

joeblew99 avatar joeblew99 commented on May 21, 2024 1

I had a look at the GRPC code you have now.
Wondering if you knew about GRPC Gateway back then or not ?

What do you think of this approach ?

  1. Client (some MicroService written in any language).
  • They could use swagger ( from GRPC gateway ) to codegen their own code.
  • Or they can take the GRPC and codegen their own code.
  • Or they can just make raw HTTP calls, which would be pretty aweful because the API and types of Blast are not that simple. Types especially are quite complex and deeply needed.
  • All 3 options above use HTTP. Websockets are not needed.
  1. Blast Server
  • Runs GRPC and GRPC Gateway, so that client can use either.

About the CLI.
I saw some golang lib that can take a GRPC API and code gen the golang CLI with the viper code inside. Its really code generating a CLI can then has a GRPC Client that calls the GRP Server. DO you think this is a good idea ? I like it because it makes it much easier to refactor code when needed.

Security.
If someone wanted to use Blast in a Multi-Tenant setup, i wonder if they can use caddy to restrict access to different parts of the Data Blast holds ?
I cant actually think of a way except to run different Instances of blast and just lets Caddy on top and restrict by Domain / IP address.

from blast.

mosuka avatar mosuka commented on May 21, 2024 1

@joeblew99
I released v0.8.0, rewritten to grpc-gateway.
I'm not familiar with swagger, but it creates swagger.json. However, expected swagger.json could not be generated because Bleve's SearchRequest and SearchResult use Protocol buffers's any.proto. I will continue to investigate it.
Currently, the user will need to write a raw HTTP request directly.

Can you tell me a few about the CLI library? I'll try it out.

I agree with your opinion about multi-tenancy. Blast does not plan for multi-tenant support yet.

Thanks,

from blast.

l4u avatar l4u commented on May 21, 2024

@mosuka what was the protoc command you used? Probably an extra param for proto_path is needed.

from blast.

joeblew99 avatar joeblew99 commented on May 21, 2024

hey @mosuka awesome stuff. I will have a look soon.

About the GRPC tools.
There is a general list here:
https://github.com/grpc-ecosystem/awesome-grpc#tools-cli

May Favs:

CLI for GRPC
https://github.com/fullstorydev/grpcurl

  • pretty cool

Web GUI for GRPC
https://github.com/fullstorydev/grpcui
OR
https://github.com/gogo/letmegrpc

Proxy
https://github.com/improbable-eng/grpc-web

Just ask if this is not enough....

  • helps cognitively.

from blast.

mosuka avatar mosuka commented on May 21, 2024

Hi @l4u @joeblew99 ,
swagger.json has been generated.
https://github.com/mosuka/blast/blob/master/protobuf/index/index.swagger.json

However, the response specification is not what I expected. For example, the response body specification of GetResponse will be any.proto.
This is because google.protobuf.Any is used for fields in GetResponse.

I would like to hear your opinion. Which is the preferred response body?

  1. Current response body using custom json marshaler:
{
  "fields": {
    "_type": "enwiki",
    "text_en": "A search engine is an ...",
    "timestamp": "2018-07-04T...",
    "title_en": "Search engine..."
  }
}
  1. the response body of the original grpc-gateway:
{
  "value": {
    "type_url": "map[string]interface {}",
    "value": " ... base64 encoded string ... "
  }
}

I have never used swagger so I don't know which one is better.

Thanks,

from blast.

joeblew99 avatar joeblew99 commented on May 21, 2024

@mosuka

do you have to use google.protobuf.Any ? What is the reason for it ?

Also i noticed your not usin the "openapiv2" options. See:
https://github.com/johanbrandhorst/grpc-gateway-boilerplate/blob/master/proto/example.proto#L13

Here is boilerplate Project BTW.
https://github.com/johanbrandhorst/grpc-gateway-boilerplate/blob/master/proto/example.proto

from blast.

mosuka avatar mosuka commented on May 21, 2024

@joeblew99

The index mapping specified at startup determines the field name and type of the document. Therefore, since it is difficult to handle as Struct, Blast handles the document and as map[string]interface{}.

In Protocol Buffers, it is difficult to express map[string]interface{}, bleve.SearchRequest and bleve.SearchResult, so I use the Any message type.

from blast.

joeblew99 avatar joeblew99 commented on May 21, 2024

@mosuka

Sorry i got side tracked on something else.
It seems you did the commit anyway ?

from blast.

mosuka avatar mosuka commented on May 21, 2024

@joeblew99
I had implement grpc-gateway in v0.8.0. However swagger is still incomplete.

from blast.

gedw99 avatar gedw99 commented on May 21, 2024

I found a much easier solution to the grpc aspects.

Started to use envoy to run the grpc-web layer.
It is very recommend.

Gloo from solo makes it easy.

We just run it with standard kubernetes.

See here : https://github.com/getcouragenow/packages/tree/master/maintemplate/server/deployments/helm/templates

Blast and cete are then much simpler.

We plan to stand up with in our cluster.
I can send you you the PR when we are done with the line manifests to run it if you want ??

from blast.

mosuka avatar mosuka commented on May 21, 2024

@gedw99
Sure. That sounds great.
PR for the grpc-web layer is welcome. :)

from blast.

joeblew99 avatar joeblew99 commented on May 21, 2024

from blast.

Related Issues (20)

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.