Skip to content

Commit 609a05b

Browse files
committed
* set up k8s probes
* move env variables to a common configmap
1 parent 5c261ee commit 609a05b

15 files changed

+125
-52
lines changed

build-images.ps1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
param([String]$service="all")
2+
3+
if ($service -eq "all")
4+
{
5+
docker-compose -f docker-compose.yml build
6+
}
7+
else
8+
{
9+
docker-compose -f docker-compose.yml build $service
10+
}

deploy/k8s/local/delete-resources.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# configmap
2+
kubectl delete cm env-config
3+
14
# external system
25
kubectl delete deploy payment
36
kubectl delete svc payment

deploy/k8s/local/deploy-local.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ kubectl apply -f dashboard-adminuser.yaml
66
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/mandatory.yaml
77
kubectl apply -f nginx-ingress\custom-service.yaml
88

9+
# configmap
10+
kubectl apply -f env-config.yaml
11+
912
# mongo
1013
kubectl apply -f mongo\mongo-admin.yaml
1114
kubectl apply -f mongo\mongo-deployment.yaml

deploy/k8s/local/env-config.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: env-config
5+
data:
6+
ASPNETCORE_ENVIRONMENT: Development
7+
ConnectionStrings__InvoiceDB: Server=sql-data;Database=Duber.InvoiceDb;User Id=sa;Password=Pass@word
8+
ConnectionStrings__WebsiteDB: Server=sql-data;Database=Duber.WebSiteDb;User Id=sa;Password=Pass@word
9+
ConnectionStrings__SignalrBackPlane: redis
10+
EventStoreConfiguration__ConnectionString: mongodb://nosql-data
11+
EventBusConnection: rabbitmq
12+
PaymentServiceBaseUrl: http://payment
13+
InvoiceApiSettings__BaseUrl: http://invoice
14+
TripApiSettings__BaseUrl: http://trip
15+
TripApiSettings__NotificationsClientUrl: http://trip.notifications.local.com:81
16+
TripApiSettings__NotificationsServerUrl: http://notifications
17+
AzureServiceBusEnabled: "false"
18+
IsDeployedOnCluster: "true"

deploy/k8s/local/external-system/payment-deployment.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ spec:
1616
- name: payment
1717
image: vany0114/externalsystem.paymentservice
1818
imagePullPolicy: Always
19-
env:
20-
- name: ASPNETCORE_ENVIRONMENT
21-
value: "Development"
19+
envFrom:
20+
- configMapRef:
21+
name: env-config
2222
ports:
2323
- containerPort: 80

deploy/k8s/local/invoice/invoice-deployment.yaml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,21 @@ spec:
2323
limits:
2424
memory: "256Mi"
2525
cpu: "500m"
26-
env:
27-
- name: ASPNETCORE_ENVIRONMENT
28-
value: "Development"
29-
- name: ConnectionStrings__InvoiceDB
30-
value: "Server=sql-data;Database=Duber.InvoiceDb;User Id=sa;Password=Pass@word"
31-
- name: EventBusConnection
32-
value: "rabbitmq"
33-
- name: PaymentServiceBaseUrl
34-
value: "http://payment"
35-
- name: AzureServiceBusEnabled
36-
value: "False"
26+
envFrom:
27+
- configMapRef:
28+
name: env-config
29+
livenessProbe:
30+
httpGet:
31+
port: 80
32+
path: /liveness
33+
initialDelaySeconds: 10
34+
periodSeconds: 10
35+
readinessProbe:
36+
httpGet:
37+
path: /readiness
38+
port: 80
39+
initialDelaySeconds: 30
40+
periodSeconds: 60
41+
timeoutSeconds: 5
3742
ports:
3843
- containerPort: 80

deploy/k8s/local/notifications/notifications-deployment.yaml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,21 @@ spec:
2323
limits:
2424
memory: "256Mi"
2525
cpu: "600m"
26-
env:
27-
- name: ASPNETCORE_ENVIRONMENT
28-
value: "Development"
29-
- name: ConnectionStrings__SignalrBackPlane
30-
value: "redis"
31-
- name: EventBusConnection
32-
value: "rabbitmq"
33-
- name: AzureServiceBusEnabled
34-
value: "False"
35-
- name: IsDeployedOnCluster
36-
value: "True"
26+
envFrom:
27+
- configMapRef:
28+
name: env-config
29+
livenessProbe:
30+
httpGet:
31+
port: 80
32+
path: /liveness
33+
initialDelaySeconds: 10
34+
periodSeconds: 10
35+
readinessProbe:
36+
httpGet:
37+
path: /readiness
38+
port: 80
39+
initialDelaySeconds: 30
40+
periodSeconds: 60
41+
timeoutSeconds: 5
3742
ports:
3843
- containerPort: 80

