Make "Quick" start quicker

This commit is contained in:
Stanley Cheung 2018-08-24 18:12:59 -07:00
parent 99a53e9177
commit 4b2dac5fcb
11 changed files with 29 additions and 26 deletions

View File

@ -23,7 +23,8 @@ Try gRPC-Web and run a quick Echo example from the browser!
From the repo root directory: From the repo root directory:
```sh ```sh
$ docker-compose up echo-server envoy commonjs-client $ docker-compose pull prereqs common echo-server envoy commonjs-client
$ docker-compose up -d echo-server envoy commonjs-client
``` ```
Open a browser tab, and go to: Open a browser tab, and go to:
@ -32,6 +33,8 @@ Open a browser tab, and go to:
http://localhost:8081/echotest.html http://localhost:8081/echotest.html
``` ```
To shutdown: `docker-compose down`.
## Runtime Library ## Runtime Library

View File

@ -4,28 +4,28 @@ services:
build: build:
context: ./ context: ./
dockerfile: ./net/grpc/gateway/docker/prereqs/Dockerfile dockerfile: ./net/grpc/gateway/docker/prereqs/Dockerfile
image: grpc-web:prereqs image: grpcweb/prereqs
common: common:
build: build:
context: ./ context: ./
dockerfile: ./net/grpc/gateway/docker/common/Dockerfile dockerfile: ./net/grpc/gateway/docker/common/Dockerfile
depends_on: depends_on:
- prereqs - prereqs
image: grpc-web:common image: grpcweb/common
echo-server: echo-server:
build: build:
context: ./ context: ./
dockerfile: ./net/grpc/gateway/docker/echo_server/Dockerfile dockerfile: ./net/grpc/gateway/docker/echo_server/Dockerfile
depends_on: depends_on:
- common - common
image: grpc-web:echo-server image: grpcweb/echo-server
ports: ports:
- "9090:9090" - "9090:9090"
envoy: envoy:
build: build:
context: ./ context: ./
dockerfile: ./net/grpc/gateway/docker/envoy/Dockerfile dockerfile: ./net/grpc/gateway/docker/envoy/Dockerfile
image: grpc-web:envoy image: grpcweb/envoy
ports: ports:
- "8080:8080" - "8080:8080"
links: links:
@ -36,7 +36,7 @@ services:
dockerfile: ./net/grpc/gateway/docker/nginx/Dockerfile dockerfile: ./net/grpc/gateway/docker/nginx/Dockerfile
depends_on: depends_on:
- common - common
image: grpc-web:nginx image: grpcweb/nginx
ports: ports:
- "8080:8080" - "8080:8080"
links: links:
@ -45,7 +45,7 @@ services:
build: build:
context: ./ context: ./
dockerfile: ./net/grpc/gateway/docker/grpcwebproxy/Dockerfile dockerfile: ./net/grpc/gateway/docker/grpcwebproxy/Dockerfile
image: grpc-web:grpcwebproxy image: grpcweb/grpcwebproxy
ports: ports:
- "8080:8080" - "8080:8080"
links: links:
@ -56,7 +56,7 @@ services:
dockerfile: ./net/grpc/gateway/docker/commonjs_client/Dockerfile dockerfile: ./net/grpc/gateway/docker/commonjs_client/Dockerfile
depends_on: depends_on:
- common - common
image: grpc-web:commonjs-client image: grpcweb/commonjs-client
ports: ports:
- "8081:8081" - "8081:8081"
closure-client: closure-client:
@ -65,7 +65,7 @@ services:
dockerfile: ./net/grpc/gateway/docker/closure_client/Dockerfile dockerfile: ./net/grpc/gateway/docker/closure_client/Dockerfile
depends_on: depends_on:
- common - common
image: grpc-web:closure-client image: grpcweb/closure-client
ports: ports:
- "80:80" - "80:80"
ts-client: ts-client:
@ -74,7 +74,7 @@ services:
dockerfile: ./net/grpc/gateway/docker/ts_client/Dockerfile dockerfile: ./net/grpc/gateway/docker/ts_client/Dockerfile
depends_on: depends_on:
- common - common
image: grpc-web:ts-client image: grpcweb/ts-client
ports: ports:
- "8082:8082" - "8082:8082"
binary-client: binary-client:
@ -83,6 +83,6 @@ services:
dockerfile: ./net/grpc/gateway/docker/binary_client/Dockerfile dockerfile: ./net/grpc/gateway/docker/binary_client/Dockerfile
depends_on: depends_on:
- common - common
image: grpc-web:binary-client image: grpcweb/binary-client
ports: ports:
- "8081:8081" - "8081:8081"

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM grpc-web:common FROM grpcweb/common
ARG EXAMPLE_DIR=/github/grpc-web/net/grpc/gateway/examples/echo ARG EXAMPLE_DIR=/github/grpc-web/net/grpc/gateway/examples/echo

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM grpc-web:common FROM grpcweb/common
RUN cd /github/grpc-web && \ RUN cd /github/grpc-web && \
curl https://dl.google.com/closure-compiler/compiler-latest.zip \ curl https://dl.google.com/closure-compiler/compiler-latest.zip \

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM grpc-web:prereqs FROM grpcweb/prereqs
COPY . /github/grpc-web COPY . /github/grpc-web

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM grpc-web:common FROM grpcweb/common
ARG EXAMPLE_DIR=/github/grpc-web/net/grpc/gateway/examples/echo ARG EXAMPLE_DIR=/github/grpc-web/net/grpc/gateway/examples/echo

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM grpc-web:common FROM grpcweb/common
RUN cd /github/grpc-web && \ RUN cd /github/grpc-web && \
make echo_server make echo_server

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM grpc-web:common FROM grpcweb/common
RUN cd /github/grpc-web-base/net/grpc/gateway/examples/echo && \ RUN cd /github/grpc-web-base/net/grpc/gateway/examples/echo && \
sed -i 's/localhost:9090/echo-server:9090/g' nginx.conf sed -i 's/localhost:9090/echo-server:9090/g' nginx.conf

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM grpc-web:common FROM grpcweb/common
ARG EXAMPLE_DIR=/github/grpc-web/net/grpc/gateway/examples/echo ARG EXAMPLE_DIR=/github/grpc-web/net/grpc/gateway/examples/echo

