From 7c3735611687acf4b4776b0a7338cf6c2135d66f Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Mon, 12 Feb 2018 13:22:35 -0800 Subject: [PATCH] Some scripts and docs cleanup --- INSTALL.md | 78 +++++++++++++++++++ net/grpc/gateway/examples/echo/README.md | 69 +--------------- net/grpc/gateway/examples/echo/overview.md | 54 ------------- darwin_x86_64.sh => scripts/darwin_x86_64.sh | 1 + .../debian_stretch.sh | 1 + .../init_submodules.sh | 3 + ubuntu_12_04.sh => scripts/ubuntu_12_04.sh | 1 + ubuntu_14_04.sh => scripts/ubuntu_14_04.sh | 1 + 8 files changed, 87 insertions(+), 121 deletions(-) create mode 100644 INSTALL.md delete mode 100644 net/grpc/gateway/examples/echo/overview.md rename darwin_x86_64.sh => scripts/darwin_x86_64.sh (98%) rename debian_stretch.sh => scripts/debian_stretch.sh (98%) rename init_submodules.sh => scripts/init_submodules.sh (94%) rename ubuntu_12_04.sh => scripts/ubuntu_12_04.sh (98%) rename ubuntu_14_04.sh => scripts/ubuntu_14_04.sh (98%) diff --git a/INSTALL.md b/INSTALL.md new file mode 100644 index 0000000..7bc1287 --- /dev/null +++ b/INSTALL.md @@ -0,0 +1,78 @@ +This document shows you some steps on how you can install gRPC-Web and the +necessary pre-requisites. + +## Pre-requisites + +* Ubuntu + +```sh +$ sudo apt-get install autoconf automake build-essential curl git \ + default-jdk default-jre libtool libpcre3 libpcre3-dev libssl-dev \ + make wget zip +``` + +* MacOS + +```sh +$ brew install autoconf automake libtool pcre +``` + +## Clone the repo + +```sh +$ git clone git@github.com:grpc/grpc-web.git +$ cd grpc-web && git submodule update --init + +$ cd third_party/grpc +$ git submodule update --init +``` + +## 1. Install Protobuf + +From the repo root directory: + +```sh +$ cd third_party/grpc/third_party/protobuf +$ ./autogen.sh && ./configure && make +$ sudo make install +``` + + +## 2. Install gRPC + +From the repo root directory: + +```sh +$ cd third_party/grpc +$ EMBED_OPENSSL=false make +$ sudo EMBED_OPENSSL=false make install + +# On MacOS Sierra or above, you might need to run these 2 commands instead +# EMBED_OPENSSL=false CPPFLAGS=-DOSATOMIC_USE_INLINED=1 make +# sudo EMBED_OPENSSL=false CPPFLAGS=-DOSATOMIC_USE_INLINED=1 make install +``` + +## 3. Download the Closure compiler + +From the repo root directory: + +```sh +$ wget http://dl.google.com/closure-compiler/compiler-latest.zip -O compiler-latest.zip +$ unzip -p -qq -o compiler-latest.zip *.jar > closure-compiler.jar +``` + +Make sure `closure-compiler.jar` is put in the repo root directory after the +above steps. + + +## Build! + +From the repo root directory: + +```sh +$ make # build the nginx gateway +``` + + +For more example on how to build the client and an end-to-end example, please +see [this page](net/grpc/gateway/examples/echo). diff --git a/net/grpc/gateway/examples/echo/README.md b/net/grpc/gateway/examples/echo/README.md index 2b5c589..66920ce 100644 --- a/net/grpc/gateway/examples/echo/README.md +++ b/net/grpc/gateway/examples/echo/README.md @@ -16,8 +16,8 @@ You need the following 3 things before you start: 2. gRPC 3. Closure compiler -Click [here](#pre-requisites) or scroll down to see some details on how to -install those. +Click [here](../../../../../INSTALL.md) and make sure you have installed all +required pre-requisites. ## Build the example @@ -52,71 +52,6 @@ http://:8080/net/grpc/gateway/examples/echo/echotest.html ``` -## Pre-requisites - -* Ubuntu - -```sh -$ sudo apt-get install autoconf automake build-essential curl git \ - default-jdk default-jre libtool libpcre3 libpcre3-dev libssl-dev \ - make wget zip -``` - -* MacOS - -```sh -$ brew install autoconf automake libtool pcre -``` - -## Clone the repo - -```sh -$ git clone git@github.com:grpc/grpc-web.git -$ cd grpc-web && git submodule update --init - -$ cd third_party/grpc -$ git submodule update --init -``` - -## 1. Install Protobuf - -From the repo root directory: - -```sh -$ cd third_party/grpc/third_party/protobuf -$ ./autogen.sh && ./configure && make -$ sudo make install -``` - - -## 2. Install gRPC - -From the repo root directory: - -```sh -$ cd third_party/grpc -$ EMBED_OPENSSL=false make -$ sudo EMBED_OPENSSL=false make install - -# On MacOS Sierra or above, you might need to run these 2 commands instead -# EMBED_OPENSSL=false CPPFLAGS=-DOSATOMIC_USE_INLINED=1 make -# sudo EMBED_OPENSSL=false CPPFLAGS=-DOSATOMIC_USE_INLINED=1 make install -``` - -## 3. Download the Closure compiler - -From the repo root directory: - -```sh -$ wget http://dl.google.com/closure-compiler/compiler-latest.zip -O compiler-latest.zip -$ unzip -p -qq -o compiler-latest.zip *.jar > closure-compiler.jar -``` - -Make sure `closure-compiler.jar` is put in the repo root directory after the -above steps. - - - ## What's next? For more details about how you can run your own gRPC service from the browser, diff --git a/net/grpc/gateway/examples/echo/overview.md b/net/grpc/gateway/examples/echo/overview.md deleted file mode 100644 index 322c3b0..0000000 --- a/net/grpc/gateway/examples/echo/overview.md +++ /dev/null @@ -1,54 +0,0 @@ -## Overview - -Provided as a Javascript client library, gRPC Web allows a browser/HTML client -to use the same API as a Node client to access a grpc service. While grpc-web -speaks a different protocol than the native grpc (over http/2) protocol, the -end-to-end semantics is identicial to what a native grpc client (e.g. a Node -client) experiences. - -This gRPC Web library supports server streaming and simple unary calls across -all major browsers. The client library has proto3 support and uses the -protobuf binary format. It also provides a generated code surface for your -service stub via a protoc plugin. - -The gRPC Nginx gateway will do the gRPC protocol translation to the backend. -It can serve as a reverse proxy for both your HTTP and gRPC traffic. - -## Key features - -* JS library with code generation with Node API and proto3 support -* Server streaming and unary calls across all major browsers -* Client works over any HTTP versions -* Closure-based JS library compilation is supported -* Nginx based reverse proxy for both HTTP and gRPC traffic -* Cross-origin (CORS) support (without preflight) - -## Status - -Alpha - -## Pre-requisites - -* Protobuf v3.0.0+ -* gRPC v1.0.0+ -* Docker (dev dependency) - -## Build the Nginx gateway - -```sh -$ ./build.sh -``` - -## Example - -Please go to the [examples][] directory to see how you can run a demo service. - -## Known gaps / issues - -* Limited platform/OS support, for the Nginx gateway -* No performance or load testing -* No client-streaming or bidi-streaming support -* Limited documentation -* CORS preflight bypass to be added - -[examples]:https://github.com/grpc/grpc-web/tree/master/net/grpc/gateway/examples/echo diff --git a/darwin_x86_64.sh b/scripts/darwin_x86_64.sh similarity index 98% rename from darwin_x86_64.sh rename to scripts/darwin_x86_64.sh index 375b14d..393f6c2 100755 --- a/darwin_x86_64.sh +++ b/scripts/darwin_x86_64.sh @@ -1,4 +1,5 @@ ./init_submodules.sh +cd .. make clean cd third_party/grpc/third_party/protobuf \ && ./autogen.sh \ diff --git a/debian_stretch.sh b/scripts/debian_stretch.sh similarity index 98% rename from debian_stretch.sh rename to scripts/debian_stretch.sh index 8898a16..fec95b3 100755 --- a/debian_stretch.sh +++ b/scripts/debian_stretch.sh @@ -1,4 +1,5 @@ ./init_submodules.sh +cd .. make clean docker build -t debian_stretch -f net/grpc/gateway/docker/debian_stretch/Dockerfile . CONTAINER_ID=$(docker create debian_stretch) diff --git a/init_submodules.sh b/scripts/init_submodules.sh similarity index 94% rename from init_submodules.sh rename to scripts/init_submodules.sh index be70028..9413f4b 100755 --- a/init_submodules.sh +++ b/scripts/init_submodules.sh @@ -1,4 +1,7 @@ +cd .. git submodule update --init cd third_party/closure-library && git checkout tags/v20160911 -f && cd ../.. cd third_party/openssl && git checkout tags/OpenSSL_1_0_2h -f && cd ../.. cd third_party/grpc && git checkout 2b0ab320c12cb807cf05b3295b7017d0ccbf66f5 -f && git submodule update --init && cd ../.. +cd scripts/ + diff --git a/ubuntu_12_04.sh b/scripts/ubuntu_12_04.sh similarity index 98% rename from ubuntu_12_04.sh rename to scripts/ubuntu_12_04.sh index 0442d23..67af2f3 100755 --- a/ubuntu_12_04.sh +++ b/scripts/ubuntu_12_04.sh @@ -1,4 +1,5 @@ ./init_submodules.sh +cd .. make clean docker build -t ubuntu_12_04 -f net/grpc/gateway/docker/ubuntu_12_04/Dockerfile . CONTAINER_ID=$(docker create ubuntu_12_04) diff --git a/ubuntu_14_04.sh b/scripts/ubuntu_14_04.sh similarity index 98% rename from ubuntu_14_04.sh rename to scripts/ubuntu_14_04.sh index 9c9586b..d929606 100755 --- a/ubuntu_14_04.sh +++ b/scripts/ubuntu_14_04.sh @@ -1,4 +1,5 @@ ./init_submodules.sh +cd .. make clean docker build -t ubuntu_14_04 -f net/grpc/gateway/docker/ubuntu_14_04/Dockerfile . CONTAINER_ID=$(docker create ubuntu_14_04)