Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update prod scripts #138

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ jobs:

oc tag -n ${{ env.OPENSHIFT_NAMESPACE_DEV }} ${{ steps.push-image-cas.outputs.registry-path }} ${{env.REPO_NAME }}-cas-api:${{ env.TAG }}

curl -s https://raw.githubusercontent.com/bcgov/${{ env.REPO_NAME }}/${{ env.BRANCH }}/openshift/update-configmap.sh | bash /dev/stdin "${{ env.REPO_NAME }}" "${{ env.OPENSHIFT_NAMESPACE_DEV }}" "${{env.APP_DEBUG}}" "${{env.DOCUMENTROOT}}" "${{ env.DYNAMICSBASEURL}}" "${{env.ASPNETCORE_ENVIRONMENT}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__ACTIVEENVIRONMENT}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDWEBAPIURL}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDREDIRECTURL}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDRESOURCEURL}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDBASEURL}}" "${{env.ASPNETCORE_ENVIRONMENT_CAS}}" "${{env.CAS_API_SERVER}}" "${{env.CAS_TOKEN_URI}}" "${{env.CAS_INVOICE_URI}}"
curl -s https://raw.githubusercontent.com/bcgov/${{ env.REPO_NAME }}/${{ env.BRANCH }}/openshift/update-configmap.sh | bash /dev/stdin "${{ env.REPO_NAME }}" "${{env.APP_DEBUG}}" "${{env.DOCUMENTROOT}}" "${{ env.DYNAMICSBASEURL}}" "${{env.ASPNETCORE_ENVIRONMENT}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__ACTIVEENVIRONMENT}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDWEBAPIURL}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDREDIRECTURL}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDRESOURCEURL}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDBASEURL}}" "${{env.ASPNETCORE_ENVIRONMENT_CAS}}" "${{env.CAS_API_SERVER}}" "${{env.CAS_TOKEN_URI}}" "${{env.CAS_INVOICE_URI}}"


# Process and apply deployment template
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:
oc tag ${{ env.OPENSHIFT_NAMESPACE_DEV }}/${{ env.REPO_NAME }}-cas-api:${{ steps.get-latest-tag.outputs.tag }} \
${{ env.OPENSHIFT_NAMESPACE_TEST }}/${{ env.REPO_NAME }}-cas-api:${{ steps.get-latest-tag.outputs.tag }}

curl -s https://raw.githubusercontent.com/bcgov/${{ env.REPO_NAME }}/${{ env.BRANCH }}/openshift/update-configmap.sh | bash /dev/stdin "${{ env.REPO_NAME }}" "${{ env.OPENSHIFT_NAMESPACE_DEV }}" "${{env.APP_DEBUG}}" "${{env.DOCUMENTROOT}}" "${{ env.DYNAMICSBASEURL}}" "${{env.ASPNETCORE_ENVIRONMENT}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__ACTIVEENVIRONMENT}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDWEBAPIURL}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDREDIRECTURL}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDRESOURCEURL}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDBASEURL}}" "${{env.ASPNETCORE_ENVIRONMENT_CAS}}" "${{env.CAS_API_SERVER}}" "${{env.CAS_TOKEN_URI}}" "${{env.CAS_INVOICE_URI}}"
curl -s https://raw.githubusercontent.com/bcgov/${{ env.REPO_NAME }}/${{ env.BRANCH }}/openshift/update-configmap.sh | bash /dev/stdin "${{ env.REPO_NAME }}" "${{env.APP_DEBUG}}" "${{env.DOCUMENTROOT}}" "${{ env.DYNAMICSBASEURL}}" "${{env.ASPNETCORE_ENVIRONMENT}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__ACTIVEENVIRONMENT}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDWEBAPIURL}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDREDIRECTURL}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDRESOURCEURL}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDBASEURL}}" "${{env.ASPNETCORE_ENVIRONMENT_CAS}}" "${{env.CAS_API_SERVER}}" "${{env.CAS_TOKEN_URI}}" "${{env.CAS_INVOICE_URI}}"


# Process and apply deployment template
Expand Down
69 changes: 39 additions & 30 deletions .github/workflows/deploy_to_prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ env:
OPENSHIFT_TOKEN: ${{ secrets.OPENSHIFT_TOKEN }}
OPENSHIFT_NAMESPACE_TEST: '${{ secrets.ECAS_NAMESPACE_NO_ENV }}-test'
OPENSHIFT_NAMESPACE_PROD: '${{ secrets.ECAS_NAMESPACE_NO_ENV }}-prod'