View File

@ -26,7 +26,7 @@ This step compiles gRPC and Protobuf, and serves as the base docker image for
the subsequent docker images. the subsequent docker images.
```sh ```sh
$ docker build -t grpc-web:prereqs \ $ docker build -t grpcweb/prereqs \
-f net/grpc/gateway/docker/prereqs/Dockerfile . -f net/grpc/gateway/docker/prereqs/Dockerfile .
``` ```
@ -36,9 +36,9 @@ This compiles the gRPC backend server, written in C++, and listens on port
9090. 9090.
```sh ```sh
$ docker build -t grpc-web:echo-server \ $ docker build -t grpcweb/echo-server \
-f net/grpc/gateway/docker/echo_server/Dockerfile . -f net/grpc/gateway/docker/echo_server/Dockerfile .
$ docker run -d -p 9090:9090 --name echo-server grpc-web:echo-server $ docker run -d -p 9090:9090 --name echo-server grpcweb/echo-server
``` ```
## Run the Envoy proxy ## Run the Envoy proxy
@ -47,9 +47,9 @@ This step runs the Envoy proxy, and listens on port 8080. Any gRPC-Web browser
requests will be forwarded to port 9090. requests will be forwarded to port 9090.
```sh ```sh
$ docker build -t grpc-web:envoy \ $ docker build -t grpcweb/envoy \
-f net/grpc/gateway/docker/envoy/Dockerfile . -f net/grpc/gateway/docker/envoy/Dockerfile .
$ docker run -d -p 8080:8080 --link echo-server:echo-server grpc-web:envoy $ docker run -d -p 8080:8080 --link echo-server:echo-server grpcweb/envoy
``` ```
## Serve static JS/HTML contents ## Serve static JS/HTML contents
@ -58,9 +58,9 @@ This steps compiles the front-end gRPC-Web client into a static .JS file, and
we use a simple server to serve up the JS/HTML static contents. we use a simple server to serve up the JS/HTML static contents.
```sh ```sh
$ docker build -t grpc-web:closure-client \ $ docker build -t grpcweb/closure-client \
-f net/grpc/gateway/docker/closure_client/Dockerfile . -f net/grpc/gateway/docker/closure_client/Dockerfile .
$ docker run -d -p 80:80 grpc-web:closure-client $ docker run -d -p 80:80 grpcweb/closure-client
``` ```
## Run the example from your browser ## Run the example from your browser

View File

@ -53,5 +53,5 @@ source ./scripts/test-proxy.sh
docker-compose down docker-compose down
# Run unit tests from npm package # Run unit tests from npm package
docker run --rm grpc-web:common /bin/bash \ docker run --rm grpcweb/common /bin/bash \
/github/grpc-web/scripts/docker-run-tests.sh /github/grpc-web/scripts/docker-run-tests.sh