Skip to content

Commit

Permalink
DBC22-2305 & DBC22-2312: Add healthcheck
Browse files Browse the repository at this point in the history
Adding Readiness probe for nginx and Django.
  • Loading branch information
wmuldergov authored and ray-oxd committed Jun 7, 2024
1 parent ac67d76 commit 7e3aeab
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 15 deletions.
7 changes: 7 additions & 0 deletions compose/frontend/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ server {
proxy_cache_bypass $http_cachebypass;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
}
location /healthz {
access_log off;
add_header 'Content-Type' 'text/plain';
allow 127.0.0.1;
deny all;
return 200 "healthy\n";
}

# redirect server error pages to the static page /50x.html
#
Expand Down
7 changes: 7 additions & 0 deletions compose/frontend/default_maintenance.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ server {
index maintenance.html;
try_files $uri $uri/ /maintenance.html;
}
location /healthz {
access_log off;
add_header 'Content-Type' 'text/plain';
allow 127.0.0.1;
deny all;
return 200 "healthy\n";
}

# redirect server error pages to the static page /50x.html
#
Expand Down
26 changes: 26 additions & 0 deletions infrastructure/_django/templates/django-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,32 @@ spec:
terminationMessagePolicy: File
image: >-
{{ .Values.image.repository }}:{{ .Values.image.tag }}
readinessProbe:
httpGet:
path: /healthcheck/
port: 8000
scheme: HTTP
httpHeaders:
- name: host
value: localhost
initialDelaySeconds: 10
timeoutSeconds: 5
periodSeconds: 10
successThreshold: 1
failureThreshold: 5
livenessProbe:
httpGet:
path: /healthcheck/
port: 8000
scheme: HTTP
httpHeaders:
- name: host
value: localhost
initialDelaySeconds: 60
timeoutSeconds: 5
periodSeconds: 60
successThreshold: 1
failureThreshold: 3
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
Expand Down
10 changes: 10 additions & 0 deletions infrastructure/_static/templates/static-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ spec:
type: RuntimeDefault
runAsNonRoot: true
allowPrivilegeEscalation: false
readinessProbe:
httpGet:
path: /healthz
port: 3000
scheme: HTTP
initialDelaySeconds: 5
timeoutSeconds: 1
periodSeconds: 5
successThreshold: 1
failureThreshold: 3
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
Expand Down
8 changes: 4 additions & 4 deletions infrastructure/main/values-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ django:
resources:
requests:
cpu: 20m
memory: 250Mi
memory: 300Mi
limits:
cpu: 500m
memory: 350Mi
Expand Down Expand Up @@ -48,11 +48,11 @@ tasks:
deployment:
resources:
requests:
cpu: 100m
memory: 200Mi
cpu: 300m
memory: 250Mi
limits:
cpu: 500m
memory: 250Mi
memory: 300Mi
volumes:
claimName: dev-django-app-images
env:
Expand Down
6 changes: 3 additions & 3 deletions infrastructure/main/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ django:
resources:
requests:
cpu: 50m
memory: 250Mi
memory: 300Mi
limits:
cpu: 1000m
memory: 350Mi
Expand Down Expand Up @@ -48,10 +48,10 @@ tasks:
resources:
requests:
cpu: 350m
memory: 200Mi
memory: 250Mi
limits:
cpu: 750m
memory: 250Mi
memory: 300Mi
volumes:
claimName: prod-django-app-images
env:
Expand Down
8 changes: 4 additions & 4 deletions infrastructure/main/values-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ django:
resources:
requests:
cpu: 20m
memory: 250Mi
memory: 300Mi
limits:
cpu: 500m
memory: 350Mi
Expand Down Expand Up @@ -47,11 +47,11 @@ tasks:
deployment:
resources:
requests:
cpu: 100m
memory: 200Mi
cpu: 300m
memory: 250Mi
limits:
cpu: 500m
memory: 250Mi
memory: 300Mi
volumes:
claimName: test-django-app-images
env:
Expand Down
8 changes: 4 additions & 4 deletions infrastructure/main/values-uat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ django:
resources:
requests:
cpu: 50m
memory: 250Mi
memory: 300Mi
limits:
cpu: 1000m
memory: 350Mi
Expand Down Expand Up @@ -47,11 +47,11 @@ tasks:
deployment:
resources:
requests:
cpu: 200m
memory: 200Mi
cpu: 350m
memory: 250Mi
limits:
cpu: 750m
memory: 250Mi
memory: 300Mi
volumes:
claimName: uat-django-app-images
env:
Expand Down

0 comments on commit 7e3aeab

Please sign in to comment.