REPO_NAME: educ-ecas
APP_NAME: ecas
APP_NAME_FRONTEND: ecas-frontend
Expand All @@ -18,32 +17,41 @@ env:
IMAGE_NAME_FRONTEND: ecas-frontend
IMAGE_NAME_API: ecas-api
IMAGE_NAME_CAS: cas-api
MIN_CPU: "20m"
MAX_CPU: "250m"
MIN_MEM: "500Mi"
MAX_MEM: "2Gi"
MIN_REPLICAS: "3"
MAX_REPLICAS: "5"
MAX_REPLICAS_TEST: '3'

HOST_ROUTE: '${{ secrets.SITE_URL }}'
APP_KEY: '${{ secrets.APP_KEY}}'
API_KEY: '${{ secrets.API_KEY}}'
DYNAMICS_USERNAME: '${{ secrets.DYNAMICS_USERNAME}}'
DYNAMICS_PASSWORD: '${{ secrets.DYNAMICS_PASSWORD}}'
KEYCLOAK_AUTHSERVERURL: '${{ secrets.KEYCLOAK_AUTHSERVERURL}}'
KEYCLOAK_REALM: '${{ secrets.KEYCLOAK_REALM}}'
KEYCLOAK_CLIENTID: '${{ secrets.KEYCLOAK_CLIENTID}}-prod'


ECASAPISECURITYSETTINGS__USERNAME: '${{ secrets.ECASAPISECURITYSETTINGS__USERNAME}}'
ECASAPISECURITYSETTINGS__PASSWORD: '${{ secrets.ECASAPISECURITYSETTINGS__PASSWORD}}'
DYNAMICSAUTHENTICATIONSETTINGS__CLOUDCLIENTID: '${{ secrets.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDCLIENTID}}'
DYNAMICSAUTHENTICATIONSETTINGS__CLOUDCLIENTSECRET: '${{ secrets.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDCLIENTSECRET}}'
DYNAMICSAUTHENTICATIONSETTINGS__CLOUDUSERNAME: '${{ secrets.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDUSERNAME}}'
TENANTID: '${{ secrets.TENANTID}}'
MIN_REPLICAS: '1'
MAX_REPLICAS: '2'
MIN_CPU: 300m
MAX_CPU: 600m
MIN_MEM: 250Mi
MAX_MEM: 500Mi

#frontend config maps vars
APP_DEBUG: 'FALSE'
DYNAMICSBASEURL: http://ecas-api:8080/api
DOCUMENTROOT: /public
#ecas api config maps vars
ASPNETCORE_ENVIRONMENT: 'Production'
DYNAMICSAUTHENTICATIONSETTINGS__ACTIVEENVIRONMENT: Cloud
DYNAMICSAUTHENTICATIONSETTINGS__CLOUDWEBAPIURL: https://ecas.api.crm3.dynamics.com/api/data/v9.2/
DYNAMICSAUTHENTICATIONSETTINGS__CLOUDREDIRECTURL: https://localhost
DYNAMICSAUTHENTICATIONSETTINGS__CLOUDRESOURCEURL: https://ecas.crm3.dynamics.com/api/data/
DYNAMICSAUTHENTICATIONSETTINGS__CLOUDBASEURL: https://ecas.api.crm3.dynamics.com

#cas api config maps vars
ASPNETCORE_ENVIRONMENT_CAS: 'Production'
CAS_API_SERVER: https://cfs-prodws.cas.gov.bc.ca:7121
CAS_TOKEN_URI: /ords/cas/oauth/token
CAS_INVOICE_URI: /ords/cas/cfs/apinvoice/

HOST_ROUTE: '${{ secrets.SITE_URL }}'
BRANCH: "master"

CA_CERT: ${{ secrets.CA_CERT }}
CERTIFICATE: ${{ secrets.CERT }}
PRIVATE_KEY: ${{ secrets.PRIV_KEY }}
ENV: "prod"




on:
Expand All @@ -53,11 +61,12 @@ on:

jobs:
deploy-to-openshift-prod:
name: Deploy to OpenShift PROD
name: Deploy to OpenShift Prod
runs-on: ubuntu-24.04
environment: prod



steps:
- name: Check out repository
uses: actions/checkout@v2
Expand Down Expand Up @@ -96,20 +105,20 @@ jobs:
oc tag ${{ env.OPENSHIFT_NAMESPACE_TEST }}/${{ env.REPO_NAME }}-cas-api:${{ steps.get-latest-tag.outputs.tag }} \
${{ env.OPENSHIFT_NAMESPACE_PROD }}/${{ env.REPO_NAME }}-cas-api:${{ steps.get-latest-tag.outputs.tag }}

