diff --git a/kubernetes-manifests/adservice.yaml b/kubernetes-manifests/adservice.yaml index db8b1c2..ffd19a8 100644 --- a/kubernetes-manifests/adservice.yaml +++ b/kubernetes-manifests/adservice.yaml @@ -38,10 +38,10 @@ spec: resources: requests: cpu: 250m - memory: 180Mi + memory: 256Mi limits: cpu: 500m - memory: 300Mi + memory: 512Mi --- apiVersion: v1 kind: Service diff --git a/kubernetes-manifests/cartservice.yaml b/kubernetes-manifests/cartservice.yaml index 3c2afc3..44b4615 100644 --- a/kubernetes-manifests/cartservice.yaml +++ b/kubernetes-manifests/cartservice.yaml @@ -21,6 +21,8 @@ spec: ports: - containerPort: 7070 env: + - name: ASPNETCORE_URLS + value: "http://0.0.0.0:7070" - name: REDIS_ADDR value: "redis-cart:6379" - name: SERVICE_NAME @@ -36,19 +38,26 @@ spec: resources: requests: cpu: 200m - memory: 64Mi + memory: 128Mi limits: cpu: 300m - memory: 128Mi - # readinessProbe: - # initialDelaySeconds: 15 - # exec: - # command: ["/bin/grpc_health_probe", "-addr=:7070", "-rpc-timeout=5s"] - # livenessProbe: - # initialDelaySeconds: 15 - # periodSeconds: 10 - # exec: - # command: ["/bin/grpc_health_probe", "-addr=:7070", "-rpc-timeout=5s"] + memory: 256Mi + readinessProbe: + initialDelaySeconds: 20 + periodSeconds: 10 + timeoutSeconds: 10 + successThreshold: 1 + failureThreshold: 3 + exec: + command: ["/bin/grpc_health_probe", "-addr=:7070", "-rpc-timeout=5s", "-connect-timeout=5s"] + livenessProbe: + initialDelaySeconds: 30 + periodSeconds: 30 + timeoutSeconds: 10 + successThreshold: 1 + failureThreshold: 3 + exec: + command: ["/bin/grpc_health_probe", "-addr=:7070", "-rpc-timeout=5s", "-connect-timeout=5s"] --- apiVersion: v1 kind: Service diff --git a/sbx-virtual.yaml b/sbx-virtual.yaml new file mode 100644 index 0000000..aec1ca2 --- /dev/null +++ b/sbx-virtual.yaml @@ -0,0 +1,22 @@ +name: "baseline-traffic-rec-arjun" +spec: + cluster: "arjun-docker-desktop" + ttl: + duration: 24h + description: "Recording baseline traffic for microservices demo app" + virtual: + - name: "checkout" + workload: + kind: Deployment + namespace: "default" + name: "checkoutservice" + - name: "cart" + workload: + kind: Deployment + namespace: "default" + name: "cartservice" + - name: "catalog" + workload: + kind: Deployment + namespace: "default" + name: "productcatalogservice" diff --git a/skaffold.yaml b/skaffold.yaml index 195f062..f939543 100644 --- a/skaffold.yaml +++ b/skaffold.yaml @@ -31,7 +31,7 @@ build: tagPolicy: gitCommit: {} local: - useBuildkit: false + useBuildkit: true deploy: kubectl: manifests: diff --git a/src/adservice/Dockerfile b/src/adservice/Dockerfile index 57fd7f6..f4aff15 100644 --- a/src/adservice/Dockerfile +++ b/src/adservice/Dockerfile @@ -1,4 +1,4 @@ -FROM openjdk:11-slim as builder +FROM eclipse-temurin:11-jdk as builder WORKDIR /app @@ -11,7 +11,7 @@ COPY . . RUN chmod +x gradlew RUN ./gradlew installDist -FROM openjdk:11-slim +FROM eclipse-temurin:11-jre RUN apt-get -y update && apt-get install -qqy \ wget \ diff --git a/src/cartservice/Dockerfile b/src/cartservice/Dockerfile index 59bbbcc..11ffb14 100644 --- a/src/cartservice/Dockerfile +++ b/src/cartservice/Dockerfile @@ -1,19 +1,22 @@ # https://mcr.microsoft.com/v2/dotnet/sdk/tags/list -FROM mcr.microsoft.com/dotnet/sdk:5.0.103 as builder +FROM --platform=linux/amd64 mcr.microsoft.com/dotnet/sdk:5.0.103 as builder WORKDIR /app COPY cartservice.csproj . RUN dotnet restore cartservice.csproj -r linux-musl-x64 COPY . . # Fix the issue on Debian 10: https://github.com/dotnet/dotnet-docker/issues/2470 ENV COMPlus_EnableDiagnostics=0 +# Fix for Google.Protobuf.Tools detection in Docker +ENV PROTOBUF_TOOLS_OS=linux +ENV PROTOBUF_TOOLS_CPU=x64 RUN dotnet publish cartservice.csproj -p:PublishSingleFile=true -r linux-musl-x64 --self-contained true -p:PublishTrimmed=True -p:TrimMode=Link -c release -o /cartservice --no-restore # https://mcr.microsoft.com/v2/dotnet/runtime-deps/tags/list -FROM mcr.microsoft.com/dotnet/runtime-deps:5.0.3-alpine3.12-amd64 +FROM --platform=linux/amd64 mcr.microsoft.com/dotnet/runtime-deps:5.0.3-alpine3.12-amd64 RUN GRPC_HEALTH_PROBE_VERSION=v0.3.6 && \ 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 WORKDIR /app COPY --from=builder /cartservice . -ENV ASPNETCORE_URLS http://*:7070 +ENV ASPNETCORE_URLS http://0.0.0.0:7070 ENTRYPOINT ["/app/cartservice"] diff --git a/src/checkoutservice/Dockerfile b/src/checkoutservice/Dockerfile index b4f335e..66c8455 100644 --- a/src/checkoutservice/Dockerfile +++ b/src/checkoutservice/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.17-alpine as builder +FROM --platform=linux/amd64 golang:1.17-alpine as builder RUN apk add --no-cache ca-certificates git WORKDIR /src @@ -9,7 +9,7 @@ RUN go mod download COPY . . RUN go build -gcflags='-N -l' -o /checkoutservice . -FROM alpine as release +FROM --platform=linux/amd64 alpine as release RUN apk add --no-cache ca-certificates RUN GRPC_HEALTH_PROBE_VERSION=v0.3.6 && \ 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 && \ diff --git a/src/currencyservice/Dockerfile b/src/currencyservice/Dockerfile index a152314..3e0d357 100644 --- a/src/currencyservice/Dockerfile +++ b/src/currencyservice/Dockerfile @@ -1,4 +1,4 @@ -FROM node:12-alpine as base +FROM --platform=linux/amd64 node:12-alpine as base FROM base as builder diff --git a/src/emailservice/Dockerfile b/src/emailservice/Dockerfile index 9dfb63c..2c76b19 100644 --- a/src/emailservice/Dockerfile +++ b/src/emailservice/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.7-slim as base +FROM --platform=linux/amd64 python:3.7-slim as base FROM base as builder diff --git a/src/frontend/Dockerfile b/src/frontend/Dockerfile index 5421dd3..6aa8704 100644 --- a/src/frontend/Dockerfile +++ b/src/frontend/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.17-alpine as builder +FROM --platform=linux/amd64 golang:1.17-alpine as builder RUN apk add --no-cache ca-certificates git WORKDIR /src @@ -8,7 +8,7 @@ RUN go mod download COPY . . RUN go build -o /go/bin/frontend . -FROM alpine as release +FROM --platform=linux/amd64 alpine as release RUN apk add --no-cache ca-certificates \ busybox-extras net-tools bind-tools WORKDIR /frontend diff --git a/src/loadgenerator/Dockerfile b/src/loadgenerator/Dockerfile index d15565b..194f3d0 100644 --- a/src/loadgenerator/Dockerfile +++ b/src/loadgenerator/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.8-slim as base +FROM --platform=linux/amd64 python:3.8-slim as base FROM base as builder diff --git a/src/paymentservice/Dockerfile b/src/paymentservice/Dockerfile index 5222f83..69b7d0f 100644 --- a/src/paymentservice/Dockerfile +++ b/src/paymentservice/Dockerfile @@ -1,4 +1,4 @@ -FROM node:12-alpine as base +FROM --platform=linux/amd64 node:12-alpine as base FROM base as builder diff --git a/src/productcatalogservice/Dockerfile b/src/productcatalogservice/Dockerfile index 6e50e53..04f7909 100644 --- a/src/productcatalogservice/Dockerfile +++ b/src/productcatalogservice/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.17-alpine AS builder +FROM --platform=linux/amd64 golang:1.17-alpine AS builder RUN apk add --no-cache ca-certificates git WORKDIR /src @@ -8,7 +8,7 @@ RUN go mod download COPY . . RUN go build -o /productcatalogservice . -FROM alpine AS release +FROM --platform=linux/amd64 alpine AS release RUN apk add --no-cache ca-certificates RUN GRPC_HEALTH_PROBE_VERSION=v0.3.6 && \ 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 && \ diff --git a/src/recommendationservice/Dockerfile b/src/recommendationservice/Dockerfile index 95b9585..64fc669 100644 --- a/src/recommendationservice/Dockerfile +++ b/src/recommendationservice/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.7-slim +FROM --platform=linux/amd64 python:3.7-slim RUN apt-get update -qqy && \ apt-get -qqy install wget g++ && \ rm -rf /var/lib/apt/lists/* diff --git a/src/shippingservice/Dockerfile b/src/shippingservice/Dockerfile index 0c665ea..1eb5a25 100644 --- a/src/shippingservice/Dockerfile +++ b/src/shippingservice/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.17-alpine as builder +FROM --platform=linux/amd64 golang:1.17-alpine as builder RUN apk add --no-cache ca-certificates git WORKDIR /src @@ -9,7 +9,7 @@ COPY . . RUN go mod tidy RUN go build -o /go/bin/shippingservice -FROM alpine as release +FROM --platform=linux/amd64 alpine as release RUN apk add --no-cache ca-certificates RUN GRPC_HEALTH_PROBE_VERSION=v0.3.5 && \ 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 && \