Sign inSign up

aleksandarf/grpcwebrproxy

By aleksandarf

•Updated over 4 years ago

container for the excellent https://github.com/improbable-eng/grpc-web/tree/master/go/grpcwebproxy

Image
0

3.6K

aleksandarf/grpcwebrproxy repository overview

⁠Signalbroker web client

This project contains two things

  • Web frontend interface for signalbroker⁠ implemented using gRPC-Web
  • Exposes websocket interface enabling simpler js applications. Sample is included.

⁠Prerequisites

⁠Signal Broker

Before starting, the signalbroker⁠ must be running. Follow the instruction to get going, preferrable the docker guide.

⁠Start using docker

  • Open a terminal/console window.
  • Clone this repo:
    $ git clone [email protected]:beamylabs/signalbroker-web-client.git
    
  • Move to the new folder:
    $ cd signalbroker-web-client
    
⁠Option 1
SIGNALBROKER_IP=192.168.1.169 docker-compose -f docker-compose-grpcwebproxy.yml up

Make sure to use your real host ip (not 127.0.0.1) instead of 192.168.1.169

quick test, the mini web sample should now work if you follow the instructions Websocket Web Client found below

Now point your browser to http://your_ip:8080/⁠, read more below Run the gRPC front-end web client

⁠Option 2: envoy, only for x86 arch
SIGNALBROKER_IP=172.16.14.133 docker-compose -f docker-compose-envoy.yml up

⁠Run the gRPC front-end web client

Point your browser to http://your_envoy_machine_ip:8080/⁠. You will be notified that the Signal Broker proxy is offline. This is because you need to specify the correct IP according to your configurations. Click the red field in the status bar at the bottom which reads "Signal Broker proxy". Configure it by setting your proxy (envoy or grpcwebproxy) IP, http://[your_envoy_or_grpcwebproxy_server]:8081 at first attemp probabaly 127.0.0.1:8081. Then hit the refresh button in the webpage.

⁠For developers

⁠Signal Broker

Before starting, the signalbroker⁠ must be running.

⁠grpc

SignalServer is reached via a grpc proxy (envoy or grpcwebproxy). If the SignalServer grpc api is changed the corresponding js files need to be re-generated read more here⁠

⁠yarn hosting/development
SIGNALBROKER_IP=192.168.1.169 docker-compose -f docker-compose-grpcwebproxy.yml start proxy
cd clientSource && yarn serve

Read more in the development⁠ section.

⁠Erlang/elixir cowboy hosting
mix deps.get
iex -S mix

if your signalbroker server is running on another machine do:

mix deps.get
SIGNAL_SERVER_HOST_NAME=10.251.177.205 iex -S mix

⁠Envoy or grpc-web-proxy

Envoy must be running and should be connected to the Signal Broker Server. Check readme⁠ on how to get started.

⁠Customizing the web frontend

See configuration/grpc_web/README.md⁠ for information on generation of GRPC-web JS code from the proto-files.

See clientSource/README.md⁠ for more information about the web frontend.

The resulting production build can be hosted on a web server of your choice or you may prefer to use the development server by running yarn serve. If you intend to host the production version on Cowboy, then copy the generated /dist folder to signalbroker-web-client/priv/ after running yarn build. Remember to point the web frontend to the correct proxy (envoy or grpcwebproxy) IP.

⁠Help us improve!

The gRPC front-end web client for the Signal Broker is in active development and would appreciate your feature suggestions or bug reports. File them as issues in this repository :)

⁠Websocket Web Client

Easier to get started, but less capable option and predecesor to the gRPC client.

To access the Websocket client UI point your web browser to http://localhost:8080/websocket_demo/web_car.html⁠

⁠Websocket API

The API is simply the same as the telnet API⁠ but sent over websocket.

For a working sample of how to use the code go to priv/websocket_demo/js/web_car.js.

⁠TODO - help appreciated

  • add envoy to the docker image, alternatively use docker compose.

  • use grpcwebproxy since it works with arm

Tag summary

Content type

Image

Digest

Size

9.4 MB

Last updated

over 4 years ago

docker pull aleksandarf/grpcwebrproxy