curl -s https://raw.githubusercontent.com/bcgov/${{ env.REPO_NAME }}/${{ env.BRANCH }}/openshift/update-configmap.sh | bash /dev/stdin "${{ env.REPO_NAME }}" "${{ env.OPENSHIFT_NAMESPACE_DEV }}" "${{env.APP_DEBUG}}" "${{env.DOCUMENTROOT}}" "${{ env.DYNAMICSBASEURL}}" "${{env.ASPNETCORE_ENVIRONMENT}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__ACTIVEENVIRONMENT}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDWEBAPIURL}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDREDIRECTURL}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDRESOURCEURL}}" "${{env.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDBASEURL}}" "${{env.ASPNETCORE_ENVIRONMENT_CAS}}" "${{env.CAS_API_SERVER}}" "${{env.CAS_TOKEN_URI}}" "${{env.CAS_INVOICE_URI}}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second argument for update-configmap.sh (${{env.OPENSHIFT_NAMESPACE_DEV}}) is not used in the script and also the environment variable does not exist. Suggest removing this argument from the script and updating other workflows that use this argument also.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed



# Process and apply deployment template

oc process -f ./openshift/templates/ecas-frontend/frontend.dc.yaml -p APP_NAME=${{ env.APP_NAME }} -p REPO_NAME=${{ env.REPO_NAME }} -p NAMESPACE=${{ env.OPENSHIFT_NAMESPACE_PROD }} -p TAG=${{ steps.get-latest-tag.outputs.tag }} -p MIN_REPLICAS=${{ env.MIN_REPLICAS }} -p MAX_REPLICAS=${{ env.MAX_REPLICAS }} -p MIN_CPU=${{ env.MIN_CPU }} -p MAX_CPU=${{ env.MAX_CPU }} -p MIN_MEM=${{ env.MIN_MEM }} -p MAX_MEM=${{ env.MAX_MEM }} -p HOST_ROUTE=${{ env.HOST_ROUTE }} -p APP_KEY=${{env.APP_KEY}} -p API_KEY=${{env.API_KEY}} -p DYNAMICS_USERNAME=${{env.DYNAMICS_USERNAME}} -p DYNAMICS_PASSWORD=${{env.DYNAMICS_PASSWORD}} -p KEYCLOAK_AUTHSERVERURL=${{env.KEYCLOAK_AUTHSERVERURL}} -p KEYCLOAK_REALM=${{env.KEYCLOAK_REALM}} -p KEYCLOAK_CLIENTID=${{env.KEYCLOAK_CLIENTID}}\
| oc apply -f -

oc process -f ./openshift/templates/ecas-frontend/frontend.dc.yaml -p APP_NAME=${{ env.APP_NAME }} -p REPO_NAME=${{ env.REPO_NAME }} -p NAMESPACE=${{ env.OPENSHIFT_NAMESPACE_PROD }} -p TAG=${{ steps.get-latest-tag.outputs.tag }} -p MIN_REPLICAS=${{ env.MIN_REPLICAS }} -p MAX_REPLICAS=${{ env.MAX_REPLICAS }} -p MIN_CPU=${{ env.MIN_CPU }} -p MAX_CPU=${{ env.MAX_CPU }} -p MIN_MEM=${{ env.MIN_MEM }} -p MAX_MEM=${{ env.MAX_MEM }} -p HOST_ROUTE=${{ env.HOST_ROUTE}} -p CA_CERT="${{ env.CA_CERT }}" -p CERTIFICATE="${{ env.CERTIFICATE }}" -p PRIVATE_KEY="${{ env.PRIVATE_KEY }}" -p ENV="${{env.ENV}}"| oc apply -f -



oc process -f ./openshift/templates/ecas-api/api.dc.yaml -p APP_NAME=${{ env.APP_NAME }} -p REPO_NAME=${{ env.REPO_NAME }} -p NAMESPACE=${{ env.OPENSHIFT_NAMESPACE_PROD }} -p TAG=${{ steps.get-latest-tag.outputs.tag }} -p MIN_REPLICAS=${{ env.MIN_REPLICAS }} -p MAX_REPLICAS=${{ env.MAX_REPLICAS }} -p MIN_CPU=${{ env.MIN_CPU }} -p MAX_CPU=${{ env.MAX_CPU }} -p MIN_MEM=${{ env.MIN_MEM }} -p MAX_MEM=${{ env.MAX_MEM }} -p HOST_ROUTE=${{ env.HOST_ROUTE }} -p ASPNETCORE_ENVIRONMENT=${{ env.ASPNETCORE_ENVIRONMENT }} -p ECASAPISECURITYSETTINGS__USERNAME=${{ env.ECASAPISECURITYSETTINGS__USERNAME }} -p ECASAPISECURITYSETTINGS__PASSWORD=${{ env.ECASAPISECURITYSETTINGS__PASSWORD }} -p DYNAMICSAUTHENTICATIONSETTINGS__CLOUDCLIENTID=${{ env.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDCLIENTID }} -p DYNAMICSAUTHENTICATIONSETTINGS__CLOUDCLIENTSECRET=${{ env.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDCLIENTSECRET }} -p DYNAMICSAUTHENTICATIONSETTINGS__CLOUDUSERNAME=${{ env.DYNAMICSAUTHENTICATIONSETTINGS__CLOUDUSERNAME }} -p TENANTID=${{ env.TENANTID }}\
oc process -f ./openshift/templates/ecas-api/api.dc.yaml -p APP_NAME=${{ env.APP_NAME }} -p REPO_NAME=${{ env.REPO_NAME }} -p NAMESPACE=${{ env.OPENSHIFT_NAMESPACE_PROD }} -p TAG=${{ steps.get-latest-tag.outputs.tag}} -p MIN_REPLICAS=${{ env.MIN_REPLICAS }} -p MAX_REPLICAS=${{ env.MAX_REPLICAS }} -p MIN_CPU=${{ env.MIN_CPU }} -p MAX_CPU=${{ env.MAX_CPU }} -p MIN_MEM=${{ env.MIN_MEM }} -p MAX_MEM=${{ env.MAX_MEM }} -p HOST_ROUTE=${{ env.HOST_ROUTE }} \
| oc apply -f -


