Grpc-web: gRPC Hello World Guide is out of date for Windows and Mac users

Created on 14 Jan 2019  路  8Comments  路  Source: grpc/grpc-web

The README.md doc for the Hello World guide is out of date for Windows and Mac users. Specifically, the envoy.yaml file should be updated with a clarification for Mac and Windows users that instead of using address: localhost, they should use address: host.docker.internal under the clusters field due to idiosyncrasies with how the docker VM is configured on these machines.

Furthermore, the command to launch the Envoy proxy under these OSes is slightly different (--network=host should be removed) so the command should be:

$ docker run -d -p 8080:8080 helloworld/envoy

Most helpful comment

@gsantopaolo yes it should be opened. It is not still working on the latest Mac.

All 8 comments

Thank you so much. I was unable to get this started after your suggestion initially because I didn't kill all the docker processes/container after changes.

I need another suggestion.
Windows 10 Corp, Envoy in docker container with envoy.yaml config from example page.
Simple copy-paste from helloworld example, did your trick with host.docker.internal under the clusters field.
Still getting error "{code: 14, message: "Http response at 400 or 500 level"}" in browser.
What I'm doing wrong?

Did you build docker container and run it properly? Caveats in the hello world tutorial - it's quite outdated in the docker part - use docker run -d -p 8080:8080 helloworld/envoy as --network=host flag is no longer supported.

I build docker container from PowerShell with command docker build .

My Dockerfile:

FROM envoyproxy/envoy:latest
COPY envoy.yaml /etc/envoy/envoy.yaml
CMD /usr/local/bin/envoy -c /etc/envoy/envoy.yaml

envoy.yaml:

admin:
  access_log_path: /tmp/admin_access.log
  address:
    socket_address: { address: 0.0.0.0, port_value: 9901 }

static_resources:
  listeners:
  - name: listener_0
    address:
      socket_address: { address: 0.0.0.0, port_value: 8080 }
    filter_chains:
    - filters:
      - name: envoy.http_connection_manager
        config:
          codec_type: auto
          stat_prefix: ingress_http
          route_config:
            name: local_route
            virtual_hosts:
            - name: local_service
              domains: ["*"]
              routes:
              - match: { prefix: "/" }
                route:
                  cluster: echo_service
                  max_grpc_timeout: 0s
              cors:
                allow_origin:
                - "*"
                allow_methods: GET, PUT, DELETE, POST, OPTIONS
                allow_headers: keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,custom-header-1,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web,grpc-timeout
                max_age: "1728000"
                expose_headers: custom-header-1,grpc-status,grpc-message
                enabled: true
          http_filters:
          - name: envoy.grpc_web
          - name: envoy.cors
          - name: envoy.router
  clusters:
  - name: echo_service
    connect_timeout: 0.25s
    type: logical_dns
    http2_protocol_options: {}
    lb_policy: round_robin
    hosts: [{ socket_address: { address: host.docker.internal, port_value: 9090 }}]

I run docker with command:

docker run -d -p 8080:8080 envoyproxy/envoy:latest

Result:
{code: 14, message: "Http response at 400 or 500 level"}

I have added all the changes recommended to get the hello world example to run into this repo https://github.com/oinke/gprc-hello

The terminal still shows:
server_1 | E0302 08:41:34.225022613 7 http_server_filter.cc:271] GET request without QUERY
and when i browse localhost:8080 i can see
upstream connect error or disconnect/reset before headers. reset reason: remote reset

Running on macOS Mojave 10.14.2 with Docker version 18.09.2, build 6247962

Notes added to doc.

@stanley-cheung shall we open this again? the envoy.yaml file is using a property (hosts) that is deprecated https://www.envoyproxy.io/docs/envoy/latest/api-v2/api/v2/cds.proto#envoy-api-file-envoy-api-v2-cds-proto

@gsantopaolo yes it should be opened. It is not still working on the latest Mac.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

clovis818 picture clovis818  路  4Comments

sirudog picture sirudog  路  3Comments

developerlaoz picture developerlaoz  路  3Comments

dv29 picture dv29  路  6Comments

peteringram0 picture peteringram0  路  5Comments