Skip to content

Commit

Permalink
Merge pull request #8 from bcgov/oracledb
Browse files Browse the repository at this point in the history
Merge Oracledb
  • Loading branch information
MCatherine1994 authored Jul 18, 2022
2 parents d7284c9 + 1ddc601 commit 26f1288
Show file tree
Hide file tree
Showing 35 changed files with 489 additions and 648 deletions.
Binary file added .DS_Store
Binary file not shown.
106 changes: 52 additions & 54 deletions .github/openshift/deploy.backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ metadata:
name: ${NAME}
annotations:
description: "Nr-Old-Growth"
tags: "nrfl"
tags: "nrfc"
iconClass: icon-js
labels:
app: ${NAME}-${ZONE}
app.kubernetes.io/part-of: ${NAME}-${ZONE}
parameters:
- name: NAME
description: Module name
value: nrfl
value: nrfc
- name: COMPONENT
description: Component name
value: backend
Expand All @@ -38,31 +38,37 @@ parameters:
- name: PROMOTE
description: Image (namespace/name:tag) to promote/import
value: bcgov/nr-old-growth:prod-backend
# - name: EMAIL_USERNAME
# description: CHES service client
# required: true
# - name: EMAIL_PASSWORD
# description: CHES service client password
# required: true
# - name: EMAIL_TOKEN_URL
# description: CHES authentication url
# required: true
# - name: EMAIL_API_URL
# description: CHES email api url
# required: true
- name: ORACLEDB_USER
description: Oracle database user name
required: true
- name: ORACLEDB_PASSWORD
description: Oracle database password
required: true
- name: ORACLEDB_DATABASE
description: Oracle database database name
required: true
- name: ORACLEDB_HOST
description: Oracle database host
required: true
- name: ORACLEDB_SERVICENAME
description: Oracle database service name
required: true
- name: NODE_ENV
description: environment mode
required: true
objects:
# - apiVersion: v1
# kind: Secret
# metadata:
# name: ${NAME}-${ZONE}-${COMPONENT}
# labels:
# app: ${NAME}-${ZONE}
# stringData:
# email-username: "${EMAIL_USERNAME}"
# email-password: "${EMAIL_PASSWORD}"
- apiVersion: v1
kind: Secret
metadata:
name: ${NAME}-${ZONE}-${COMPONENT}
labels:
app: ${NAME}-${ZONE}
stringData:
oracle-user: "${ORACLEDB_USER}"
oracle-password: "${ORACLEDB_PASSWORD}"
oracle-database: "${ORACLEDB_DATABASE}"
oracle-host: "${ORACLEDB_HOST}"
oracle-service: "${ORACLEDB_SERVICENAME}"
- apiVersion: v1
kind: ImageStream
metadata:
Expand Down Expand Up @@ -112,43 +118,35 @@ objects:
imagePullPolicy: Always
name: ${NAME}
env:
- name: POSTGRESQL_HOST
value: ${NAME}-${ZONE}-database
- name: POSTGRESQL_DATABASE
- name: FRONTEND_URL
value: https://${NAME}-${ZONE}-frontend.${DOMAIN}
- name: BACKEND_URL
value: https://${NAME}-${ZONE}-backend.${DOMAIN}
- name: ORACLEDB_USER
valueFrom:
secretKeyRef:
name: ${NAME}-${ZONE}-database
key: database-name
- name: POSTGRESQL_PASSWORD
name: ${NAME}-${ZONE}-${COMPONENT}
key: oracle-user
- name: ORACLEDB_PASSWORD
valueFrom:
secretKeyRef:
name: ${NAME}-${ZONE}-database
key: database-password
- name: POSTGRESQL_USER
name: ${NAME}-${ZONE}-${COMPONENT}
key: oracle-password
- name: ORACLEDB_DATABASE
valueFrom:
secretKeyRef:
name: ${NAME}-${ZONE}-database
key: database-user
- name: FRONTEND_URL
value: https://${NAME}-${ZONE}-frontend.${DOMAIN}
- name: BACKEND_URL
value: https://${NAME}-${ZONE}-backend.${DOMAIN}
# - name: EMAIL_USERNAME
# valueFrom:
# secretKeyRef:
# name: ${NAME}-${ZONE}-${COMPONENT}
# key: email-username
# - name: EMAIL_PASSWORD
# valueFrom:
# secretKeyRef:
# name: ${NAME}-${ZONE}-${COMPONENT}
# key: email-password
# - name: EMAIL_TOKEN_URL
# value: ${EMAIL_TOKEN_URL}
# - name: EMAIL_API_URL
# value: ${EMAIL_API_URL}
# - name: EMAIL_FROM
# value: "[email protected]"
name: ${NAME}-${ZONE}-${COMPONENT}
key: oracle-database
- name: ORACLEDB_HOST
valueFrom:
secretKeyRef:
name: ${NAME}-${ZONE}-${COMPONENT}
key: oracle-host
- name: ORACLEDB_SERVICENAME
valueFrom:
secretKeyRef:
name: ${NAME}-${ZONE}-${COMPONENT}
key: oracle-service
- name: NODE_ENV
value: ${NODE_ENV}

Expand Down
4 changes: 2 additions & 2 deletions .github/openshift/deploy.database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ metadata:
name: ${NAME}
annotations:
description: "Nr-Old-Growth"
tags: "nrfl"
tags: "nrfc"
iconClass: icon-js
labels:
app: ${NAME}-${ZONE}
app.kubernetes.io/part-of: ${NAME}-${ZONE}
parameters:
- name: NAME
description: Product name
value: nrfl
value: nrfc
- name: COMPONENT
description: Component name
value: database
Expand Down
4 changes: 2 additions & 2 deletions .github/openshift/deploy.frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ metadata:
name: ${NAME}
annotations:
description: "Nr-Old-Growth"
tags: "nrfl"
tags: "nrfc"
iconClass: icon-js
labels:
app: ${NAME}-${ZONE}
app.kubernetes.io/part-of: ${NAME}-${ZONE}
parameters:
- name: NAME
description: Module name
value: nrfl
value: nrfc
- name: COMPONENT
description: Component name
value: frontend
Expand Down
2 changes: 1 addition & 1 deletion .github/openshift/networkPolicies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: ${NAME}
annotations:
description: "NR-Forest-Client"
tags: "nrfl"
tags: "nrfc"
iconClass: icon-js
objects:
- apiVersion: networking.k8s.io/v1
Expand Down
19 changes: 7 additions & 12 deletions .github/workflows/merge-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

env:
REGISTRY: ghcr.io
NAME: nrfl
NAME: nrfc

jobs:
codeql:
Expand Down Expand Up @@ -165,23 +165,18 @@ jobs:
--from-literal=config.js="const config = (() => { return { VITE_BACKEND_URL: 'https://${{ env.NAME }}-${{ env.ZONE }}-backend.apps.silver.devops.gov.bc.ca'}; })();"
# Process and apply deployment templates
oc process -f .github/openshift/deploy.database.yml -p ZONE=${{ env.ZONE }} | oc apply -f -
oc process -f .github/openshift/deploy.backend.yml -p ZONE=${{ env.ZONE }} \
-p PROMOTE=${{ github.repository }}:${{ env.ZONE }}-backend \
-p NODE_ENV='development' | oc apply -f -
# -p EMAIL_USERNAME=${{ secrets.CHES_SERVICE_CLIENT }} \
# -p EMAIL_PASSWORD=${{ secrets.CHES_CLIENT_PASSWORD }} \
# -p EMAIL_TOKEN_URL='https://oidc.gov.bc.ca/auth/realms/jbd6rnxw/protocol/openid-connect/token' \
# -p EMAIL_API_URL='https://ches-dev.apps.silver.devops.gov.bc.ca/api/v1' | oc apply -f -
-p NODE_ENV='development' \
-p ORACLEDB_USER=${{ secrets.ORACLEDB_USER }} \
-p ORACLEDB_PASSWORD=${{ secrets.ORACLEDB_PASSWORD }} \
-p ORACLEDB_DATABASE=${{ secrets.ORACLEDB_DATABASE }} \
-p ORACLEDB_HOST=${{ secrets.ORACLEDB_HOST }} \
-p ORACLEDB_SERVICENAME=${{ secrets.ORACLEDB_SERVICENAME }} | oc apply -f -
oc process -f .github/openshift/deploy.frontend.yml -p ZONE=${{ env.ZONE }} \
-p PROMOTE=${{ github.repository }}:${{ env.ZONE }}-frontend | oc apply -f -
# Follow any active rollouts (see deploymentconfigs)
oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-database -w
# Run database migration
oc exec dc/${{ env.NAME }}-${{ env.ZONE }}-database -- psql -d ${{ env.NAME }} -U ${{ env.NAME }} -c "$(cat backend/src/databasescripts/fsa.sql)"
oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-backend -w
oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-frontend -w
Expand Down
32 changes: 13 additions & 19 deletions .github/workflows/merge-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

env:
REGISTRY: ghcr.io
NAME: nrfl
NAME: nrfc

jobs:
codeql:
Expand Down Expand Up @@ -221,23 +221,18 @@ jobs:
--from-literal=config.js="const config = (() => { return { VITE_BACKEND_URL: 'https://${{ env.NAME }}-${{ env.ZONE }}-backend.apps.silver.devops.gov.bc.ca'}; })();"
# Process and apply deployment templates
oc process -f .github/openshift/deploy.database.yml -p ZONE=${{ env.ZONE }} | oc apply -f -
oc process -f .github/openshift/deploy.backend.yml -p ZONE=${{ env.ZONE }} \
-p PROMOTE=${{ github.repository }}:${{ env.ZONE }}-backend \
-p NODE_ENV='development' | oc apply -f -
# -p EMAIL_USERNAME=${{ secrets.CHES_SERVICE_CLIENT }} \
# -p EMAIL_PASSWORD=${{ secrets.CHES_CLIENT_PASSWORD }} \
# -p EMAIL_TOKEN_URL='https://oidc.gov.bc.ca/auth/realms/jbd6rnxw/protocol/openid-connect/token' \
# -p EMAIL_API_URL='https://ches-dev.apps.silver.devops.gov.bc.ca/api/v1' | oc apply -f -
-p NODE_ENV='development' \
-p ORACLEDB_USER=${{ secrets.ORACLEDB_USER }} \
-p ORACLEDB_PASSWORD=${{ secrets.ORACLEDB_PASSWORD }} \
-p ORACLEDB_DATABASE=${{ secrets.ORACLEDB_DATABASE }} \
-p ORACLEDB_HOST=${{ secrets.ORACLEDB_HOST }} \
-p ORACLEDB_SERVICENAME=${{ secrets.ORACLEDB_SERVICENAME }} | oc apply -f -
oc process -f .github/openshift/deploy.frontend.yml -p ZONE=${{ env.ZONE }} \
-p PROMOTE=${{ github.repository }}:${{ env.ZONE }}-frontend | oc apply -f -
# Follow any active rollouts (see deploymentconfigs)
oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-database -w
# Run database migration
oc exec dc/${{ env.NAME }}-${{ env.ZONE }}-database -- psql -d ${{ env.NAME }} -U ${{ env.NAME }} -c "$(cat backend/src/databasescripts/fsa.sql)"
oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-backend -w
oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-frontend -w
Expand Down Expand Up @@ -318,19 +313,18 @@ jobs:
# --from-literal=config.js="const config = (() => { return { VITE_BACKEND_URL: 'https://${{ env.NAME }}-${{ env.ZONE }}-backend.apps.silver.devops.gov.bc.ca'}; })();"

