Skip to content

Commit 78ee147

Browse files
committed
#37 update helm chart with grpc
1 parent 45c1f31 commit 78ee147

24 files changed

+268
-94
lines changed

README.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Check out my [blog](https://medium.com/@thangchung), my [chat](https://spectrum.
5858
- **[`.NET Core SDK 2.x`](https://dotnet.microsoft.com/download)** - .NET Framework and .NET Core, including ASP.NET and ASP.NET Core
5959
- **[`nodejs 10.x`](https://nodejs.org/en/download)** - JavaScript runtime built on Chrome's V8 JavaScript engine
6060
- **[`typescript`](https://www.typescriptlang.org)** - a typed superset of JavaScript that compiles to plain JavaScript
61-
- **[identityserver](https://identityserver.io)** - the Identity and Access Control solution for .NET Core
61+
- **[`identityserver`](https://identityserver.io)** - the Identity and Access Control solution for .NET Core
6262
- **[`gRPC`](https://grpc.io)** - a high-performance, open-source universal RPC framework
6363
- **[`create-react-app`](https://facebook.github.io/create-react-app)** - a modern web app by running one command
6464
- **[`vue-cli`](https://cli.vuejs.org/)** - standard tooling for Vue.js development
@@ -207,11 +207,24 @@ There are several individual µservices and infrastructure components that make
207207

208208
## Installation
209209

210-
### <strong>Development environment</strong> - up and running locally with "Docker for desktop"
210+
### Development environment
211+
212+
#### Up and running manually with `Docker for desktop`
211213

212214
See https://vietnam-devs.github.io/docs/development/up-running-d4d-aks/#docker-for-desktop
213215

214-
### <strong>Staging and Production environments</strong> - up and Running on Azure Kubernetes Service (AKS)
216+
#### Up and running with `docker compose`
217+
218+
```bash
219+
$ docker-compose up
220+
$ docker-compose -f docker-compose-graphql.yml up
221+
$ docker-compose -f docker-compose-graphql.headless.yml up
222+
$ docker-compose -f docker-compose-graphql.dev.yml up
223+
```
224+
225+
### Staging and Production environments
226+
227+
#### Up and Running on `Azure Kubernetes Service` (`AKS`)
215228

216229
See https://vietnam-devs.github.io/docs/development/up-running-d4d-aks/#azure-kubernetes-service-aks
217230

@@ -231,7 +244,7 @@ Guidance for developing µService can be found at [Clean Domain-Driven Design in
231244

232245
## Service mesh
233246

234-
[Istio](https://istio.io) provide a wealth of benefits for the organizations that use them. There’s no denying, however, that adopting the cloud can put strains on DevOps teams. Developers must use microservices to architect for portability, meanwhile operators are managing extremely large hybrid and multi-cloud deployments. Istio lets you connect, secure, control, and observe services.
247+
[`istio`](https://istio.io) provide a wealth of benefits for the organizations that use them. There’s no denying, however, that adopting the cloud can put strains on DevOps teams. Developers must use microservices to architect for portability, meanwhile operators are managing extremely large hybrid and multi-cloud deployments. Istio lets you connect, secure, control, and observe services.
235248

236249
### Distributed tracing
237250

deploys/charts/coolstore-istio/templates/api-vs.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ spec:
1616
host: openapi
1717
port:
1818
number: 5010
19+
- match:
20+
- uri:
21+
prefix: /gql/
22+
route:
23+
- destination:
24+
host: graphql
25+
port:
26+
number: 5011
1927
- match:
2028
- uri:
2129
prefix: /catalog/
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: networking.istio.io/v1alpha3
2+
kind: VirtualService
3+
metadata:
4+
name: backoffice-vs
5+
spec:
6+
hosts:
7+
- {{ .Values.hosts.backoffice }}
8+
gateways:
9+
- cs-gateway
10+
http:
11+
- match:
12+
- uri:
13+
prefix: /
14+
route:
15+
- destination:
16+
host: backoffice
17+
port:
18+
number: 80
19+
---

deploys/charts/coolstore-istio/templates/gateway.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ spec:
1212
protocol: HTTP
1313
hosts:
1414
- {{ .Values.hosts.web }}
15+
- {{ .Values.hosts.backoffice }}
1516
- {{ .Values.hosts.api }}
1617
- {{ .Values.hosts.idp }}
1718
---
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
apiVersion: extensions/v1beta1
2+
kind: Deployment
3+
metadata:
4+
name: backoffice-v1
5+
namespace: {{ .Release.Namespace }}
6+
spec:
7+
replicas: 1
8+
template:
9+
metadata:
10+
labels:
11+
app: backoffice
12+
version: v1
13+
spec:
14+
containers:
15+
- name: backoffice
16+
image: {{.Values.image.imageRegistry}}/cs-backoffice:{{.Values.image.dockerTag}}
17+
imagePullPolicy: {{ .Values.image.pullPolicy }}
18+
env:
19+
- name: REACT_APP_GRAPHQL_ENDPOINT
20+
value: {{ .Values.backofficeSettings.GraphQLEndPoint }}
21+
- name: REACT_APP_AUTHORITY
22+
value: {{ .Values.backofficeSettings.Authority }}
23+
- name: REACT_APP_CLIENT_ID
24+
value: {{ .Values.backofficeSettings.ClientId }}
25+
- name: REACT_APP_ROOT_URL
26+
value: {{ .Values.backofficeSettings.RootUrl }}
27+
ports:
28+
- containerPort: 3000
29+
resources:
30+
requests:
31+
cpu: 30m
32+
memory: 64Mi
33+
limits:
34+
cpu: 30m
35+
memory: 128Mi
36+
---
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: backoffice
5+
namespace: {{ .Release.Namespace }}
6+
labels:
7+
app: backoffice
8+
spec:
9+
ports:
10+
- port: 80
11+
targetPort: 3000
12+
protocol: TCP
13+
name: http
14+
selector:
15+
app: backoffice
16+
---

deploys/charts/coolstore/templates/cart-db-dep.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ spec:
2222
- containerPort: 3306
2323
resources:
2424
requests:
25-
memory: "500Mi"
26-
cpu: "100m"
25+
cpu: 10m
26+
memory: 64Mi
2727
limits:
28-
memory: "500Mi"
29-
cpu: "100m"
28+
cpu: 20m
29+
memory: 128Mi
3030
---

deploys/charts/coolstore/templates/cart-dep.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,34 +18,34 @@ spec:
1818
imagePullPolicy: {{ .Values.image.pullPolicy }}
1919
env:
2020
- name: Hosts__Local__Host
21-
value: {{ .Values.cartSettings.Hosts__Local__Host }}
21+
value: {{ .Values.cartSettings.Host }}
2222
- name: Hosts__Local__Port
23-
value: {{ .Values.cartSettings.Hosts__Local__Port | quote }}
23+
value: {{ .Values.cartSettings.Port | quote }}
2424
- name: Hosts__Externals__Catalog__Uri
25-
value: {{ .Values.cartSettings.Hosts__Externals__Catalog__Uri }}
25+
value: {{ .Values.cartSettings.CatalogUri }}
2626
- name: Features__EfCore__MySqlDb__FQDN
27-
value: {{ .Values.cartSettings.Features__EfCore__MySqlDb__FQDN }}
27+
value: {{ .Values.cartSettings.MySqlDbFQDN }}
2828
- name: Features__EfCore__MySqlDb__Password
2929
valueFrom:
3030
secretKeyRef:
3131
name: cart-secrets
3232
key: MySqlDbPassword
3333
ports:
34-
- containerPort: {{ .Values.cartSettings.Hosts__Local__Port }}
34+
- containerPort: {{ .Values.cartSettings.Port }}
3535
readinessProbe:
3636
initialDelaySeconds: 15
3737
exec:
38-
command: ["/bin/grpc_health_probe", "-addr=:5003"]
38+
command: ["/bin/grpc_health_probe", "-addr=:{{ .Values.cartSettings.Port }}"]
3939
livenessProbe:
4040
initialDelaySeconds: 15
4141
periodSeconds: 10
4242
exec:
43-
command: ["/bin/grpc_health_probe", "-addr=:5003"]
43+
command: ["/bin/grpc_health_probe", "-addr=:{{ .Values.cartSettings.Port }}"]
4444
resources:
4545
requests:
46-
memory: "300Mi"
47-
cpu: "100m"
46+
cpu: 30m
47+
memory: 64Mi
4848
limits:
49-
memory: "300Mi"
50-
cpu: "100m"
49+
cpu: 30m
50+
memory: 128Mi
5151
---

deploys/charts/coolstore/templates/cart-svc.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ metadata:
88
spec:
99
ports:
1010
- name: grpc
11-
port: {{ .Values.cartSettings.Hosts__Local__Port }}
12-
targetPort: {{ .Values.cartSettings.Hosts__Local__Port }}
11+
port: {{ .Values.cartSettings.Port }}
12+
targetPort: {{ .Values.cartSettings.Port }}
1313
protocol: TCP
1414
selector:
1515
app: cart

deploys/charts/coolstore/templates/catalog-dep.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ spec:
1515
initContainers:
1616
- name: init-mongodb
1717
image: busybox
18-
command: ["sh", "-c", "while nc -z {{ .Values.catalogSettings.MongoDb.Host }} {{ .Values.catalogSettings.MongoDb.Port }}; do sleep 1; done"]
18+
command: ["sh", "-c", "while nc -z {{ .Values.catalogSettings.MongoDbHost }} {{ .Values.catalogSettings.MongoDbPort }}; do sleep 1; done"]
1919
containers:
2020
- name: catalog
2121
image: {{.Values.image.imageRegistry}}/cs-catalog-service:{{.Values.image.dockerTag}}
@@ -26,7 +26,7 @@ spec:
2626
- name: PORT
2727
value: {{ .Values.catalogSettings.Port | quote }}
2828
- name: MONGO_DB_URI
29-
value: "mongodb://{{ .Values.catalogSettings.MongoDb.Host }}:{{ .Values.catalogSettings.MongoDb.Port }}/{{ .Values.catalogSettings.MongoDb.Name }}"
29+
value: "mongodb://{{ .Values.catalogSettings.MongoDbHost }}:{{ .Values.catalogSettings.MongoDbPort }}/{{ .Values.catalogSettings.MongoDbName }}"
3030
ports:
3131
- containerPort: {{ .Values.catalogSettings.Port }}
3232
readinessProbe:
@@ -40,9 +40,9 @@ spec:
4040
command: ["/bin/grpc_health_probe", "-addr=:{{ .Values.catalogSettings.Port }}"]
4141
resources:
4242
requests:
43-
cpu: 100m
43+
cpu: 50m
4444
memory: 64Mi
4545
limits:
46-
cpu: 200m
46+
cpu: 50m
4747
memory: 128Mi
4848
---
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
apiVersion: extensions/v1beta1
2+
kind: Deployment
3+
metadata:
4+
name: graphql-v1
5+
namespace: {{ .Release.Namespace }}
6+
spec:
7+
replicas: 1
8+
template:
9+
metadata:
10+
labels:
11+
app: graphql
12+
version: v1
13+
spec:
14+
containers:
15+
- name: graphql
16+
image: {{.Values.image.imageRegistry}}/cs-graphql:{{.Values.image.dockerTag}}
17+
imagePullPolicy: {{ .Values.image.pullPolicy }}
18+
env:
19+
- name: Hosts__BasePath
20+
value: {{ .Values.graphqlSettings.HostsBasePath }}
21+
- name: Cors__Origins
22+
value: {{ .Values.graphqlSettings.CorsOrigins | quote }}
23+
- name: Idp__Authority
24+
value: {{ .Values.graphqlSettings.IdpAuthority }}
25+
- name: Idp__Audience
26+
value: {{ .Values.graphqlSettings.IdpAudience }}
27+
- name: GrpcEndPoints__CatalogEndPoint
28+
value: {{ .Values.graphqlSettings.CatalogEndPoint }}
29+
- name: GrpcEndPoints__CartEndPoint
30+
value: {{ .Values.graphqlSettings.CartEndPoint }}
31+
- name: GrpcEndPoints__InventoryEndPoint
32+
value: {{ .Values.graphqlSettings.InventoryEndPoint }}
33+
- name: GrpcEndPoints__ReviewEndPoint
34+
value: {{ .Values.graphqlSettings.ReviewEndPoint }}
35+
- name: GrpcEndPoints__RatingEndPoint
36+
value: {{ .Values.graphqlSettings.RatingEndPoint }}
37+
ports:
38+
- containerPort: 5011
39+
resources:
40+
requests:
41+
cpu: 10m
42+
memory: 64Mi
43+
limits:
44+
cpu: 20m
45+
memory: 128Mi
46+
---
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: graphql
5+
namespace: {{ .Release.Namespace }}
6+
labels:
7+
app: graphql
8+
spec:
9+
ports:
10+
- port: 5011
11+
targetPort: 5011
12+
protocol: TCP
13+
name: http
14+
selector:
15+
app: graphql
16+
---

deploys/charts/coolstore/templates/idp-dep.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ spec:
1919
- name: HostSettings__BasePath
2020
value: {{ .Values.idpSettings.BasePath }}
2121
- name: Hosts__Externals__CurrentUri
22-
value: {{ .Values.idpSettings.Hosts__Externals__CurrentUri }}
22+
value: {{ .Values.idpSettings.ExternalCurrentUri }}
2323
- name: HostSettings__SwaggerRedirectUri
2424
value: {{ .Values.idpSettings.SwaggerRedirectUri }}
2525
- name: HostSettings__SwaggerPostLogoutRedirectUri
@@ -28,14 +28,16 @@ spec:
2828
value: {{ .Values.idpSettings.SwaggerAllowedCorsOrigin }}
2929
- name: HostSettings__SpaAllowedCorsOrigin
3030
value: {{ .Values.idpSettings.SpaAllowedCorsOrigin }}
31+
- name: HostSettings__BackOfficeAllowedCorsOrigin
32+
value: {{ .Values.idpSettings.BackOfficeAllowedCorsOrigin }}
3133
ports:
3234
- name: http
3335
containerPort: 80
3436
resources:
3537
requests:
36-
memory: "300Mi"
37-
cpu: "100m"
38+
cpu: 20m
39+
memory: 64Mi
3840
limits:
39-
memory: "300Mi"
40-
cpu: "100m"
41+
cpu: 40m
42+
memory: 128Mi
4143
---

deploys/charts/coolstore/templates/inventory-db-dep.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ spec:
2525
- containerPort: 3306
2626
resources:
2727
requests:
28-
memory: "500Mi"
29-
cpu: "100m"
28+
cpu: 20m
29+
memory: 64Mi
3030
limits:
31-
memory: "500Mi"
32-
cpu: "100m"
31+
cpu: 40m
32+
memory: 128Mi
3333
---

deploys/charts/coolstore/templates/inventory-dep.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,32 @@ spec:
1818
imagePullPolicy: {{ .Values.image.pullPolicy }}
1919
env:
2020
- name: Hosts__Local__Host
21-
value: {{ .Values.inventorySettings.Hosts__Local__Host }}
21+
value: {{ .Values.inventorySettings.Host }}
2222
- name: Hosts__Local__Port
23-
value: {{ .Values.inventorySettings.Hosts__Local__Port | quote }}
23+
value: {{ .Values.inventorySettings.Port | quote }}
2424
- name: Features__EfCore__MySqlDb__FQDN
25-
value: {{ .Values.inventorySettings.Features__EfCore__MySqlDb__FQDN }}
25+
value: {{ .Values.inventorySettings.MySqlDbFQDN }}
2626
- name: Features__EfCore__MySqlDb__Password
2727
valueFrom:
2828
secretKeyRef:
2929
name: inventory-secrets
3030
key: MySqlDbPassword
3131
ports:
32-
- containerPort: 5004
32+
- containerPort: {{ .Values.inventorySettings.Port }}
3333
readinessProbe:
3434
initialDelaySeconds: 15
3535
exec:
36-
command: ["/bin/grpc_health_probe", "-addr=:5004"]
36+
command: ["/bin/grpc_health_probe", "-addr=:{{ .Values.inventorySettings.Port }}"]
3737
livenessProbe:
3838
initialDelaySeconds: 15
3939
periodSeconds: 10
4040
exec:
41-
command: ["/bin/grpc_health_probe", "-addr=:5004"]
41+
command: ["/bin/grpc_health_probe", "-addr=:{{ .Values.inventorySettings.Port }}"]
4242
resources:
4343
requests:
44-
memory: "300Mi"
45-
cpu: "100m"
44+
cpu: 30m
45+
memory: 64Mi
4646
limits:
47-
memory: "300Mi"
48-
cpu: "100m"
47+
cpu: 30m
48+
memory: 64Mi
4949
---

0 commit comments

Comments
 (0)