oc process -f ./openshift/templates/cas-api/cas-api.dc.yaml -p APP_NAME=${{ env.APP_NAME }} -p REPO_NAME=${{ env.REPO_NAME }} -p NAMESPACE=${{ env.OPENSHIFT_NAMESPACE_PROD }} -p TAG=${{ steps.get-latest-tag.outputs.tag }} -p MIN_REPLICAS=${{ env.MIN_REPLICAS }} -p MAX_REPLICAS=${{ env.MAX_REPLICAS }} -p MIN_CPU=${{ env.MIN_CPU }} -p MAX_CPU=${{ env.MAX_CPU }} -p MIN_MEM=${{ env.MIN_MEM }} -p MAX_MEM=${{ env.MAX_MEM }} -p HOST_ROUTE=${{ env.HOST_ROUTE }}\
oc process -f ./openshift/templates/cas-api/cas-api.dc.yaml -p APP_NAME=${{ env.APP_NAME }} -p REPO_NAME=${{ env.REPO_NAME }} -p NAMESPACE=${{ env.OPENSHIFT_NAMESPACE_PROD }} -p TAG=${{ steps.get-latest-tag.outputs.tag}} -p MIN_REPLICAS=${{ env.MIN_REPLICAS }} -p MAX_REPLICAS=${{ env.MAX_REPLICAS }} -p MIN_CPU=${{ env.MIN_CPU }} -p MAX_CPU=${{ env.MAX_CPU }} -p MIN_MEM=${{ env.MIN_MEM }} -p MAX_MEM=${{ env.MAX_MEM }} -p HOST_ROUTE=${{ env.HOST_ROUTE }}\
| oc apply -f -


Expand Down
27 changes: 13 additions & 14 deletions openshift/update-configmap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@
#ENV VARS
###########################################################
REPO_NAME=$1
NAMESPACE=$2
APP_DEBUG=$3
DOCUMENTROOT=$4
DYNAMICSBASEURL=$5
APP_DEBUG=$2
DOCUMENTROOT=$3
DYNAMICSBASEURL=$4

ASPNETCORE_ENVIRONMENT=$6
DYNAMICSAUTHENTICATIONSETTINGS__ACTIVEENVIRONMENT=$7
DYNAMICSAUTHENTICATIONSETTINGS__CLOUDWEBAPIURL=$8
DYNAMICSAUTHENTICATIONSETTINGS__CLOUDREDIRECTURL=$9
DYNAMICSAUTHENTICATIONSETTINGS__CLOUDRESOURCEURL=${10}
DYNAMICSAUTHENTICATIONSETTINGS__CLOUDBASEURL=${11}
ASPNETCORE_ENVIRONMENT=$5
DYNAMICSAUTHENTICATIONSETTINGS__ACTIVEENVIRONMENT=$6
DYNAMICSAUTHENTICATIONSETTINGS__CLOUDWEBAPIURL=$7
DYNAMICSAUTHENTICATIONSETTINGS__CLOUDREDIRECTURL=$8
DYNAMICSAUTHENTICATIONSETTINGS__CLOUDRESOURCEURL=$9
DYNAMICSAUTHENTICATIONSETTINGS__CLOUDBASEURL=${10}

ASPNETCORE_ENVIRONMENT_CAS=${12}
CAS_API_SERVER=${13}
CAS_TOKEN_URI=${14}
CAS_INVOICE_URI=${15}
ASPNETCORE_ENVIRONMENT_CAS=${11}
CAS_API_SERVER=${12}
CAS_TOKEN_URI=${13}
CAS_INVOICE_URI=${14}

###########################################################
#Setup for config-maps
Expand Down
Loading