Skip to content

Commit

Permalink
#1963 - Database Name prefixed (#2152)
Browse files Browse the repository at this point in the history
  • Loading branch information
guru-aot authored Aug 3, 2023
1 parent 43ca26b commit 9f31199
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 44 deletions.
1 change: 1 addition & 0 deletions .github/workflows/env-setup-deploy-secrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
ESDC_RESPONSE_FOLDER: ${{ secrets.ESDC_RESPONSE_FOLDER }}
ESDC_ENVIRONMENT_CODE: ${{ secrets.ESDC_ENVIRONMENT_CODE }}
SFAS_RECEIVE_FOLDER: ${{ secrets.SFAS_RECEIVE_FOLDER }}
SIMS_DB_NAME: ${{ secrets.SIMS_DB_NAME }}
INSTITUTION_REQUEST_FOLDER: ${{ secrets.INSTITUTION_REQUEST_FOLDER }}
INSTITUTION_RESPONSE_FOLDER: ${{ vars.INSTITUTION_RESPONSE_FOLDER }}
GC_NOTIFY_URL: ${{ secrets.GC_NOTIFY_URL }}
Expand Down
27 changes: 10 additions & 17 deletions .github/workflows/release-deploy-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ env:
NAMESPACE: ${{ secrets.OPENSHIFT_ENV_NAMESPACE }}
BUILD_REF: ${{ inputs.gitRef }}
HOST_PREFIX: ${{ secrets.HOST_PREFIX }}
BUILD_NAMESPACE: 0c27fb-tools
KEYCLOAK_REALM: "aestsims"
BUILD_NAMESPACE: ${{ vars.BUILD_NAMESPACE }}
KEYCLOAK_REALM: ${{ vars.KEYCLOAK_REALM }}
KEYCLOAK_AUTH_URL: ${{ secrets.KEYCLOAK_AUTH_URL }}
BCeID_WEB_SERVICE_WSDL: ${{ secrets.BCeID_WEB_SERVICE_WSDL }}
SITE_MINDER_LOGOUT_URL: ${{ secrets.SITE_MINDER_LOGOUT_URL }}
Expand All @@ -88,7 +88,6 @@ env:
QUEUE_PREFIX: ${{ secrets.QUEUE_PREFIX }}
API_PORT: ${{ secrets.API_PORT }}
WEB_PORT: ${{ secrets.WEB_PORT }}
DATABASE_NAME_KEY: ${{ secrets.DATABASE_NAME_KEY }}

