Skip to content

Commit

Permalink
Make all example clients consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
stanley-cheung committed Aug 29, 2018
1 parent 8986a65 commit fd6c9c4
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 28 deletions.
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ services:
- common
image: grpcweb/closure-client
ports:
- "80:80"
- "8081:8081"
ts-client:
build:
context: ./
Expand All @@ -76,7 +76,7 @@ services:
- common
image: grpcweb/ts-client
ports:
- "8082:8082"
- "8081:8081"
binary-client:
build:
context: ./
Expand Down
5 changes: 4 additions & 1 deletion net/grpc/gateway/docker/binary_client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ $EXAMPLE_DIR/commonjs-example
RUN cd $EXAMPLE_DIR/commonjs-example && \
npm install && \
npm link grpc-web && \
npx webpack
npx webpack && \
mkdir -p /var/www/html/dist && \
cp echotest.html /var/www/html && \
cp dist/main.js /var/www/html/dist

EXPOSE 8081
CMD ["nginx"]
2 changes: 1 addition & 1 deletion net/grpc/gateway/docker/closure_client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ RUN cd /github/grpc-web && \
RUN cd /github/grpc-web && \
make client && make install-example

EXPOSE 80
EXPOSE 8081
CMD ["nginx"]
5 changes: 4 additions & 1 deletion net/grpc/gateway/docker/commonjs_client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ $EXAMPLE_DIR/commonjs-example
RUN cd $EXAMPLE_DIR/commonjs-example && \
npm install && \
npm link grpc-web && \
npx webpack
npx webpack && \
mkdir -p /var/www/html/dist && \
cp echotest.html /var/www/html && \
cp dist/main.js /var/www/html/dist

EXPOSE 8081
CMD ["nginx"]
7 changes: 5 additions & 2 deletions net/grpc/gateway/docker/ts_client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ RUN cd $EXAMPLE_DIR/ts-example && \
npm install && \
npm link grpc-web && \
tsc && \
npx webpack
npx webpack && \
mkdir -p /var/www/html/dist && \
cp echotest.html /var/www/html && \
cp dist/main.js /var/www/html/dist

EXPOSE 8082
EXPOSE 8081
CMD ["nginx"]
8 changes: 4 additions & 4 deletions net/grpc/gateway/examples/echo/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ proto-js:
--grpc-web_out=import_style=closure,mode=grpcwebtext:. ./echo.proto

install:
mkdir -p $(HTML_DIR)/$(EXAMPLES_PATH)
cp ./echotest.html $(HTML_DIR)/$(EXAMPLES_PATH)/
cp ./echoapp.js $(HTML_DIR)/$(EXAMPLES_PATH)/
cp compiled.js $(HTML_DIR)/echo_js_bin_dev.js
mkdir -p $(HTML_DIR)
cp ./echotest.html $(HTML_DIR)
cp ./echoapp.js $(HTML_DIR)
cp ./compiled.js $(HTML_DIR)/echo_js_bin_dev.js

clean:
rm -f *.grpc.pb.cc *.grpc.pb.h *.grpc.pb.o *.pb.cc *.pb.h *.pb.o \
Expand Down
2 changes: 1 addition & 1 deletion net/grpc/gateway/examples/echo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ we use a simple server to serve up the JS/HTML static contents.
```sh
$ docker build -t grpcweb/closure-client \
-f net/grpc/gateway/docker/closure_client/Dockerfile .
$ docker run -d -p 80:80 grpcweb/closure-client
$ docker run -d -p 8081:8081 grpcweb/closure-client
```

## Run the example from your browser
Expand Down
2 changes: 1 addition & 1 deletion net/grpc/gateway/examples/echo/echotest.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
<title>Echo Example</title>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="../../../../../echo_js_bin_dev.js"></script>
<script type="text/javascript">
const module = {};
</script>
<script src="./echo_js_bin_dev.js"></script>
<script src="./echoapp.js"></script>
<script type="text/javascript">
var EchoServiceClient = proto.grpc.gateway.testing.EchoServiceClient;
Expand Down
16 changes: 1 addition & 15 deletions net/grpc/gateway/examples/echo/nginx_simple.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,11 @@ events {

http {
access_log off;
server {
listen 80;
server_name localhost;
location ~ \.(html|js)$ {
root /var/www/html;
}
}
server {
listen 8081;
server_name localhost;
location ~ \.(html|js)$ {
root /github/grpc-web/net/grpc/gateway/examples/echo/commonjs-example;
}
}
server {
listen 8082;
server_name localhost;
location ~ \.(html|js)$ {
root /github/grpc-web/net/grpc/gateway/examples/echo/ts-example;
root /var/www/html;
}
}
}

0 comments on commit fd6c9c4

Please sign in to comment.