During high load scenarios such as winter storms, atmospheric rivers, flooding, etc there can be too much traffic hitting the Drivebc.ca desktop and mobile sites which causes reduced performance for end users.
To reduce the load on the current infrastructure by implementing a scalable caching solution that we can place in front of the desktop and mobile sites to reduce the load on the backend servers by serving site assets that are frequently accessed.
If you need to make changes to the helm charts or to the nginx.conf file follow these steps to release from dev to prod:
- Push your changes to
main
branch 1. Build & Deploy to Dev
Github action will automatically deploy to the dev namespace- Once ready to release to
tst
manually trigger2. Create Tag & Build/Deploy to Tst
Github action.- You will need to enter the version # you want to use and add a message
- Once ready to release to
stg
manually trigger3. Promote from Tst to Stg
- IMPORTANT: You must select the
Tag
you want to release and not the branch
- IMPORTANT: You must select the
- Once ready to release to
prd
create a new release by:- Going to the
https://github.com/bcgov/DriveBC.ca-Caching/releases
- Click
Draft a new release
- Under
Choose a tag
select the tag you want to release - Click
Generate Release Notes
- It should automatically give it a name
- Click
Publish release
- This will automatically trigger the Github action to do the release
- Going to the
For Prod you will need to add an additional route for https://cache.drivebc.ca
. To do that you will:
- Get the tls.crt, tls.key and ca.crt files (see internal documentation on getting those files)
- Login to openshift in your command window. Navigate to the folder with the certificate files
- Run
oc create route edge prd-drivebc-cache-prd-url --service=prd-drivebc-cache --cert=tls.crt --key=tls.key --ca-cert=ca.crt --hostname=cache.drivebc.ca
- Go to the web console and find the route, then go to YAML view
- Under spec: tls: create a line with
insecureEdgeTerminationPolicy: Redirect
- Save
If you are deploying to a new namespace you will need to update the pointers that GitHub actions uses to deploy the code. These are set with these steps:
- In Github navigate to Settings -> Environments
- Click on the environment you want to update
- OPENSHIFT_SERVER = URL that you use to login to OC using your command line
- OPENSHIFT_TOKEN = (in the Openshift GUI) User Management -> ServiceAccounts -> pipeline-> pipeline-token-xxxxx -> token
- OPENSHIFT_NAMESPACE = full name of the namespace, ie aaaaaa-prod
If you are deploying to a namespace for the first time use these steps:
- clone the repo to your PC
- Login to OpenShift using the oc command
- Navigate to the folder where you cloned the repo
- Run a command like this
helm install ENV-drivebc-cache -f ./helm/values-ENV.yaml ./helm --set image.tag=latest-ENV
- Once installed you can use GitHub actions for any future updates
Copyright 2024 Province of British Columbia
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.