jobs:
# Run DB migrations.
Expand All @@ -99,10 +98,9 @@ jobs:
steps:
- name: Print env
run: |
echo Git Environment: ${{ inputs.environment }}
echo Git Red: ${{ inputs.gitRef }}
echo Deploy Environment: ${{ inputs.environment }}
echo GIT REF: ${{ inputs.gitRef }}
echo BUILD NAMESPACE: $BUILD_NAMESPACE
echo HOST_PREFIX: $HOST_PREFIX
- name: Checkout Target Branch
uses: actions/checkout@v3
Expand All @@ -127,10 +125,9 @@ jobs:
steps:
- name: Print env
run: |
echo BUILD NAMESPACE: $BUILD_NAMESPACE
echo BUILD ENVIRONMENT: ${{ inputs.environment }}
echo Deploy ENVIRONMENT: ${{ inputs.environment }}
echo GIT REF: ${{ inputs.gitRef }}
echo HOST_PREFIX: $HOST_PREFIX
echo BUILD NAMESPACE: $BUILD_NAMESPACE
- name: Checkout Target Branch
uses: actions/checkout@v3
Expand All @@ -155,10 +152,8 @@ jobs:
steps:
- name: Print env
run: |
echo BUILD NAMESPACE: $BUILD_NAMESPACE
echo BUILD ENVIRONMENT: ${{ inputs.environment }}
echo GIT REF: ${{ inputs.gitRef }}
echo HOST_PREFIX: $HOST_PREFIX
- name: Checkout Target Branch
uses: actions/checkout@v3
Expand All @@ -183,10 +178,9 @@ jobs:
steps:
- name: Print env
run: |
echo BUILD NAMESPACE: $BUILD_NAMESPACE
echo BUILD ENVIRONMENT: ${{ inputs.environment }}
echo Deploy ENVIRONMENT: ${{ inputs.environment }}
echo GIT REF: ${{ inputs.gitRef }}
echo HOST_PREFIX: $HOST_PREFIX
echo BUILD NAMESPACE: $BUILD_NAMESPACE
- name: Checkout Target Branch
uses: actions/checkout@v3
Expand All @@ -211,10 +205,9 @@ jobs:
steps:
- name: Print env
run: |
echo BUILD NAMESPACE: $BUILD_NAMESPACE
echo BUILD ENVIRONMENT: ${{ inputs.environment }}
echo Deploy ENVIRONMENT: ${{ inputs.environment }}
echo GIT REF: ${{ inputs.gitRef }}
echo HOST_PREFIX: $HOST_PREFIX
echo BUILD NAMESPACE: $BUILD_NAMESPACE
- name: Checkout Target Branch
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/repo-checks-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
QUEUE_CONSUMERS_PORT: 3001
DB_SCHEMA: sims
DISABLE_ORM_CACHE: "true"
KEYCLOAK_REALM: "aestsims"
KEYCLOAK_REALM: ${{ vars.KEYCLOAK_REALM }}
KEYCLOAK_AUTH_URL: "https://dev.loginproxy.gov.bc.ca/auth/"
BCeID_WEB_SERVICE_WSDL: "https://gws1.test.bceid.ca/webservices/Client/V10/BCeIDService.asmx?wsdl"
E2E_TEST_STUDENT_USERNAME: student_e2e_test
Expand Down
12 changes: 3 additions & 9 deletions devops/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export APPLICATION_ARCHIVE_DAYS := $(or ${APPLICATION_ARCHIVE_DAYS}, 43)
export API_PORT := $(or ${API_PORT}, 7070)
export QUEUE_CONSUMERS_PORT := $(or ${QUEUE_CONSUMERS_PORT}, 7000)
export WEB_PORT := $(or ${WEB_PORT}, 3030)
export DATABASE_NAME_KEY := $(or ${DATABASE_NAME_KEY}, database-name)
export DB_NAME := $(or ${DB_NAME}, SIMSDB)
export DB_MIGRATIONS_BUILD_REF := $(or ${DB_MIGRATIONS_BUILD_REF}, db-migrations-${APP_NAME})
export API_BUILD_REF := $(or ${API_BUILD_REF}, api-${APP_NAME})
Expand Down Expand Up @@ -192,6 +191,7 @@ init-secrets:
-p ESDC_RESPONSE_FOLDER=$(ESDC_RESPONSE_FOLDER) \
-p ESDC_ENVIRONMENT_CODE=$(ESDC_ENVIRONMENT_CODE) \
-p SFAS_RECEIVE_FOLDER=$(SFAS_RECEIVE_FOLDER) \
-p SIMS_DB_NAME=$(SIMS_DB_NAME) \
-p INSTITUTION_REQUEST_FOLDER=$(INSTITUTION_REQUEST_FOLDER) \
-p INSTITUTION_RESPONSE_FOLDER=$(INSTITUTION_RESPONSE_FOLDER) \
-p GC_NOTIFY_URL=$(GC_NOTIFY_URL) \
Expand Down Expand Up @@ -306,18 +306,18 @@ run-db-migrations:
test -n "$(NAMESPACE)"
test -n "$(BUILD_NAMESPACE)"
test -n "$(DB_SERVICE_NAME)"
test -n "$(API_SECRET_NAME)"
test -n "$(DB_MIGRATIONS_BUILD_REF)"
test -n "$(BUILD_REF)"
test -n "$(DATABASE_NAME_KEY)"
test -n "$(DB_MIGRATIONS)"
@echo "+\n++ Deploying DB_MIGRATIONS with tag: $(BUILD_REF)\n+"
@oc -n $(NAMESPACE) process -f openshift/db-migrations-job.yml \
-p NAME=$(DB_MIGRATIONS) \
-p DB_SERVICE=$(DB_SERVICE_NAME) \
-p BUILD_NAMESPACE=$(BUILD_NAMESPACE) \
-p API_SECRET_NAME=$(API_SECRET_NAME) \
-p IMAGE_STREAM_TAG="$(DB_MIGRATIONS_BUILD_REF):$(BUILD_REF)" \
-p BUILD_TAG=$(BUILD_REF) \
-p DATABASE_NAME_KEY=$(DATABASE_NAME_KEY) \
-p JOB_NAME=$(DB_MIGRATIONS_JOB_NAME) \
| oc -n $(NAMESPACE) apply -f -

Expand All @@ -344,7 +344,6 @@ deploy-api:
test -n "$(SITE_MINDER_LOGOUT_URL)"
test -n "$(ATBC_LOGIN_ENDPOINT)"
test -n "$(ATBC_ENDPOINT)"
test -n "$(DATABASE_NAME_KEY)"
test -n "$(API)"
test -n "$(API_SECRET_NAME)"
test -n "$(SWAGGER_NAME)"
Expand All @@ -364,7 +363,6 @@ deploy-api:
-p BCeID_WEB_SERVICE_WSDL=$(BCeID_WEB_SERVICE_WSDL) \
-p FORMS_SECRET_NAME=$(FORMS_SECRET_NAME) \
-p BUILD_TAG=$(BUILD_REF) \
-p DATABASE_NAME_KEY=$(DATABASE_NAME_KEY) \
-p SITE_MINDER_LOGOUT_URL=$(SITE_MINDER_LOGOUT_URL) \
-p ATBC_LOGIN_ENDPOINT=$(ATBC_LOGIN_ENDPOINT) \
-p ATBC_ENDPOINT=$(ATBC_ENDPOINT) \
Expand All @@ -381,7 +379,6 @@ deploy-workers:
test -n "$(BUILD_REF)"
test -n "$(WORKERS_BUILD_REF)"
test -n "$(DB_SERVICE_NAME)"
test -n "$(DATABASE_NAME_KEY)"
test -n "$(WORKERS_SECRET_NAME)"
test -n "$(WORKERS)"
test -n "$(BYPASS_CRA_INCOME_VERIFICATION)"
Expand All @@ -393,7 +390,6 @@ deploy-workers:
-p DB_SERVICE=$(DB_SERVICE_NAME) \
-p IMAGE_STREAM_TAG="$(WORKERS_BUILD_REF):$(BUILD_REF)" \
-p BUILD_TAG=$(BUILD_REF) \
-p DATABASE_NAME_KEY=$(DATABASE_NAME_KEY) \
-p BYPASS_CRA_INCOME_VERIFICATION=$(BYPASS_CRA_INCOME_VERIFICATION) \
| oc -n $(NAMESPACE) apply -f -
$(call rollout_and_wait,dc/$(WORKERS))
Expand All @@ -404,7 +400,6 @@ deploy-queue-consumers:
test -n "$(BUILD_REF)"
test -n "$(QUEUE_CONSUMERS_BUILD_REF)"
test -n "$(DB_SERVICE_NAME)"
test -n "$(DATABASE_NAME_KEY)"
test -n "$(QUEUE_CONSUMERS_SECRET_NAME)"
test -n "$(QUEUE_CONSUMERS)"
test -n "$(QUEUE_CONSUMERS_PORT)"
Expand All @@ -420,7 +415,6 @@ deploy-queue-consumers:
-p DB_SERVICE=$(DB_SERVICE_NAME) \
-p IMAGE_STREAM_TAG="$(QUEUE_CONSUMERS_BUILD_REF):$(BUILD_REF)" \
-p BUILD_TAG=$(BUILD_REF) \
-p DATABASE_NAME_KEY=$(DATABASE_NAME_KEY) \
-p PORT=$(QUEUE_CONSUMERS_PORT) \
-p HOST_NAME=$(HOST) \
-p QUEUE_PREFIX=$(QUEUE_PREFIX) \
Expand Down
10 changes: 5 additions & 5 deletions devops/openshift/api-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ objects:
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
key: ${DATABASE_NAME_KEY}
name: ${DB_SECRET_NAME}
key: ${SIMS_DB_NAME}
name: ${API_SECRET_NAME}
- name: BCeID_WEB_SERVICE_ONLINE_SERVICE_ID
valueFrom:
secretKeyRef:
Expand Down Expand Up @@ -306,12 +306,12 @@ parameters:
required: true
- name: BCeID_WEB_SERVICE_WSDL
required: true
- name: DATABASE_NAME_KEY
required: true
- name: BUILD_TAG
value: "0"
- name: API_SECRET_NAME
value: sims-api-creds
required: true
- name: SIMS_DB_NAME
value: sims-db-name
- name: FORMS_SECRET_NAME
value: forms
- name: BCeID_WEB_SERVICE_ONLINE_SERVICE_ID_NAME_KEY
Expand Down
10 changes: 6 additions & 4 deletions devops/openshift/db-migrations-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ objects:
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
key: ${DATABASE_NAME_KEY}
name: ${DB_SECRET_NAME}
key: ${SIMS_DB_NAME}
name: ${API_SECRET_NAME}
resources:
limits:
cpu: ${CPU_LIMIT}
Expand All @@ -59,6 +59,10 @@ parameters:
value: sims
- name: SERVICE_NAME
value: db-migrations
- name: API_SECRET_NAME
required: true
- name: SIMS_DB_NAME
value: sims-db-name
- name: JOB_NAME
description: database.migrations
required: true
Expand All @@ -77,8 +81,6 @@ parameters:
value: superuser-username
- name: DB_PASSWORD_KEY
value: superuser-password
- name: DATABASE_NAME_KEY
required: true
- name: CPU_LIMIT
value: "1.0"
- name: MEMORY_LIMIT
Expand Down
6 changes: 6 additions & 0 deletions devops/openshift/init-secrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ objects:
esdc-response-folder: ${ESDC_RESPONSE_FOLDER}
esdc-environment-code: ${ESDC_ENVIRONMENT_CODE}
sfas-receive-folder: ${SFAS_RECEIVE_FOLDER}
sims-db-name: ${SIMS_DB_NAME}
institution-request-folder: ${INSTITUTION_REQUEST_FOLDER}
institution-response-folder: ${INSTITUTION_RESPONSE_FOLDER}
atbc-username: ${ATBC_USERNAME}
Expand Down Expand Up @@ -133,6 +134,11 @@ parameters:
required: true
description: |
Folder on the SFTP where SFAS integration files will be placed.
- name: SIMS_DB_NAME
displayName: SIMS database name
required: true
description: |
Database name of SIMS applications.
- name: INSTITUTION_REQUEST_FOLDER
displayName: Institution request folder
required: true
Expand Down
8 changes: 4 additions & 4 deletions devops/openshift/queue-consumers-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ objects:
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
key: ${DATABASE_NAME_KEY}
name: ${DB_SECRET_NAME}
key: ${SIMS_DB_NAME}
name: ${QUEUE_CONSUMERS_SECRET_NAME}
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
Expand Down Expand Up @@ -276,8 +276,8 @@ parameters:
value: superuser-username
- name: DB_PASSWORD_KEY
value: superuser-password
- name: DATABASE_NAME_KEY
required: true
- name: SIMS_DB_NAME
value: sims-db-name
- name: IMAGE_STREAM_TAG
required: true
- name: BUILD_NAMESPACE
Expand Down
8 changes: 4 additions & 4 deletions devops/openshift/workers-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ objects:
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
key: ${DATABASE_NAME_KEY}
name: ${DB_SECRET_NAME}
key: ${SIMS_DB_NAME}
name: ${WORKERS_SECRET_NAME}
- name: ZEEBE_ADDRESS
valueFrom:
secretKeyRef:
Expand Down Expand Up @@ -124,8 +124,8 @@ parameters:
value: superuser-username
- name: DB_PASSWORD_KEY
value: superuser-password
- name: DATABASE_NAME_KEY
required: true
- name: SIMS_DB_NAME
value: sims-db-name
- name: IMAGE_STREAM_TAG
required: true
- name: BUILD_NAMESPACE
Expand Down

0 comments on commit 9f31199

Please sign in to comment.