Merge branch 'master' of https://github.com/GoogleCloudPlatform/microservices-demo into hipster-shop-master
Conflicts: src/loadgenerator/loadgen.sh
This commit is contained in:
commit
0cbbc55c4a
12 changed files with 59 additions and 72 deletions
|
@ -50,12 +50,12 @@ spec:
|
|||
readinessProbe:
|
||||
initialDelaySeconds: 15
|
||||
exec:
|
||||
command: ["/bin/grpc_health_probe", "-addr=:7070"]
|
||||
command: ["/bin/grpc_health_probe", "-addr=:7070", "-rpc-timeout=5s"]
|
||||
livenessProbe:
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 10
|
||||
exec:
|
||||
command: ["/bin/grpc_health_probe", "-addr=:7070"]
|
||||
command: ["/bin/grpc_health_probe", "-addr=:7070", "-rpc-timeout=5s"]
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
|
|
|
@ -32,7 +32,7 @@ spec:
|
|||
terminationGracePeriodSeconds: 5
|
||||
containers:
|
||||
- name: server
|
||||
image: gcr.io/google-samples/microservices-demo/emailservice:v0.1.1
|
||||
image: gcr.io/google-samples/microservices-demo/emailservice:v0.1.2
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
env:
|
||||
|
@ -85,7 +85,7 @@ spec:
|
|||
spec:
|
||||
containers:
|
||||
- name: server
|
||||
image: gcr.io/google-samples/microservices-demo/checkoutservice:v0.1.1
|
||||
image: gcr.io/google-samples/microservices-demo/checkoutservice:v0.1.2
|
||||
ports:
|
||||
- containerPort: 5050
|
||||
readinessProbe:
|
||||
|
@ -148,7 +148,7 @@ spec:
|
|||
terminationGracePeriodSeconds: 5
|
||||
containers:
|
||||
- name: server
|
||||
image: gcr.io/google-samples/microservices-demo/recommendationservice:v0.1.1
|
||||
image: gcr.io/google-samples/microservices-demo/recommendationservice:v0.1.2
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
readinessProbe:
|
||||
|
@ -202,7 +202,7 @@ spec:
|
|||
spec:
|
||||
containers:
|
||||
- name: server
|
||||
image: gcr.io/google-samples/microservices-demo/frontend:v0.1.1
|
||||
image: gcr.io/google-samples/microservices-demo/frontend:v0.1.2
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
readinessProbe:
|
||||
|
@ -290,7 +290,7 @@ spec:
|
|||
terminationGracePeriodSeconds: 5
|
||||
containers:
|
||||
- name: server
|
||||
image: gcr.io/google-samples/microservices-demo/paymentservice:v0.1.1
|
||||
image: gcr.io/google-samples/microservices-demo/paymentservice:v0.1.2
|
||||
ports:
|
||||
- containerPort: 50051
|
||||
env:
|
||||
|
@ -339,7 +339,7 @@ spec:
|
|||
terminationGracePeriodSeconds: 5
|
||||
containers:
|
||||
- name: server
|
||||
image: gcr.io/google-samples/microservices-demo/productcatalogservice:v0.1.1
|
||||
image: gcr.io/google-samples/microservices-demo/productcatalogservice:v0.1.2
|
||||
ports:
|
||||
- containerPort: 3550
|
||||
env:
|
||||
|
@ -391,7 +391,7 @@ spec:
|
|||
terminationGracePeriodSeconds: 5
|
||||
containers:
|
||||
- name: server
|
||||
image: gcr.io/google-samples/microservices-demo/cartservice:v0.1.1
|
||||
image: gcr.io/google-samples/microservices-demo/cartservice:v0.1.2
|
||||
ports:
|
||||
- containerPort: 7070
|
||||
env:
|
||||
|
@ -411,12 +411,12 @@ spec:
|
|||
readinessProbe:
|
||||
initialDelaySeconds: 15
|
||||
exec:
|
||||
command: ["/bin/grpc_health_probe", "-addr=:7070"]
|
||||
command: ["/bin/grpc_health_probe", "-addr=:7070", "-rpc-timeout=5s"]
|
||||
livenessProbe:
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 10
|
||||
exec:
|
||||
command: ["/bin/grpc_health_probe", "-addr=:7070"]
|
||||
command: ["/bin/grpc_health_probe", "-addr=:7070", "-rpc-timeout=5s"]
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
|
@ -450,9 +450,9 @@ spec:
|
|||
initContainers:
|
||||
- name: wait-frontend
|
||||
image: alpine:3.6
|
||||
command: ['sh', '-c', 'set -x; apk add --no-cache curl &&
|
||||
until timeout -t 2 curl -f "http://${FRONTEND_ADDR}"; do
|
||||
echo "waiting for http://${FRONTEND_ADDR}";
|
||||
command: ['sh', '-c', 'set -x; apk add --no-cache curl &&
|
||||
until timeout -t 2 curl -f "http://${FRONTEND_ADDR}"; do
|
||||
echo "waiting for http://${FRONTEND_ADDR}";
|
||||
sleep 2;
|
||||
done;']
|
||||
env:
|
||||
|
@ -460,7 +460,7 @@ spec:
|
|||
value: "frontend:80"
|
||||
containers:
|
||||
- name: main
|
||||
image: gcr.io/google-samples/microservices-demo/loadgenerator:v0.1.1
|
||||
image: gcr.io/google-samples/microservices-demo/loadgenerator:v0.1.2
|
||||
env:
|
||||
- name: FRONTEND_ADDR
|
||||
value: "frontend:80"
|
||||
|
@ -490,7 +490,7 @@ spec:
|
|||
terminationGracePeriodSeconds: 5
|
||||
containers:
|
||||
- name: server
|
||||
image: gcr.io/google-samples/microservices-demo/currencyservice:v0.1.1
|
||||
image: gcr.io/google-samples/microservices-demo/currencyservice:v0.1.2
|
||||
ports:
|
||||
- name: grpc
|
||||
containerPort: 7000
|
||||
|
@ -539,7 +539,7 @@ spec:
|
|||
spec:
|
||||
containers:
|
||||
- name: server
|
||||
image: gcr.io/google-samples/microservices-demo/shippingservice:v0.1.1
|
||||
image: gcr.io/google-samples/microservices-demo/shippingservice:v0.1.2
|
||||
ports:
|
||||
- containerPort: 50051
|
||||
env:
|
||||
|
@ -645,7 +645,7 @@ spec:
|
|||
terminationGracePeriodSeconds: 5
|
||||
containers:
|
||||
- name: server
|
||||
image: gcr.io/google-samples/microservices-demo/adservice:v0.1.1
|
||||
image: gcr.io/google-samples/microservices-demo/adservice:v0.1.2
|
||||
ports:
|
||||
- containerPort: 9555
|
||||
env:
|
||||
|
@ -683,4 +683,4 @@ spec:
|
|||
- name: grpc
|
||||
port: 9555
|
||||
targetPort: 9555
|
||||
---
|
||||
---
|
||||
|
|
|
@ -15,7 +15,6 @@ namespace cartservice {
|
|||
|
||||
public override Task<HealthCheckResponse> Check(HealthCheckRequest request, ServerCallContext context){
|
||||
Console.WriteLine ("Checking CartService Health");
|
||||
|
||||
return Task.FromResult(new HealthCheckResponse {
|
||||
Status = dependency.Ping() ? HealthCheckResponse.Types.ServingStatus.Serving : HealthCheckResponse.Types.ServingStatus.NotServing
|
||||
});
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<PackageReference Include="grpc.tools" Version="1.12.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.1" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="1.2.6" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.0.601" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -45,13 +45,13 @@ namespace cartservice.cartstore
|
|||
var cart = new Hipstershop.Cart();
|
||||
emptyCartBytes = cart.ToByteArray();
|
||||
connectionString = $"{redisAddress},ssl=false,allowAdmin=true,connectRetry=5";
|
||||
|
||||
|
||||
redisConnectionOptions = ConfigurationOptions.Parse(connectionString);
|
||||
|
||||
// Try to reconnect if first retry failed (up to 5 times with exponential backoff)
|
||||
redisConnectionOptions.ConnectRetry = REDIS_RETRY_NUM;
|
||||
redisConnectionOptions.ReconnectRetryPolicy = new ExponentialRetry(100);
|
||||
|
||||
|
||||
redisConnectionOptions.KeepAlive = 180;
|
||||
}
|
||||
|
||||
|
@ -78,11 +78,11 @@ namespace cartservice.cartstore
|
|||
|
||||
Console.WriteLine("Connecting to Redis: " + connectionString);
|
||||
redis = ConnectionMultiplexer.Connect(redisConnectionOptions);
|
||||
|
||||
|
||||
if (redis == null || !redis.IsConnected)
|
||||
{
|
||||
Console.WriteLine("Wasn't able to connect to redis");
|
||||
|
||||
|
||||
// We weren't able to connect to redis despite 5 retries with exponential backoff
|
||||
throw new ApplicationException("Wasn't able to connect to redis");
|
||||
}
|
||||
|
@ -96,14 +96,14 @@ namespace cartservice.cartstore
|
|||
Console.WriteLine($"Small test result: {res}");
|
||||
|
||||
redis.InternalError += (o, e) => { Console.WriteLine(e.Exception); };
|
||||
redis.ConnectionRestored += (o, e) =>
|
||||
redis.ConnectionRestored += (o, e) =>
|
||||
{
|
||||
isRedisConnectionOpened = true;
|
||||
Console.WriteLine("Connection to redis was retored successfully");
|
||||
Console.WriteLine("Connection to redis was retored successfully");
|
||||
};
|
||||
redis.ConnectionFailed += (o, e) =>
|
||||
redis.ConnectionFailed += (o, e) =>
|
||||
{
|
||||
Console.WriteLine("Connection failed. Disposing the object");
|
||||
Console.WriteLine("Connection failed. Disposing the object");
|
||||
isRedisConnectionOpened = false;
|
||||
};
|
||||
|
||||
|
@ -118,9 +118,9 @@ namespace cartservice.cartstore
|
|||
try
|
||||
{
|
||||
EnsureRedisConnected();
|
||||
|
||||
|
||||
var db = redis.GetDatabase();
|
||||
|
||||
|
||||
// Access the cart from the cache
|
||||
var value = await db.HashGetAsync(userId, CART_FIELD_NAME);
|
||||
|
||||
|
@ -202,7 +202,6 @@ namespace cartservice.cartstore
|
|||
{
|
||||
try
|
||||
{
|
||||
var redis = ConnectionMultiplexer.Connect(redisConnectionOptions);
|
||||
var cache = redis.GetDatabase();
|
||||
var res = cache.Ping();
|
||||
return res != TimeSpan.Zero;
|
||||
|
|
26
src/cartservice/genproto.sh
Executable file
26
src/cartservice/genproto.sh
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash -eu
|
||||
#
|
||||
# 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.
|
||||
|
||||
# Generate the C# code for .proto files
|
||||
set -e
|
||||
|
||||
PROTODIR=../../pb
|
||||
|
||||
# enter this directory
|
||||
CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
protoc --csharp_out=$CWD/grpc_generated -I $PROTODIR $PROTODIR/demo.proto
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
FROM python:3-slim as base
|
||||
FROM python:3.7-slim as base
|
||||
|
||||
FROM base as builder
|
||||
|
||||
|
|
|
@ -37,4 +37,5 @@ def getJSONLogger(name):
|
|||
handler.setFormatter(formatter)
|
||||
logger.addHandler(handler)
|
||||
logger.setLevel(logging.INFO)
|
||||
logger.propagate = False
|
||||
return logger
|
||||
|
|
9
src/paymentservice/Gopkg.lock
generated
9
src/paymentservice/Gopkg.lock
generated
|
@ -1,9 +0,0 @@
|
|||
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
|
||||
|
||||
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "ab4fef131ee828e96ba67d31a7d690bd5f2f42040c6766b1b12fe856f87e0ff7"
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
|
@ -1,30 +0,0 @@
|
|||
# Gopkg.toml example
|
||||
#
|
||||
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
|
||||
# for detailed Gopkg.toml documentation.
|
||||
#
|
||||
# required = ["github.com/user/thing/cmd/thing"]
|
||||
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
|
||||
#
|
||||
# [[constraint]]
|
||||
# name = "github.com/user/project"
|
||||
# version = "1.0.0"
|
||||
#
|
||||
# [[constraint]]
|
||||
# name = "github.com/user/project2"
|
||||
# branch = "dev"
|
||||
# source = "github.com/myfork/project2"
|
||||
#
|
||||
# [[override]]
|
||||
# name = "github.com/x/y"
|
||||
# version = "2.4.0"
|
||||
#
|
||||
# [prune]
|
||||
# non-go = false
|
||||
# go-tests = true
|
||||
# unused-packages = true
|
||||
|
||||
|
||||
[prune]
|
||||
go-tests = true
|
||||
unused-packages = true
|
|
@ -37,4 +37,5 @@ def getJSONLogger(name):
|
|||
handler.setFormatter(formatter)
|
||||
logger.addHandler(handler)
|
||||
logger.setLevel(logging.INFO)
|
||||
logger.propagate = False
|
||||
return logger
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue