10000 [endpoints] Update protoc commands to match documentation. by kryzthov · Pull Request #1188 · GoogleCloudPlatform/python-docs-samples · GitHub
[go: up one dir, main page]

Skip to content

[endpoints] Update protoc commands to match documentation. #1188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions endpoints/bookstore-grpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,14 @@ code in the sample distribution. To modify the sample or create your own gRPC
API definition, you'll need to update the generated code. To do this, once the
gRPC libraries and tools are installed, run:

python -m grpc.tools.protoc --python_out=generated_pb2 \
--grpc_python_out=generated_pb2 --proto_path=. bookstore.proto
python -m grpc.tools.protoc \
--include_imports \
--include_source_info \
--proto_path=. \
--python_out=generated_pb2 \
--grpc_python_out=generated_pb2 \
--descriptor_set_out=api_descriptor.pb \
bookstore.proto

## Running the server with gRPC <-> HTTP/JSON Transcoding

Expand Down
29 changes: 15 additions & 14 deletions endpoints/getting-started-grpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,22 @@ Cloud account and [SDK](https://cloud.google.com/sdk/) configured.
just wish to regenerate these files, run:

```bash
python -m grpc_tools.protoc -I protos --python_out=. --grpc_python_out=. protos/helloworld.proto
```

1. Generate the `out.pb` from the proto file:

```bash
python -m grpc_tools.protoc --include_imports --include_source_info -I protos protos/helloworld.proto --descriptor_set_out out.pb
python -m grpc.tools.protoc \
--include_imports \
--include_source_info \
--proto_path=protos \
--python_out=. \
--grpc_python_out=. \
--descriptor_set_out=api_descriptor.pb \
helloworld.proto
```

1. Edit, `api_config.yaml`. Replace `MY_PROJECT_ID` with your project id.

1. Deploy your service config to Service Management:

```bash
gcloud endpoints services deploy out.pb api_config.yaml
gcloud endpoints services deploy api_descriptor.pb api_config.yaml
# The Config ID should be printed out, looks like: 2017-02-01r0, remember this

# Set your project ID as a variable to make commands easier:
Expand Down Expand Up @@ -97,20 +98,20 @@ Cloud account and [SDK](https://cloud.google.com/sdk/) configured.

```bash
/usr/share/google/dockercfg_update.sh
docker run -d --name=grpc-hello gcr.io/${GCLOUD_PROJECT}/python-grpc-hello:1.0
docker run --detach --name=grpc-hello gcr.io/${GCLOUD_PROJECT}/python-grpc-hello:1.0
```

1. Run the Endpoints proxy:

```bash
docker run --detach --name=esp \
-p 80:9000 \
--publish=80:9000 \
--link=grpc-hello:grpc-hello \
gcr.io/endpoints-release/endpoints-runtime:1 \
-s ${SERVICE_NAME} \
-v ${SERVICE_CONFIG_ID} \
-P 9000 \
-a grpc://grpc-hello:50051
--service=${SERVICE_NAME} \
--version=${SERVICE_CONFIG_ID} \
--http2_port=9000 \
--backend=grpc://grpc-hello:50051
```

1. Back on your local machine, get the external IP of your GCE instance:
Expand Down
8 changes: 4 additions & 4 deletions endpoints/getting-started-grpc/container-engine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ spec:
- name: esp
image: gcr.io/endpoints-release/endpoints-runtime:1
args: [
"-P", "9000",
"-a", "grpc://127.0.0.1:50051",
"-s", "SERVICE_NAME",
"-v", "SERVICE_CONFIG_ID",
"--http2_port=9000",
"--backend=grpc://127.0.0.1:50051",
"--service=SERVICE_NAME",
"--version=SERVICE_CONFIG_ID",
]
ports:
- containerPort: 9000
Expand Down
182 changes: 32 additions & 150 deletions endpoints/getting-started-grpc/helloworld_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions endpoints/getting-started-grpc/helloworld_pb2_grpc.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from grpc.framework.common import cardinality
from grpc.framework.interfaces.face import utilities as face_utilities

import helloworld_pb2 as helloworld__pb2

Expand Down
8 changes: 4 additions & 4 deletions endpoints/getting-started/container-engine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ spec:
- name: esp
image: gcr.io/endpoints-release/endpoints-runtime:1
args: [
"-p", "8081",
"-a", "127.0.0.1:8080",
"-s", "SERVICE_NAME",
"-v", "SERVICE_CONFIG_ID",
"--http_port=8081",
"--backend=127.0.0.1:8080",
"--service=SERVICE_NAME",
"--version=SERVICE_CONFIG_ID",
]
# [END esp]
ports:
Expand Down
8 changes: 4 additions & 4 deletions endpoints/kubernetes/grpc-bookstore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ spec:
- name: esp
image: gcr.io/endpoints-release/endpoints-runtime:1
args: [
"-P", "9000",
"-s", "SERVICE_NAME",
"-v", "SERVICE_CONFIG_ID",
"-a", "grpc://127.0.0.1:8000"
"--http2_port=9000",
"--service=SERVICE_NAME",
"--version=SERVICE_CONFIG_ID",
"--backend=grpc://127.0.0.1:8000"
]
ports:
- containerPort: 9000
Expand Down
0