new agents integrated + deploy.sh added
This commit is contained in:
parent
2ee9f8a10b
commit
ca5d8155c4
6 changed files with 42 additions and 13 deletions
|
@ -126,7 +126,8 @@ Find **Protocol Buffers Descriptions** at the [`./pb` directory](./pb).
|
||||||
`image:` fields with `gcr.io/[...]` and change them to your own GCP project
|
`image:` fields with `gcr.io/[...]` and change them to your own GCP project
|
||||||
ID.
|
ID.
|
||||||
|
|
||||||
6. Run `skaffold run` from the root of this repository. This command:
|
6. Run `./deploy.sh` from the root of this repository. This script:
|
||||||
|
- generates source context for cloud debugger
|
||||||
- builds the container images
|
- builds the container images
|
||||||
- pushes them to GCR
|
- pushes them to GCR
|
||||||
- applies the `./kubernetes-manifests` deploying the application to
|
- applies the `./kubernetes-manifests` deploying the application to
|
||||||
|
|
10
depoly.sh
Executable file
10
depoly.sh
Executable file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/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
|
|
@ -11,10 +11,19 @@ RUN ./gradlew installDist
|
||||||
|
|
||||||
FROM openjdk:8-alpine
|
FROM openjdk:8-alpine
|
||||||
|
|
||||||
|
RUN apk add --update --no-cache \
|
||||||
|
gcc \
|
||||||
|
linux-headers \
|
||||||
|
libc6-compat
|
||||||
|
|
||||||
RUN GRPC_HEALTH_PROBE_VERSION=v0.2.0 && \
|
RUN GRPC_HEALTH_PROBE_VERSION=v0.2.0 && \
|
||||||
wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \
|
wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \
|
||||||
chmod +x /bin/grpc_health_probe
|
chmod +x /bin/grpc_health_probe
|
||||||
|
|
||||||
|
RUN mkdir -p /opt/cdbg
|
||||||
|
RUN wget -qO- https://storage.googleapis.com/cloud-debugger/compute-java/debian-wheezy/cdbg_java_agent_gce.tar.gz | \
|
||||||
|
tar xvz -C /opt/cdbg
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=builder /app .
|
COPY --from=builder /app .
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,11 @@ task adService(type: CreateStartScripts) {
|
||||||
outputDir = new File(project.buildDir, 'tmp')
|
outputDir = new File(project.buildDir, 'tmp')
|
||||||
classpath = jar.outputs.files + project.configurations.runtime
|
classpath = jar.outputs.files + project.configurations.runtime
|
||||||
defaultJvmOpts =
|
defaultJvmOpts =
|
||||||
["-Dlog4j2.contextDataInjector=io.opencensus.contrib.logcorrelation.log4j2.OpenCensusTraceContextDataInjector"]
|
["-Dlog4j2.contextDataInjector=io.opencensus.contrib.logcorrelation.log4j2.OpenCensusTraceContextDataInjector",
|
||||||
|
"-agentpath:/opt/cdbg/cdbg_java_agent.so",
|
||||||
|
"-Dcom.google.cdbg.module=adservice",
|
||||||
|
"-Dcom.google.cdbg.version=1.0.0"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
task adServiceClient(type: CreateStartScripts) {
|
task adServiceClient(type: CreateStartScripts) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
FROM golang:1.10-alpine AS builder
|
FROM golang:1.10-alpine AS builder
|
||||||
RUN apk add --no-cache ca-certificates git && \
|
RUN apk add --no-cache ca-certificates git gcc g++ && \
|
||||||
wget -qO/go/bin/dep https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64 && \
|
wget -qO/go/bin/dep https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64 && \
|
||||||
chmod +x /go/bin/dep
|
chmod +x /go/bin/dep
|
||||||
|
|
||||||
|
@ -11,16 +11,27 @@ COPY Gopkg.* ./
|
||||||
RUN dep ensure --vendor-only -v
|
RUN dep ensure --vendor-only -v
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN go build -o /productcatalogservice .
|
RUN go build -gcflags=all='-N -l' -o /productcatalogservice .
|
||||||
|
|
||||||
FROM alpine AS release
|
FROM alpine AS release
|
||||||
RUN apk add --no-cache ca-certificates
|
RUN apk add --no-cache ca-certificates \
|
||||||
|
libc6-compat
|
||||||
|
|
||||||
RUN GRPC_HEALTH_PROBE_VERSION=v0.2.0 && \
|
RUN GRPC_HEALTH_PROBE_VERSION=v0.2.0 && \
|
||||||
wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \
|
wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \
|
||||||
chmod +x /bin/grpc_health_probe
|
chmod +x /bin/grpc_health_probe
|
||||||
|
|
||||||
WORKDIR /productcatalogservice
|
WORKDIR /productcatalogservice
|
||||||
|
|
||||||
|
RUN wget -O go-cloud-debug https://storage.googleapis.com/cloud-debugger/compute-go/go-cloud-debug \
|
||||||
|
&& chmod 0755 go-cloud-debug
|
||||||
|
|
||||||
COPY --from=builder /productcatalogservice ./server
|
COPY --from=builder /productcatalogservice ./server
|
||||||
COPY products.json .
|
COPY products.json .
|
||||||
EXPOSE 3550
|
COPY source-context.json .
|
||||||
ENTRYPOINT ["/productcatalogservice/server"]
|
|
||||||
|
EXPOSE 3550
|
||||||
|
ENTRYPOINT ["./go-cloud-debug", "-sourcecontext=source-context.json", \
|
||||||
|
"-appmodule=productcatalogservice", "-appversion=1.0.0" , \
|
||||||
|
"--", "/productcatalogservice/server"]
|
||||||
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"git": {
|
|
||||||
"revisionId": "1fe7f8dcec94e4c90a2ce8c3c9652eb38152bb46",
|
|
||||||
"url": "git@github.com:hrasadi/microservices-demo.git"
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue