better debugger integration

This commit is contained in:
Hamidreza Asaadi 2018-10-30 10:40:01 -04:00
parent ca5d8155c4
commit f82ac40dd0
6 changed files with 35 additions and 20 deletions

1
.gitignore vendored
View file

@ -10,3 +10,4 @@ pkg/
.idea
.skaffold-*.yaml
.kubernetes-manifests-*/
**/source-context.json

View file

@ -111,10 +111,9 @@ Find **Protocol Buffers Descriptions** at the [`./pb` directory](./pb).
gcloud auth configure-docker -q
4. (OPTIONAL) Allow GCP to access source code via Github. This step is necessary
if you are using Stackdriver Debugger.
gcloud debug source gen-repo-info-file --output-directory=./src/
4. (OPTIONAL) Run `./gen-debug-source-code.sh` if you want to use debugger.
This script will generate the source context for the project and populate
it to the root directory of all service modules.
5. Set your project ID on image names:
@ -126,14 +125,13 @@ Find **Protocol Buffers Descriptions** at the [`./pb` directory](./pb).
`image:` fields with `gcr.io/[...]` and change them to your own GCP project
ID.
6. Run `./deploy.sh` from the root of this repository. This script:
- generates source context for cloud debugger
6. Run `skaffold run` from the root of this repository. This script:
- builds the container images
- pushes them to GCR
- applies the `./kubernetes-manifests` deploying the application to
Kubernetes.
7. Find the IP address of your application, then visit the application on your
7. Find the IP address of your application, then visit the application on your
browser to confirm installation.
kubectl get service frontend-external

View file

@ -1,10 +0,0 @@
#!/bin/sh
# Fist generate code context for the cloud debugger
gcloud debug source gen-repo-info-file
for module in src/*; do
cp source-context.json "$module"
done
# Now deploy on GKE
skaffold run

26
gen-debug-source-code.sh Executable file
View file

@ -0,0 +1,26 @@
#!/bin/sh
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This script generates code context for the cloud debugger agents
# and populate it to the root directory of each service module.
# This step is necessary if you want to try Cloud Debugger. Otherwise,
# you can simply ignore it.
gcloud debug source gen-repo-info-file
for MODULE in $(find ./src -maxdepth 1 -mindepth 1 -type d); do
cp source-context.json "$MODULE"
done

View file

@ -26,7 +26,8 @@ RUN GRPC_HEALTH_PROBE_VERSION=v0.2.0 && \
WORKDIR /app
COPY --from=builder /cartservice .
COPY ./source-context.json /usr/share/dotnet-debugger/agent
COPY Dockerfile ./source-context.json* /usr/share/dotnet-debugger/agent/
ENV STACKDRIVER_DEBUGGER_MODULE=cartservice
ENV STACKDRIVER_DEBUGGER_VERSION=1.0.0

View file

@ -27,8 +27,7 @@ RUN wget -O go-cloud-debug https://storage.googleapis.com/cloud-debugger/compute
&& chmod 0755 go-cloud-debug
COPY --from=builder /productcatalogservice ./server
COPY products.json .
COPY source-context.json .
COPY products.json source-context.json* ./
EXPOSE 3550
ENTRYPOINT ["./go-cloud-debug", "-sourcecontext=source-context.json", \