-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathprime-app-template.yml
More file actions
1136 lines (1107 loc) · 37.7 KB
/
Copy pathprime-app-template.yml
File metadata and controls
1136 lines (1107 loc) · 37.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
apiVersion: template.openshift.io/v1
kind: Template
metadata:
name: prime
description: >-
Deployment template for the Ministry of Health PharmaNet Revisions for Information Management Enhancements
parameters:
- name: SVC_NAME
displayName: Name
description: A name appended to all objects
required: true
value: prime
- name: IMAGE_TAG
displayName: Image Tag
description: an identifier that labels which version an image belongs to.
required: true
- name: OC_LICENSE_PLATE
displayName: OpenShift License Plate
description: Prepends your dev/test/prod URL
required: true
value: 9c33a9
- name: OC_ENV
displayName: Openshift Environment
description: dev/test/prod
required: true
- name: FRONTEND_REPLICAS
displayName: Number of frontend pods
description: For scaling frontend pods
required: true
value: '3'
- name: BACKEND_REPLICAS
displayName: Number of backend pods
description: For scaling backend pods
required: true
value: '3'
- name: VANITY_URL
displayName: Vanity URL
description: Minus the HTTP/HTTPS, this is your vanity URL or the prefix of your default URL
required: true
value: vanity
- name: ASP_ENV
displayName: ASP.NET Environment
description: Development or Production
required: true
value: Development
- name: WEB_PORT
displayName: Web Port for NGINX
description: Termination port on NGINX (8080 or 8443)
value: "8080"
- name: URL_STUB
displayName: URL Stub
description: Appended to all URLs, used in PRs
value: "-9c33a9-dev.apps.silver.devops.gov.bc.ca"
required: false
- name: HPR_URL
displayName: Health Practicioner URL
value: ""
- name: MAUTH_URL
displayName: MUTUAL_AUTHENTICATION URL
value: ""
- name: CRON_SCHEDULE_RENEWALS
description: 'Renewal email sending cron schedule. Cron-like schedule expression. Default: Once a day at 11 PM'
value: '0 23 * * *'
- name: CRON_SCHEDULE_STATUSES
description: 'Email status update cron job. Cron-like schedule expression. Default: At minute 0 past every 6th hour.'
value: '0 */6 * * *'
objects:
###########################################
### Frontend ###
###########################################
# Frontend Deployment
- apiVersion: apps/v1
kind: Deployment
metadata:
name: ${SVC_NAME}-frontend
namespace: ${OC_LICENSE_PLATE}-${OC_ENV}
annotations:
image.openshift.io/triggers: |-
[
{
"from": {
"kind": "ImageStreamTag",
"namespace": "9c33a9-tools",
"name": "prime-frontend:${IMAGE_TAG}"
},
"fieldPath": "spec.template.spec.containers[0].image",
"paused": false
}
]
labels:
app.kubernetes.io/instance: ${SVC_NAME}
app.kubernetes.io/name: frontend
app.kubernetes.io/version: 0.0.1
app.openshift.io/runtime: nginx
spec:
replicas: ${{FRONTEND_REPLICAS}}
selector:
matchLabels:
app.kubernetes.io/instance: ${SVC_NAME}
app.kubernetes.io/name: frontend
template:
metadata:
labels:
app.kubernetes.io/instance: ${SVC_NAME}
app.kubernetes.io/name: frontend
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app.kubernetes.io/name
operator: In
values:
- frontend
- key: app.kubernetes.io/instance
operator: In
values:
- ${SVC_NAME}
topologyKey: kubernetes.io/hostname
volumes:
- name: vanity-tls-certs
secret:
secretName: vanity-tls-certificate
defaultMode: 420
- name: nginx-config
configMap:
name: ${SVC_NAME}-nginx-config
- name: plr-integration-volume
secret:
secretName: plr-integration
- name: env-config
configMap:
name: ${SVC_NAME}-env-config
- name: log-storage
emptyDir: {}
- name: fluentbit-config
configMap:
name: frontend-fluentbit-config
containers:
- name: ${SVC_NAME}-frontend
image: >-
image-registry.openshift-image-registry.svc:5000/${OC_LICENSE_PLATE}-tools/prime-frontend:${IMAGE_TAG}
ports:
- containerPort: 80
protocol: TCP
- containerPort: 8080
protocol: TCP
- containerPort: 8443
protocol: TCP
- containerPort: 8888
protocol: TCP
- containerPort: 8890
protocol: TCP
volumeMounts:
- name: vanity-tls-certs
readOnly: true
mountPath: /etc/nginx/certs
- name: plr-integration-volume
readOnly: true
mountPath: /etc/nginx/certs/plr
- name: nginx-config
readOnly: true
mountPath: /etc/nginx/nginx.conf
subPath: nginx.conf
- name: env-config
readOnly: true
mountPath: /opt/app-root/src/assets/config-map.json
subPath: config-map.json
- name: log-storage
mountPath: /tmp/
resources: {}
envFrom:
- configMapRef:
name: keycloak
env:
- name: DOCUMENT_MANAGER_URL
value: https://${VANITY_URL}/api/docman
- name: SERVER_LOGFILE
value: /tmp/error_fluentbit.log
readinessProbe:
httpGet:
path: /
port: 8080
initialDelaySeconds: 5
periodSeconds: 5
livenessProbe:
httpGet:
path: /
port: 8080
initialDelaySeconds: 5
failureThreshold: 1
periodSeconds: 5
- name: fluent-bit
image: 'docker.io/fluent/fluent-bit:3.0.3'
imagePullPolicy: IfNotPresent
resources:
requests:
cpu: 10m
memory: 16Mi
readinessProbe:
httpGet:
path: /
port: 2020
scheme: HTTP
initialDelaySeconds: 10
timeoutSeconds: 1
periodSeconds: 60
successThreshold: 1
failureThreshold: 3
livenessProbe:
httpGet:
path: /
port: 2020
scheme: HTTP
initialDelaySeconds: 10
timeoutSeconds: 1
periodSeconds: 60
successThreshold: 1
failureThreshold: 3
env:
- name: SERVER_LOGFILE
value: /tmp/error_fluentbit.log
ports:
- name: metrics
containerPort: 2020
protocol: TCP
- name: http-plugin
containerPort: 80
protocol: TCP
volumeMounts:
- name: fluentbit-config
mountPath: /fluent-bit/etc
- name: log-storage
mountPath: /tmp/
terminationMessagePolicy: File
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
revisionHistoryLimit: 10
progressDeadlineSeconds: 600
# NGINX Configuration
- apiVersion: v1
kind: ConfigMap
metadata:
name: ${SVC_NAME}-nginx-config
namespace: ${OC_LICENSE_PLATE}-${OC_ENV}
labels:
app.kubernetes.io/part-of: ${SVC_NAME}
data:
nginx.conf: |-
# Based on https://www.nginx.com/resources/wiki/start/topics/examples/full/#nginx-conf
#user www www; ## Default: nobody
worker_processes auto;
error_log "/var/log/nginx/error.log";
error_log "/tmp/error_fluentbit.log";
pid "/tmp/nginx.pid";
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log "/var/log/nginx/access.log" main;
# add_header X-Frame-Options SAMEORIGIN;
client_body_temp_path "/tmp/client_body" 1 2;
proxy_temp_path "/tmp/proxy" 1 2;
fastcgi_temp_path "/tmp/fastcgi" 1 2;
scgi_temp_path "/tmp/scgi" 1 2;
uwsgi_temp_path "/tmp/uwsgi" 1 2;
sendfile on;
# tcp_nopush on;
tcp_nodelay off;
gzip on;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/css application/javascript text/xml application/xml+rss;
keepalive_timeout 65;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
client_max_body_size 80M;
server_tokens off;
server {
listen 8080;
server_name localhost *.gov.bc.ca;
server_tokens off;
root /opt/app-root/src;
index index.html index.htm;
include mime.types;
add_header X-Frame-Options "ALLOW-FROM common-logon-dev.hlth.gov.bc.ca" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Content-Security-Policy "frame-ancestors 'self' common-logon-dev.hlth.gov.bc.ca; style-src 'unsafe-inline' 'self' https://fonts.googleapis.com https://fonts.gstatic.com ; font-src 'self' https://fonts.googleapis.com https://fonts.gstatic.com" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer-when-downgrade";
gzip on;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
location / {
try_files $uri $uri/ /index.html$args;
}
location /api/docman/ {
proxy_pass http://${SVC_NAME}-document-manager:6001/;
}
location /api/v1/ {
proxy_pass http://${SVC_NAME}-webapi:8080/api/;
}
location /api/v1/PLRHL7 {
proxy_pass http://${SVC_NAME}-webapi:8080/api/PLRHL7;
# proxy_set_header X-SSL-CERT $ssl_client_escaped_cert;
}
location /nginx_status {
# Enable Nginx stats
stub_status on;
# Only allow access from localhost
allow 127.0.0.1;
# Other request should be denied
deny all;
# No need to log this request, its just noise
access_log on;
}
}
server {
listen 8443 ssl;
server_name *.gov.bc.ca;
ssl_password_file certs/passwd.txt;
ssl_certificate certs/chained.crt;
ssl_certificate_key certs/private.key;
server_tokens off;
# ssl_verify_client optional_no_ca;
root /opt/app-root/src;
index index.html index.htm;
add_header X-Frame-Options "ALLOW-FROM common-logon-dev.hlth.gov.bc.ca" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Content-Security-Policy "frame-ancestors 'self' common-logon-dev.hlth.gov.bc.ca; style-src 'unsafe-inline' 'self' https://fonts.googleapis.com https://fonts.gstatic.com ; font-src 'self' https://fonts.googleapis.com https://fonts.gstatic.com" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer-when-downgrade";
gzip on;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
location / {
try_files $uri $uri/ /index.html$args;
}
location /api/docman/ {
proxy_pass http://${SVC_NAME}-document-manager:6001/;
}
location /api/v1/ {
proxy_pass http://${SVC_NAME}-webapi:8080/api/;
}
location /api/v1/PLRHL7 {
proxy_pass http://${SVC_NAME}-webapi:8080/api/PLRHL7;
# proxy_set_header X-SSL-CERT $ssl_client_escaped_cert;
}
location /nginx_status {
# Enable Nginx stats
stub_status on;
# Only allow access from localhost
allow 127.0.0.1;
# Other request should be denied
deny all;
# No need to log this request, its just noise
access_log on;
}
}
server {
listen 8888;
server_name *.gov.bc.ca;
server_tokens off;
root /opt/app-root/src;
index index.html index.htm;
add_header X-Frame-Options "ALLOW-FROM common-logon-dev.hlth.gov.bc.ca" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Content-Security-Policy "frame-ancestors 'self' common-logon-dev.hlth.gov.bc.ca; style-src 'unsafe-inline' 'self' https://fonts.googleapis.com https://fonts.gstatic.com ; font-src 'self' https://fonts.googleapis.com https://fonts.gstatic.com" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "no-referrer-when-downgrade";
gzip on;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
location / {
try_files $uri $uri/ /index.html$args;
}
location /api/docman/ {
proxy_pass http://${SVC_NAME}-document-manager:6001;
}
location /api/v1/ {
proxy_pass http://${SVC_NAME}-webapi:8080/api/;
}
location /nginx_status {
# Enable Nginx stats
stub_status on;
# Only allow access from localhost
allow 127.0.0.1;
# Other request should be denied
deny all;
# No need to log this request, its just noise
access_log on;
}
}
server {
# Block for API end-points that require a client certificate (Multual Authentication)
listen 8890 ssl;
server_name *.gov.bc.ca;
ssl_password_file certs/passwd.txt;
ssl_certificate certs/chained.crt;
ssl_certificate_key certs/private.key;
server_tokens off;
ssl_verify_client optional_no_ca;
ssl_client_certificate certs/plr/trusted-ca-certs.pem;
root /opt/app-root/src;
index index.html index.htm;
# add_header X-Frame-Options "ALLOW-FROM common-logon-dev.hlth.gov.bc.ca" always;
# add_header X-XSS-Protection "1; mode=block" always;
# add_header Content-Security-Policy "frame-ancestors 'self' common-logon-dev.hlth.gov.bc.ca; style-src 'unsafe-inline' 'self' https://fonts.googleapis.com https://fonts.gstatic.com ; font-src 'self' https://fonts.googleapis.com https://fonts.gstatic.com" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload" always;
add_header X-Content-Type-Options "nosniff" always;
# add_header Referrer-Policy "no-referrer-when-downgrade";
gzip on;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
location /api/v1/PLRHL7 {
proxy_pass http://${SVC_NAME}-webapi:8080/api/PLRHL7;
proxy_set_header X-SSL-CERT $ssl_client_escaped_cert;
}
}
}
# Frontend Service
- apiVersion: v1
kind: Service
metadata:
name: ${SVC_NAME}-frontend
namespace: ${OC_LICENSE_PLATE}-${OC_ENV}
labels:
app.kubernetes.io/instance: ${OC_ENV}
app.kubernetes.io/name: frontend
app.kubernetes.io/version: 0.0.1
spec:
ports:
- name: "http"
port: 8080
targetPort: 8080
- name: "https"
port: 8443
targetPort: 8443
- name: "hpr"
port: 8888
targetPort: 8888
- name: "mutualauth"
port: 8890
targetPort: 8890
selector:
app.kubernetes.io/instance: ${SVC_NAME}
app.kubernetes.io/name: frontend
# Frontend Route (Web)
- kind: Route
apiVersion: route.openshift.io/v1
metadata:
name: ${SVC_NAME}-frontend
namespace: ${OC_LICENSE_PLATE}-${OC_ENV}
labels:
app.kubernetes.io/part-of: ${SVC_NAME}
spec:
host: ${SVC_NAME}${URL_STUB}
to:
kind: Service
name: ${SVC_NAME}-frontend
weight: 100
port:
targetPort: http
tls:
termination: edge
insecureEdgeTerminationPolicy: Redirect
wildcardPolicy: None
# Frontend Route (Health Practitioner Registration)
- apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: ${SVC_NAME}-frontend-hpr
namespace: ${OC_LICENSE_PLATE}-${OC_ENV}
labels:
app.kubernetes.io/part-of: ${SVC_NAME}
spec:
host: ${HPR_URL}
to:
kind: Service
name: ${SVC_NAME}-frontend
weight: 100
port:
targetPort: 8888
tls:
termination: edge
insecureEdgeTerminationPolicy: Allow
wildcardPolicy: None
# Frontend Route (Mutual Authentication)
- apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: ${SVC_NAME}-frontend-mutualauth
namespace: ${OC_LICENSE_PLATE}-${OC_ENV}
labels:
app.kubernetes.io/part-of: ${SVC_NAME}
spec:
host: ${MAUTH_URL}
to:
kind: Service
name: ${SVC_NAME}-frontend
weight: 100
port:
targetPort: 8890
tls:
termination: passthrough
insecureEdgeTerminationPolicy: Redirect
wildcardPolicy: None
###########################################
### Backend Web API ###
###########################################
# Backend Web API Deployment
- apiVersion: apps/v1
kind: Deployment
metadata:
name: ${SVC_NAME}-webapi
namespace: ${OC_LICENSE_PLATE}-${OC_ENV}
labels:
app.openshift.io/runtime: dotnet
app.kubernetes.io/instance: ${SVC_NAME}
app.kubernetes.io/name: webapi
app.kubernetes.io/version: 0.0.1
annotations:
image.openshift.io/triggers: |-
[
{
"from": {
"kind": "ImageStreamTag",
"namespace": "${OC_LICENSE_PLATE}-tools",
"name": "prime-webapi-backend:${IMAGE_TAG}"
},
"fieldPath": "spec.template.spec.containers[0].image",
"paused": false
}
]
spec:
replicas: ${{BACKEND_REPLICAS}}
selector:
matchLabels:
app.kubernetes.io/instance: ${SVC_NAME}
app.kubernetes.io/name: webapi
template:
metadata:
labels:
app.kubernetes.io/instance: ${SVC_NAME}
app.kubernetes.io/name: webapi
spec:
initContainers:
- name: run-migrations
image: >-
image-registry.openshift-image-registry.svc:5000/${OC_LICENSE_PLATE}-tools/prime-webapi-backend:${IMAGE_TAG}
env:
- name: PGHOST
valueFrom:
configMapKeyRef:
name: database-cm
key: database-host
- name: PGUSER
valueFrom:
secretKeyRef:
name: ${SVC_NAME}-patroni-secret
key: app-db-username
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: ${SVC_NAME}-patroni-secret
key: app-db-password
- name: PGDATABASE
valueFrom:
secretKeyRef:
name: ${SVC_NAME}-patroni-secret
key: app-db-name
command: ['psql', '-a', '-f', './databaseMigrations.sql']
containers:
- name: ${SVC_NAME}-webapi
image: >-
image-registry.openshift-image-registry.svc:5000/${OC_LICENSE_PLATE}-tools/prime-webapi-backend:${IMAGE_TAG}
command:
- bash
- '-c'
- dotnet ./prime.dll -v 2>&1> /dev/stdout
resources:
requests:
cpu: 100m
memory: 2Gi
env:
- name: DOCUMENT_MANAGER_CLIENT_ID
valueFrom:
configMapKeyRef:
name: document-manager
key: DOCUMENT_MANAGER_CLIENT_ID
- name: OC_APP
value: ${OC_APP}
- name: DOCUMENT_MANAGER_URL
value: http://${SVC_NAME}-document-manager:6001
- name: PHARMANET_SSL_CERT_FILENAME
value: /opt/app-root/etc/certs/pharmanet-api-cert.pfx
- name: DB_HOST
valueFrom:
configMapKeyRef:
name: database-cm
key: database-host
- name: BACKEND_URL
value: https://${VANITY_URL}/api/v1/
- name: FRONTEND_URL
value: https://${VANITY_URL}
- name: POSTGRESQL_PASSWORD
valueFrom:
secretKeyRef:
name: ${SVC_NAME}-patroni-secret
key: app-db-password
- name: POSTGRESQL_USER
valueFrom:
secretKeyRef:
name: ${SVC_NAME}-patroni-secret
key: app-db-username
- name: POSTGRESQL_DATABASE
valueFrom:
secretKeyRef:
name: ${SVC_NAME}-patroni-secret
key: app-db-name
- name: DB_CONNECTION_STRING
value: "host=$(DB_HOST);port=5432;database=$(POSTGRESQL_DATABASE);username=$(POSTGRESQL_USER);password=$(POSTGRESQL_PASSWORD)"
- name: SERVER_LOGFILE
value: /opt/app-root/app/logs/*.log
ports:
- containerPort: 1025
protocol: TCP
- containerPort: 5001
protocol: TCP
- containerPort: 8080
protocol: TCP
startupProbe:
httpGet:
path: /api/healthcheck/startup
port: 8080
scheme: HTTP
timeoutSeconds: 60
periodSeconds: 10
successThreshold: 1
failureThreshold: 120
readinessProbe:
httpGet:
path: /api/healthcheck/readiness
port: 8080
scheme: HTTP
initialDelaySeconds: 5
timeoutSeconds: 1
periodSeconds: 5
successThreshold: 1
failureThreshold: 3
livenessProbe:
httpGet:
path: /api/healthcheck/liveness
port: 8080
scheme: HTTP
timeoutSeconds: 1
periodSeconds: 5
successThreshold: 1
failureThreshold: 3
imagePullPolicy: IfNotPresent
terminationMessagePolicy: File
envFrom:
- configMapRef:
name: canada-post-addresscomplete
- configMapRef:
name: ches
- configMapRef:
name: dotnet-webapi-backend
- configMapRef:
name: keycloak
- configMapRef:
name: ldap
- configMapRef:
name: mail-settings
- configMapRef:
name: metabase-embedded
- configMapRef:
name: pharmanet-api
- configMapRef:
name: verifiable-credential
- configMapRef:
name: provider-enrolment-team
- secretRef:
name: canada-post-addresscomplete-secrets
- secretRef:
name: ches-secrets
- secretRef:
name: document-manager-secrets
- secretRef:
name: keycloak-secrets
- secretRef:
name: metabase-embedded-secrets
- secretRef:
name: pharmanet-api-secrets
- secretRef:
name: verifiable-credential-secrets
- secretRef:
name: plr-integration-thumbprint
volumeMounts:
- name: cert-volume
mountPath: /opt/app-root/etc/certs
readOnly: true
- name: log-storage
mountPath: /opt/app-root/app/logs
- name: fluent-bit
image: 'docker.io/fluent/fluent-bit:3.0.3'
resources:
requests:
cpu: 10m
memory: 16Mi
readinessProbe:
httpGet:
path: /
port: 2020
scheme: HTTP
initialDelaySeconds: 10
timeoutSeconds: 1
periodSeconds: 60
successThreshold: 1
failureThreshold: 3
livenessProbe:
httpGet:
path: /
port: 2020
scheme: HTTP
initialDelaySeconds: 10
timeoutSeconds: 1
periodSeconds: 60
successThreshold: 1
failureThreshold: 3
env:
- name: SERVER_LOGFILE
value: /opt/app-root/app/logs/*.log
ports:
- name: metrics
containerPort: 2020
protocol: TCP
- name: http-plugin
containerPort: 80
protocol: TCP
imagePullPolicy: IfNotPresent
volumeMounts:
- name: fluentbit-config
mountPath: /fluent-bit/etc
- name: log-storage
mountPath: /opt/app-root/app/logs
terminationMessagePolicy: File
volumes:
- name: cert-volume
secret:
secretName: pharmanet-api-ssl-certs
- name: log-storage
emptyDir: {}
- name: fluentbit-config
configMap:
name: webapi-fluentbit-config
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
serviceAccount: default
schedulerName: default-scheduler
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
revisionHistoryLimit: 10
progressDeadlineSeconds: 600
# Backend Web API Service
- apiVersion: v1
kind: Service
metadata:
name: ${SVC_NAME}-webapi
namespace: ${OC_LICENSE_PLATE}-${OC_ENV}
labels:
app.kubernetes.io/instance: ${SVC_NAME}
app.kubernetes.io/name: webapi
app.kubernetes.io/version: 0.0.1
spec:
ports:
- name: ${SVC_NAME}-webapi
port: 8080
targetPort: 8080
selector:
app.kubernetes.io/instance: ${SVC_NAME}
app.kubernetes.io/name: webapi
###########################################
### Document Manager (backend) ###
###########################################
# Document Manager (backend) Deployment
- apiVersion: apps/v1
kind: Deployment
metadata:
name: ${SVC_NAME}-document-manager
namespace: ${OC_LICENSE_PLATE}-${OC_ENV}
labels:
app.kubernetes.io/instance: ${SVC_NAME}
app.kubernetes.io/name: document-manager
app.openshift.io/runtime: python
annotations:
image.openshift.io/triggers: |-
[
{
"from": {
"kind": "ImageStreamTag",
"namespace": "${OC_LICENSE_PLATE}-tools",
"name": "prime-document-manager:${IMAGE_TAG}"
},
"fieldPath": "spec.template.spec.containers[0].image",
"paused": false
}
]
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/instance: ${SVC_NAME}
app.kubernetes.io/name: document-manager
strategy:
type: Recreate
rollingParams:
updatePeriodSeconds: 1
intervalSeconds: 1
timeoutSeconds: 120
maxSurge: "50%"
maxUnavailable: 0
template:
metadata:
labels:
app.kubernetes.io/instance: ${SVC_NAME}
app.kubernetes.io/name: document-manager
spec:
initContainers:
- name: run-migrations
image: >-
image-registry.openshift-image-registry.svc:5000/${OC_LICENSE_PLATE}-tools/prime-document-manager:${IMAGE_TAG}
command:
- /opt/app-root/src/app.sh
args:
- migrate
env:
- name: CACHE_REDIS_HOST
value: ${SVC_NAME}-redis
- name: CACHE_REDIS_PASS
valueFrom:
secretKeyRef:
name: redis
key: database-password
- name: CACHE_REDIS_PORT
value: "6379"
- name: PGHOST
valueFrom:
configMapKeyRef:
name: database-cm
key: database-host
- name: PGDATABASE
valueFrom:
secretKeyRef:
name: ${SVC_NAME}-patroni-secret
key: app-db-name
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: ${SVC_NAME}-patroni-secret
key: app-db-password
- name: PGUSER
valueFrom:
secretKeyRef:
name: ${SVC_NAME}-patroni-secret
key: app-db-username
- name: DOCUMENT_MANAGER_URL
value: "https://${VANITY_URL}/api/docman/"
- name: JWT_OIDC_WELL_KNOWN_CONFIG
valueFrom:
configMapKeyRef:
name: keycloak
key: JWT_WELL_KNOWN_CONFIG
- name: SQLALCHEMY_DATABASE_URI
value: "postgresql://$(PGUSER):$(PGPASSWORD)@$(PGHOST):5432/$(PGDATABASE)"
envFrom:
- configMapRef:
name: document-manager
containers:
- name: ${SVC_NAME}-document-manager
image: >-
image-registry.openshift-image-registry.svc:5000/${OC_LICENSE_PLATE}-tools/prime-document-manager:${IMAGE_TAG}
resources:
requests:
cpu: 10m
memory: 28Mi
env:
- name: CACHE_REDIS_HOST
value: ${SVC_NAME}-redis
- name: CACHE_REDIS_PASS
valueFrom:
secretKeyRef:
name: redis
key: database-password
- name: CACHE_REDIS_PORT
value: "6379"
- name: PGHOST
valueFrom:
configMapKeyRef:
name: database-cm
key: database-host
- name: PGDATABASE
valueFrom:
secretKeyRef:
name: ${SVC_NAME}-patroni-secret
key: app-db-name
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: ${SVC_NAME}-patroni-secret
key: app-db-password
- name: PGUSER
valueFrom:
secretKeyRef:
name: ${SVC_NAME}-patroni-secret
key: app-db-username
- name: DOCUMENT_MANAGER_URL
value: "https://${VANITY_URL}/api/docman/"
- name: JWT_OIDC_WELL_KNOWN_CONFIG
valueFrom:
configMapKeyRef:
name: keycloak
key: JWT_WELL_KNOWN_CONFIG
- name: SQLALCHEMY_DATABASE_URI
value: "postgresql://$(PGUSER):$(PGPASSWORD)@$(PGHOST):5432/$(PGDATABASE)"
envFrom:
- configMapRef:
name: document-manager
volumeMounts:
# Mount Document Manager to PVC
- mountPath: /app/
name: ${SVC_NAME}-document-manager-pvc
ports:
- containerPort: 6001
protocol: TCP
- containerPort: 9191
protocol: TCP
startupProbe:
httpGet:
path: /healthcheck
port: 6001
scheme: HTTP
timeoutSeconds: 1
periodSeconds: 20
successThreshold: 1
failureThreshold: 120
readinessProbe:
httpGet:
path: /healthcheck