diff --git a/.gitignore b/.gitignore index 2952864..5fdb381 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ pkg/ .idea .skaffold-*.yaml .kubernetes-manifests-*/ +**/source-context.json diff --git a/README.md b/README.md index bdc5f7e..9cd4bbf 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/depoly.sh b/depoly.sh deleted file mode 100755 index e99589b..0000000 --- a/depoly.sh +++ /dev/null @@ -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 diff --git a/gen-debug-source-code.sh b/gen-debug-source-code.sh new file mode 100755 index 0000000..6088a93 --- /dev/null +++ b/gen-debug-source-code.sh @@ -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 \ No newline at end of file diff --git a/src/cartservice/Dockerfile b/src/cartservice/Dockerfile index 031b19b..d846ced 100644 --- a/src/cartservice/Dockerfile +++ b/src/cartservice/Dockerfile @@ -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 diff --git a/src/productcatalogservice/Dockerfile b/src/productcatalogservice/Dockerfile index 558151c..8905a82 100644 --- a/src/productcatalogservice/Dockerfile +++ b/src/productcatalogservice/Dockerfile @@ -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", \