The BCDevExchange is a web application that represents a supportive community enabling the government in British Columbia, Canada to deliver better digital services.
- BCDK : The Jenkins pipeline for deployment is being set up by using BC Gov's tool named bcdk. More details can be found here:https://github.com/david-kerins/bcdk
- SonarQube : SonarQube is an open-source platform developed by SonarSource to detect bugs, code smells, and security vulnerabilities. More details can be found here:https://www.sonarqube.org/
- Matomo : Matomo is a free and open source web analytics application. It is being used to track online visits to the bcdevexchange website and display reports. More details can be found here:https://matomo.org/
Features should be implemented in feature branches. Create a pull request against the develop branch to have your work reviewed for subsequent deployment. The develop branch contains all approved code. The master branch contains work that has passed the Quality Assurance process and is ready to be deployed to production. Hotfixes can be merged directly to master via a pull request, but should be merged back into the develop branch as well.
Dependencies
- .Net Core 2.2
- Docker
Run Locally
- Install .Net Core 2.2 https://dotnet.microsoft.com/download/dotnet-core/2.2
- Make an .env file locally and place the BEARER_TOKEN needed from the site administrator. This BEARER_TOKEN is required for pulling the data from the Eventbrite API.
- Run the project using command dotnet run from the terminal.
Projects : We have four projects in the Openshift
- ifttgq-tools: This project is for deploying Jenkins pipeline and any infrastructural setup like matomo and sonar.
- ifttgq-dev: This project is for deploying pull request
- ifttgq-test: This is an intermediate project which ensures the code is correct before deploying it to the prod project.
- ifttgq-prod: This project reflects the current status of master branch.
Environment : We have three environments:
OpenShift Project | Name | URL |
---|---|---|
ifttgq-dev | Development | https://bcdevexchange-dev-{PR}-ifttgq-dev.pathfinder.gov.bc.ca |
ifttgq-test | Testing | https://bcdevexchange-test-ifttgq-test.pathfinder.gov.bc.ca |
ifttgq-prod | Production | https://bcdevexchange-prod-ifttgq-prod.pathfinder.gov.bc.ca |
Deployment Process
The "ifttgq-tools" OpenShift project is used to trigger the deployment process for all environments. On creation of every pull request against the develop branch, a deployment containing the pull request number starts in the dev project. The deployment gets updated on every change to the pull request. The develop branch reflects the current pull request deployment in the dev project. To deploy to the Test and Prod environment, merge the develop branch into the master branch. "ifttgq-prod" has been configured to start the deployment process for production automatically when commits are made to the master branch.
The bcdevexchange is currently operated by the BC DevExchange Lab within the Government of British Columbia.
--- NOTES
➜ bcdevexchange git:(master) ✗ oc process -f openshift/nsp-tools.yaml -p NAMESPACE=$(oc project --short)| oc apply -f - externalnetwork.security.devops.gov.bc.ca/all-things-external created networksecuritypolicy.security.devops.gov.bc.ca/builder-to-internet created
➜ bcdevexchange git:(master) ✗ oc process -f openshift/templates/nsp.yaml -p NAMESPACE=$(oc project --short) | oc create -f - externalnetwork.security.devops.gov.bc.ca/all-things-external created networksecuritypolicy.security.devops.gov.bc.ca/server-to-internet created
➜ bcdevexchange git:(master) ✗ oc process -f openshift/templates/secrets.yaml --param-file=./openshift/bcdevx-secrets.properties| oc apply -f - secret/bcdevx-creds created
oc process -f openshift/templates/deploy.yaml --param-file=openshift/bcdevx-dev.properties -p TLS_CERT_PEM="$(cat ./openshift/certificate.pem)" -p TLS_KEY_PEM="$(cat ./openshift/key.pem)" -p TLS_CACERT_PEM="$(cat ./openshift/ca.pem)"| oc apply -f - service/bcdevexchange unchanged route.route.openshift.io/bcdevexchange unchanged deploymentconfig.apps.openshift.io/bcdevexchange configured horizontalpodautoscaler.autoscaling/bcdevexchange configured
➜ bcdevexchange git:(master) ✗ oc process -f openshift/templates/matomo-secrets.yaml --param-file=./openshift/matomo-secrets.properties| oc apply -f - secret/matomo-creds created