# # Process and apply deployment templates
# oc process -f .github/openshift/deploy.database.yml -p ZONE=${{ env.ZONE }} | oc apply -f -
# oc process -f .github/openshift/deploy.backend.yml -p ZONE=${{ env.ZONE }} \
# -p PROMOTE=${{ github.repository }}:${{ env.PREV }}-backend \
# -p NODE_ENV='production' | oc apply -f -
# # -p EMAIL_USERNAME=${{ secrets.CHES_SERVICE_CLIENT }} \
# # -p EMAIL_PASSWORD=${{ secrets.CHES_CLIENT_PASSWORD }} \
# # -p EMAIL_TOKEN_URL='https://oidc.gov.bc.ca/auth/realms/jbd6rnxw/protocol/openid-connect/token' \
# # -p EMAIL_API_URL='https://ches.apps.silver.devops.gov.bc.ca/api/v1' | oc apply -f -
# -p NODE_ENV='production' \
# -p ORACLEDB_USER=${{ secrets.ORACLEDB_USER }} \
# -p ORACLEDB_PASSWORD=${{ secrets.ORACLEDB_PASSWORD }} \
# -p ORACLEDB_DATABASE=${{ secrets.ORACLEDB_DATABASE }} \
# -p ORACLEDB_HOST=${{ secrets.ORACLEDB_HOST }} \
# -p ORACLEDB_SERVICENAME=${{ secrets.ORACLEDB_SERVICENAME }} | oc apply -f -
# oc process -f .github/openshift/deploy.frontend.yml -p ZONE=${{ env.ZONE }} \
# -p PROMOTE=${{ github.repository }}:${{ env.PREV }}-frontend | oc apply -f -

# # Follow any active rollouts (see deploymentconfigs)
# oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-database -w
# oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-backend -w
# oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-frontend -w

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-close.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- dev

env:
NAME: nrfl
NAME: nrfc

jobs:
cleanup-openshift:
Expand Down
22 changes: 7 additions & 15 deletions .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

env:
REGISTRY: ghcr.io
NAME: nrfl
NAME: nrfc

jobs:
check-backend:
Expand Down Expand Up @@ -344,9 +344,6 @@ jobs:
oc create configmap ${{ env.NAME }}-${{ env.ZONE }}-frontend \
--from-literal=config.js="const config = (() => { return { VITE_BACKEND_URL: 'https://${{ env.NAME }}-${{ env.ZONE }}-backend.apps.silver.devops.gov.bc.ca'}; })();"
# Database uses a default build
oc process -f .github/openshift/deploy.database.yml -p ZONE=${{ env.ZONE }} | oc apply -f -
# Clean previous image, if rebuilding
if [ ${{ needs.build-backend.outputs.build == 'true' }} ]
then
Expand All @@ -358,12 +355,12 @@ jobs:
# Process and apply template
oc process -f .github/openshift/deploy.backend.yml -p ZONE=${{ env.ZONE }} \
-p PROMOTE=${{ github.repository }}:${{ env.ZONE }}-backend \
-p NODE_ENV='development' | oc apply -f -
# -p EMAIL_USERNAME=${{ secrets.CHES_SERVICE_CLIENT }} \
# -p EMAIL_PASSWORD=${{ secrets.CHES_CLIENT_PASSWORD }} \
# -p EMAIL_TOKEN_URL='https://dev.oidc.gov.bc.ca/auth/realms/jbd6rnxw/protocol/openid-connect/token' \
# -p EMAIL_API_URL='https://ches-dev.apps.silver.devops.gov.bc.ca/api/v1' | oc apply -f -
-p NODE_ENV='development' \
-p ORACLEDB_USER=${{ secrets.ORACLEDB_USER }} \
-p ORACLEDB_PASSWORD=${{ secrets.ORACLEDB_PASSWORD }} \
-p ORACLEDB_DATABASE=${{ secrets.ORACLEDB_DATABASE }} \
-p ORACLEDB_HOST=${{ secrets.ORACLEDB_HOST }} \
-p ORACLEDB_SERVICENAME=${{ secrets.ORACLEDB_SERVICENAME }} | oc apply -f -
# Clean previous image, if rebuilding
if [ ${{ needs.build-backend.outputs.build == 'true' }} ]
Expand All @@ -378,11 +375,6 @@ jobs:
-p PROMOTE=${{ github.repository }}:${{ env.ZONE }}-frontend | oc apply -f -
# Follow any active rollouts (see deploymentconfigs)
oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-database -w
# Run database migration
oc exec dc/${{ env.NAME }}-${{ env.ZONE }}-database -- psql -d ${{ env.NAME }} -U ${{ env.NAME }} -c "$(cat backend/src/databasescripts/fsa.sql)"
oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-backend -w
oc rollout status dc/${{ env.NAME }}-${{ env.ZONE }}-frontend -w
Expand Down
Loading

0 comments on commit 26f1288

Please sign in to comment.