deploy/k8s/local/trip/trip-deployment.yaml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,21 @@ spec:
2323
limits:
2424
memory: "256Mi"
2525
cpu: "600m"
26-
env:
27-
- name: ASPNETCORE_ENVIRONMENT
28-
value: "Development"
29-
- name: EventStoreConfiguration__ConnectionString
30-
value: "mongodb://nosql-data"
31-
- name: EventBusConnection
32-
value: "rabbitmq"
33-
- name: AzureServiceBusEnabled
34-
value: "False"
26+
envFrom:
27+
- configMapRef:
28+
name: env-config
29+
livenessProbe:
30+
httpGet:
31+
port: 80
32+
path: /liveness
33+
initialDelaySeconds: 10
34+
periodSeconds: 10
35+
readinessProbe:
36+
httpGet:
37+
path: /readiness
38+
port: 80
39+
initialDelaySeconds: 30
40+
periodSeconds: 60
41+
timeoutSeconds: 5
3542
ports:
3643
- containerPort: 80

deploy/k8s/local/website/website-deployment.yaml

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,38 @@ spec:
2323
limits:
2424
memory: "256Mi"
2525
cpu: "600m"
26-
env:
27-
- name: ASPNETCORE_ENVIRONMENT
28-
value: "Development"
29-
- name: ConnectionStrings__WebsiteDB
30-
value: "Server=sql-data;Database=Duber.WebSiteDb;User Id=sa;Password=Pass@word"
31-
- name: EventBusConnection
32-
value: "rabbitmq"
33-
- name: TripApiSettings__BaseUrl
34-
value: "http://trip"
35-
- name: TripApiSettings__NotificationsUrl
36-
value: "http://trip.notifications.local.com:81"
37-
- name: AzureServiceBusEnabled
38-
value: "False"
26+
envFrom:
27+
- configMapRef:
28+
name: env-config
29+
env:
30+
- name: HealthChecksUI__HealthChecks__0__Name
31+
value: "Invoice HTTP Check"
32+
- name: HealthChecksUI__HealthChecks__0__Uri
33+
value: $(InvoiceApiSettings__BaseUrl)/readiness
34+
- name: HealthChecksUI__HealthChecks__1__Name
35+
value: "Trip HTTP Check"
36+
- name: HealthChecksUI__HealthChecks__1__Uri
37+
value: $(TripApiSettings__BaseUrl)/readiness
38+
- name: HealthChecksUI__HealthChecks__2__Name
39+
value: "Notifications HTTP Check"
40+
- name: HealthChecksUI__HealthChecks__2__Uri
41+
value: $(TripApiSettings__NotificationsServerUrl)/readiness
42+
- name: HealthChecksUI__HealthChecks__3__Name
43+
value: "Frontend HTTP Check"
44+
- name: HealthChecksUI__HealthChecks__3__Uri
45+
value: "http://frontend/readiness"
46+
livenessProbe:
47+
httpGet:
48+
port: 80
49+
path: /liveness
50+
initialDelaySeconds: 10
51+
periodSeconds: 10
52+
readinessProbe:
53+
httpGet:
54+
path: /readiness
55+
port: 80
56+
initialDelaySeconds: 60
57+
periodSeconds: 60
58+
timeoutSeconds: 5
3959
ports:
4060
- containerPort: 80

docker-compose.override.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ services:
2727
- EventBusConnection=${AZURE_SERVICE_BUS:-rabbitmq}
2828
- InvoiceApiSettings__BaseUrl=${INVOICE_SERVICE_BASE_URL:-http://duber.invoice.api}
2929
- TripApiSettings__BaseUrl=${TRIP_SERVICE_BASE_URL:-http://duber.trip.api}
30-
- TripApiSettings__NotificationsUrl=${NOTIFICATIONS_SERVICE_URL:-http://docker.for.win.localhost:32778} #docker.for.mac.localhost / docker.for.linux.localhost (you could use the .env file to set this in a common variable, then use it here, i.e: LOCAL_DOMAIN=http://docker.for.win.localhost)
30+
- TripApiSettings__NotificationsServerUrl=${NOTIFICATIONS_SERVER_URL:-http://duber.trip.notifications}
31+
- TripApiSettings__NotificationsClientUrl=${NOTIFICATIONS_CLIENT_URL:-http://docker.for.win.localhost:32778} #docker.for.mac.localhost / docker.for.linux.localhost (you could use the .env file to set this in a common variable, then use it here, i.e: LOCAL_DOMAIN=http://docker.for.win.localhost)
3132
- AzureServiceBusEnabled=${SERVICE_BUS_ENABLED:-False}
3233
- HealthChecksUI__HealthChecks__0__Name=Invoice HTTP Check
3334
- HealthChecksUI__HealthChecks__0__Uri=http://duber.invoice.api/readiness

0 commit comments

Comments
 (0)