debugger support for cart and email service
This commit is contained in:
parent
1e47ee393a
commit
4c79bdad8b
8 changed files with 82 additions and 52 deletions
|
@ -1,28 +1,35 @@
|
||||||
FROM microsoft/dotnet:2.1-sdk-alpine as builder
|
FROM gcr.io/dotnet-debugger/aspnetcore:2.1 as builder
|
||||||
|
ENV d = 1
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN dotnet restore && \
|
RUN dotnet restore && \
|
||||||
dotnet build && \
|
dotnet build && \
|
||||||
dotnet publish -c release -r linux-musl-x64 -o /cartservice
|
dotnet publish -c debug -o /cartservice
|
||||||
|
|
||||||
# cartservice
|
# cartservice
|
||||||
FROM alpine:3.8
|
FROM gcr.io/dotnet-debugger/aspnetcore:2.1
|
||||||
|
|
||||||
|
# Dependencies for runtime
|
||||||
|
# busybox-extras => telnet
|
||||||
|
RUN apt-get install -q -y --no-install-recommends \
|
||||||
|
busybox \
|
||||||
|
libc6 \
|
||||||
|
libunwind-dev \
|
||||||
|
libuuid1 \
|
||||||
|
libgcc1 \
|
||||||
|
icu-devtools \
|
||||||
|
musl-dev \
|
||||||
|
wget
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
# Dependencies for runtime
|
|
||||||
# busybox-extras => telnet
|
|
||||||
RUN apk add --no-cache \
|
|
||||||
busybox-extras \
|
|
||||||
libc6-compat \
|
|
||||||
libunwind \
|
|
||||||
libuuid \
|
|
||||||
libgcc \
|
|
||||||
libstdc++ \
|
|
||||||
libintl \
|
|
||||||
icu
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=builder /cartservice .
|
COPY --from=builder /cartservice .
|
||||||
ENTRYPOINT ["./cartservice", "start"]
|
COPY ./source-context.json /usr/share/dotnet-debugger/agent
|
||||||
|
|
||||||
|
ENV STACKDRIVER_DEBUGGER_MODULE=cartservice
|
||||||
|
ENV STACKDRIVER_DEBUGGER_VERSION=1.0.0
|
||||||
|
|
||||||
|
ENTRYPOINT ["/usr/share/dotnet-debugger/start-debugger.sh", "dotnet", "cartservice.dll", "start"]
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||||
|
<DebugType>portable</DebugType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
6
src/cartservice/source-context.json
Normal file
6
src/cartservice/source-context.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"git": {
|
||||||
|
"revisionId": "1fe7f8dcec94e4c90a2ce8c3c9652eb38152bb46",
|
||||||
|
"url": "git@github.com:hrasadi/microservices-demo.git"
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,45 +1,45 @@
|
||||||
FROM python:3-alpine as base
|
FROM debian:stretch as base
|
||||||
|
ENV d = 1
|
||||||
FROM base as builder
|
|
||||||
|
|
||||||
# gRPC and app deps
|
# gRPC and app deps
|
||||||
RUN apk add --update --no-cache \
|
RUN apt-get update
|
||||||
gcc \
|
|
||||||
linux-headers \
|
RUN apt-get install -q -y --no-install-recommends \
|
||||||
make \
|
git cmake curl \
|
||||||
musl-dev \
|
python-dev python-setuptools python-pip \
|
||||||
python-dev \
|
build-essential zlib1g-dev libbz2-dev \
|
||||||
g++ \
|
libreadline-dev libsqlite3-dev wget curl \
|
||||||
# App Deps
|
llvm libncurses5-dev libncursesw5-dev \
|
||||||
cairo-dev \
|
xz-utils tk-dev libffi-dev \
|
||||||
cairo \
|
libssl-dev musl-dev libgirepository1.0-dev libcairo-dev
|
||||||
openssl-dev \
|
|
||||||
gobject-introspection-dev
|
# Python
|
||||||
|
ENV PYENV_SHA256 df9449f69918c716e688d4216eb4398d2cd6d2dcd0f7e6f56d55d19d74cc57cc
|
||||||
|
RUN curl -L https://github.com/pyenv/pyenv/archive/v1.2.6.tar.gz -o pyenv.tar.gz
|
||||||
|
RUN echo $PYENV_SHA256 pyenv.tar.gz | sha256sum -c
|
||||||
|
RUN tar zxvf pyenv.tar.gz
|
||||||
|
RUN mv pyenv-* pyenv
|
||||||
|
RUN pyenv/plugins/python-build/install.sh
|
||||||
|
RUN python-build 3.7.0 /usr/local/
|
||||||
|
RUN rm /usr/local/bin/python
|
||||||
|
|
||||||
# get packages
|
# get packages
|
||||||
|
RUN pip install --upgrade pip
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
RUN pip install -r requirements.txt
|
RUN pip install -r requirements.txt
|
||||||
|
|
||||||
FROM base as final
|
|
||||||
|
|
||||||
# Enable unbuffered logging
|
|
||||||
ENV PYTHONUNBUFFERED=1
|
|
||||||
|
|
||||||
# Download the grpc health probe
|
# Download the grpc health probe
|
||||||
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
|
||||||
|
|
||||||
|
# Enable unbuffered logging
|
||||||
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
WORKDIR /email_server
|
WORKDIR /email_server
|
||||||
|
|
||||||
# Grab packages from builder
|
|
||||||
COPY --from=builder /usr/local/lib/python3.7/ /usr/local/lib/python3.7/
|
|
||||||
|
|
||||||
# Need libstdc++ for grpc
|
|
||||||
RUN apk add --no-cache libstdc++
|
|
||||||
|
|
||||||
# Add the application
|
# Add the application
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
ENTRYPOINT [ "python", "email_server.py" ]
|
ENTRYPOINT [ "python3", "email_server.py" ]
|
||||||
|
|
|
@ -23,6 +23,9 @@ import grpc
|
||||||
from jinja2 import Environment, FileSystemLoader, select_autoescape, TemplateError
|
from jinja2 import Environment, FileSystemLoader, select_autoescape, TemplateError
|
||||||
from google.api_core.exceptions import GoogleAPICallError
|
from google.api_core.exceptions import GoogleAPICallError
|
||||||
|
|
||||||
|
import googleclouddebugger
|
||||||
|
import traceback
|
||||||
|
|
||||||
import demo_pb2
|
import demo_pb2
|
||||||
import demo_pb2_grpc
|
import demo_pb2_grpc
|
||||||
from grpc_health.v1 import health_pb2
|
from grpc_health.v1 import health_pb2
|
||||||
|
@ -33,8 +36,6 @@ from grpc_health.v1 import health_pb2_grpc
|
||||||
# from opencensus.trace.exporters import stackdriver_exporter
|
# from opencensus.trace.exporters import stackdriver_exporter
|
||||||
# from opencensus.trace.exporters import print_exporter
|
# from opencensus.trace.exporters import print_exporter
|
||||||
|
|
||||||
# import googleclouddebugger
|
|
||||||
|
|
||||||
# try:
|
# try:
|
||||||
# sampler = always_on.AlwaysOnSampler()
|
# sampler = always_on.AlwaysOnSampler()
|
||||||
# exporter = stackdriver_exporter.StackdriverExporter()
|
# exporter = stackdriver_exporter.StackdriverExporter()
|
||||||
|
@ -42,14 +43,6 @@ from grpc_health.v1 import health_pb2_grpc
|
||||||
# except:
|
# except:
|
||||||
# tracer_interceptor = server_interceptor.OpenCensusServerInterceptor()
|
# tracer_interceptor = server_interceptor.OpenCensusServerInterceptor()
|
||||||
|
|
||||||
# try:
|
|
||||||
# googleclouddebugger.enable(
|
|
||||||
# module='emailserver',
|
|
||||||
# version='1.0.0'
|
|
||||||
# )
|
|
||||||
# except:
|
|
||||||
# pass
|
|
||||||
|
|
||||||
from logger import getJSONLogger
|
from logger import getJSONLogger
|
||||||
logger = getJSONLogger('emailservice-server')
|
logger = getJSONLogger('emailservice-server')
|
||||||
|
|
||||||
|
@ -145,5 +138,15 @@ def start(dummy_mode):
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
try:
|
||||||
|
googleclouddebugger.enable(
|
||||||
|
module='emailserver',
|
||||||
|
version='1.0.0'
|
||||||
|
)
|
||||||
|
except:
|
||||||
|
logger.error("could not enable debugger")
|
||||||
|
logger.error(traceback.print_exc())
|
||||||
|
pass
|
||||||
|
|
||||||
logger.info('starting the email service in dummy mode.')
|
logger.info('starting the email service in dummy mode.')
|
||||||
start(dummy_mode = True)
|
start(dummy_mode = True)
|
||||||
|
|
|
@ -12,6 +12,7 @@ google-api-core==1.4.0
|
||||||
google-auth==1.5.1
|
google-auth==1.5.1
|
||||||
google-cloud-core==0.28.1
|
google-cloud-core==0.28.1
|
||||||
google-cloud-trace==0.19.0
|
google-cloud-trace==0.19.0
|
||||||
|
google-python-cloud-debugger==2.9
|
||||||
googleapis-common-protos==1.5.3
|
googleapis-common-protos==1.5.3
|
||||||
grpc-google-iam-v1==0.11.4
|
grpc-google-iam-v1==0.11.4
|
||||||
grpcio==1.12.1
|
grpcio==1.12.1
|
||||||
|
|
6
src/emailservice/source-context.json
Normal file
6
src/emailservice/source-context.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"git": {
|
||||||
|
"revisionId": "1fe7f8dcec94e4c90a2ce8c3c9652eb38152bb46",
|
||||||
|
"url": "git@github.com:hrasadi/microservices-demo.git"
|
||||||
|
}
|
||||||
|
}
|
6
src/recommendationservice/source-context.json
Normal file
6
src/recommendationservice/source-context.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"git": {
|
||||||
|
"revisionId": "1fe7f8dcec94e4c90a2ce8c3c9652eb38152bb46",
|
||||||
|
"url": "git@github.com:hrasadi/microservices-demo.git"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue