Skip to content

Commit

Permalink
Merge branch 'main' into 608-dev-task-remove-unused-code-on-the-backend
Browse files Browse the repository at this point in the history
  • Loading branch information
paulushcgcj authored Feb 18, 2025
2 parents 5eeda3e + ff08d3b commit 25077c2
Show file tree
Hide file tree
Showing 7 changed files with 422 additions and 423 deletions.
27 changes: 23 additions & 4 deletions .github/workflows/.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,24 @@ on:
default: ${{ github.event.number }}
required: false
type: string
triggers:
description: Triggers for deployment
default: ''
type: string

### Per-environment config
backend_cpu_request:
description: CPU request for backend
default: '50m'
type: string
backend_min_replicas:
description: Minimum replicas for backend
default: '3'
type: string
backend_max_replicas:
description: Maximum replicas for backend
default: '5'
type: string

outputs:
run_tests:
Expand Down Expand Up @@ -78,7 +96,7 @@ jobs:
-p FORESTCLIENTAPI_KEY='${{ secrets.FORESTCLIENTAPI_KEY }}'
-p VITE_USER_POOLS_WEB_CLIENT_ID=${{ vars.VITE_USER_POOLS_WEB_CLIENT_ID }}
-p VITE_USER_POOLS_ID=${{ vars.VITE_USER_POOLS_ID }}
triggers: ${{ github.event_name == 'pull_request' && '(backend common/ frontend/)' || '' }}
triggers: ${{ inputs.triggers }}

deploy:
name: Deploy
Expand All @@ -99,13 +117,14 @@ jobs:
file: backend/openshift.deploy.yml
overwrite: true
parameters:
-p MAX_REPLICAS=1
-p MIN_REPLICAS=1
-p DB_POOL_MAX_SIZE=1
-p AWS_COGNITO_ISSUER_URI=https://cognito-idp.${{ vars.AWS_REGION }}.amazonaws.com/${{ vars.VITE_USER_POOLS_ID }}
-p DASHBOARD_JOB_IDIR_USERS=${{ vars.DASHBOARD_JOB_IDIR_USERS }}
-p WMS_LAYERS_WHITELIST_USERS=${{ vars.WMS_LAYERS_WHITELIST_USERS }}
-p ALLOWED_ORIGINS=${{ needs.init.outputs.allowed_origins }}
-p CPU_REQUEST=${{ inputs.backend_cpu_request }}
-p MIN_REPLICAS=${{ inputs.backend_min_replicas }}
-p MAX_REPLICAS=${{ inputs.backend_max_replicas }}
verification_path: /actuator/health
- name: frontend
file: frontend/openshift.deploy.yml
Expand All @@ -127,7 +146,7 @@ jobs:
-p ZONE=${{ inputs.target }} -p TAG=${{ inputs.tag }}
${{ matrix.parameters }}
timeout: 15m
triggers: ${{ github.event_name == 'pull_request' && '(backend common/ frontend/)' || '' }}
triggers: ${{ inputs.triggers }}
verification_path: ${{ matrix.verification_path }}
verification_retry_attempts: 5
verification_retry_seconds: 20
5 changes: 5 additions & 0 deletions .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ jobs:
needs: [builds]
secrets: inherit
uses: ./.github/workflows/.deploy.yml
with:
backend_cpu_request: '30m'
backend_min_replicas: '1'
backend_max_replicas: '1'
triggers: ('backend/' 'common/' 'frontend/')

results:
name: PR Results
Expand Down
31 changes: 11 additions & 20 deletions backend/openshift.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,9 @@ parameters:
- name: DOMAIN
value: apps.silver.devops.gov.bc.ca
- name: CPU_REQUEST
value: "30m"
value: "500m"
- name: MEMORY_REQUEST
value: "350Mi"
- name: CPU_LIMIT
value: "100m"
- name: MEMORY_LIMIT
value: "500Mi"
- name: MIN_REPLICAS
description: The minimum amount of replicas for the horizontal pod autoscaler.
value: "3"
Expand Down Expand Up @@ -106,23 +102,24 @@ objects:
storage: ${CERT_PVC_SIZE}
storageClassName: netapp-file-standard
- kind: Deployment
# name: ${NAME}-${ZONE}-${COMPONENT}
apiVersion: apps/v1
metadata:
labels:
app: "${NAME}-${ZONE}"
name: "${NAME}-${ZONE}-${COMPONENT}"
name: ${NAME}-${ZONE}-${COMPONENT}
spec:
replicas: 1
selector:
matchLabels:
deployment: "${NAME}-${ZONE}-${COMPONENT}"
deployment: ${NAME}-${ZONE}-${COMPONENT}
strategy:
type: RollingUpdate
template:
metadata:
labels:
app: "${NAME}-${ZONE}"
deployment: "${NAME}-${ZONE}-${COMPONENT}"
app: ${NAME}-${ZONE}
deployment: ${NAME}-${ZONE}-${COMPONENT}
spec:
initContainers:
- name: ${NAME}-${ZONE}-init
Expand All @@ -145,14 +142,11 @@ objects:
- name: ${NAME}-${ZONE}-certs
mountPath: /cert
resources:
limits:
cpu: ${CPU_LIMIT}
memory: ${MEMORY_LIMIT}
requests:
cpu: ${CPU_REQUEST}
memory: ${MEMORY_REQUEST}
containers:
- name: ${NAME}-${ZONE}
- name: ${NAME}-${ZONE}-${COMPONENT}
image: ${REGISTRY}/${ORG}/${NAME}/${COMPONENT}:${TAG}
imagePullPolicy: Always
volumeMounts:
Expand Down Expand Up @@ -242,9 +236,6 @@ objects:
requests:
cpu: "${CPU_REQUEST}"
memory: "${MEMORY_REQUEST}"
limits:
cpu: "${CPU_LIMIT}"
memory: "${MEMORY_LIMIT}"
ports:
- name: probe-port
containerPort: 8080
Expand Down Expand Up @@ -308,13 +299,13 @@ objects:
apiVersion: autoscaling/v2
metadata:
labels:
app: "${NAME}-${ZONE}"
name: "${NAME}-${ZONE}-${COMPONENT}"
app: ${NAME}-${ZONE}
name: ${NAME}-${ZONE}-${COMPONENT}
spec:
scaleTargetRef:
apiVersion: apps.openshift.io/v1
apiVersion: apps/v1
kind: Deployment
name: "${NAME}-${ZONE}-${COMPONENT}"
name: ${NAME}-${ZONE}-${COMPONENT}
minReplicas: "${{MIN_REPLICAS}}"
maxReplicas: "${{MAX_REPLICAS}}"
metrics:
Expand Down
9 changes: 1 addition & 8 deletions common/openshift.database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,8 @@ parameters:
value: /var/lib/postgresql
- name: CPU_REQUEST
value: 50m
- name: CPU_LIMIT
value: 115m
- name: MEMORY_REQUEST
value: 150Mi
- name: MEMORY_LIMIT
value: 250Mi
- name: DB_PVC_SIZE
description: Volume space available for data, e.g. 512Mi, 2Gi.
displayName: Database Volume Capacity
Expand Down Expand Up @@ -146,9 +142,6 @@ objects:
requests:
cpu: ${CPU_REQUEST}
memory: ${MEMORY_REQUEST}
limits:
cpu: ${CPU_LIMIT}
memory: ${MEMORY_LIMIT}
readinessProbe:
exec:
command:
Expand Down Expand Up @@ -498,4 +491,4 @@ objects:
activeDeadlineSeconds: 1600
dnsPolicy: "ClusterFirst"
serviceAccountName: "${JOB_SERVICE_ACCOUNT}"
serviceAccount: "${JOB_SERVICE_ACCOUNT}"
serviceAccount: "${JOB_SERVICE_ACCOUNT}"
2 changes: 1 addition & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Use this section once builds are fixed

FROM node:20.18.2-bullseye-slim AS build
FROM node:20.18.3-bullseye-slim AS build

# Build static files
WORKDIR /app
Expand Down
15 changes: 4 additions & 11 deletions frontend/openshift.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,9 @@ parameters:
- name: DOMAIN
value: apps.silver.devops.gov.bc.ca
- name: CPU_REQUEST
value: "25m"
value: "50m"
- name: MEMORY_REQUEST
value: "50Mi"
- name: CPU_LIMIT
value: "75m"
- name: MEMORY_LIMIT
value: "150Mi"
- name: MIN_REPLICAS
description: The minimum amount of replicas for the horizontal pod autoscaler.
value: "3"
Expand Down Expand Up @@ -71,7 +67,7 @@ objects:
deployment: "${NAME}-${ZONE}-${COMPONENT}"
spec:
containers:
- name: ${NAME}-${ZONE}
- name: ${NAME}-${ZONE}-${COMPONENT}
image: ${REGISTRY}/${ORG}/${NAME}/${COMPONENT}:${TAG}
securityContext:
capabilities:
Expand Down Expand Up @@ -103,9 +99,6 @@ objects:
requests:
cpu: "${CPU_REQUEST}"
memory: "${MEMORY_REQUEST}"
limits:
cpu: "${CPU_LIMIT}"
memory: "${MEMORY_LIMIT}"
readinessProbe:
httpGet:
path: /
Expand Down Expand Up @@ -165,9 +158,9 @@ objects:
name: "${NAME}-${ZONE}-${COMPONENT}"
spec:
scaleTargetRef:
apiVersion: apps.openshift.io/v1
apiVersion: apps/v1
kind: Deployment
name: "${NAME}-${ZONE}-${COMPONENT}"
name: ${NAME}-${ZONE}-${COMPONENT}
minReplicas: "${{MIN_REPLICAS}}"
maxReplicas: "${{MAX_REPLICAS}}"
metrics:
Expand Down
Loading

0 comments on commit 25077c2

Please sign in to comment.