One of the primary tasks around maintaining digital.gov.bc.ca WordPress instance involve keeping relevant parts of the system up to date. There are 4 parts of the system that can be upgraded:
WordPress version upgrade
Stock plugins
BCGov Block Theme
Digimod plugins
All upgrades follow the same pathway to ensure the stability of the system:
Replicate production to the test instance to get a clone of production environment
Capture screenshots on the test instance before the upgrade is made
Perform upgrades on test
Verify screenshots to capture any regressions resulting from upgrades
Perform adjustments until screenshot tests pass
Perform the same set of upgrades on production
Setup
The steps below are common to all upgrade tasks and should be done as a pre-requisite before an actual upgrade is attempted.
Create a fresh test instance
The first step for any upgrade process is to create a fresh instance of test instance of WordPress. To do so, run the Create WordPress Instance workflow with default parameters (“test”/”test”). This will create a blank WordPress deployment at https://digital-test.apps.silver.devops.gov.bc.ca/. For more information about this workflow, see the relevant section in the DevOps Guide.
Replicate production to test instance
Once the fresh instance of WordPress has been setup, run the Site Export from Production workflow with default parameters (“test”/”test”). For more information about this workflow, see the relevant section in the DevOps Guide. Once complete, verify that https://digital-test.apps.silver.devops.gov.bc.ca/ contains production replica.
Note: You will not be able to login into this instance as the SSO plugin has not been configured (user will receive “Invalid parameter: redirect_uri” error when attempting to login). To enable Keycloak logins into the test instance, see the next step
Enable Keycloak login on test instance
To enable Keycloak logins on the test instance (after Site Export from Production has been ran), run the Reconfigure SOO workflow with default parameters (“test”/”test”). For more information about this workflow, see the relevant section in the DevOps Guide. Once complete, verify that you can login using Keycloak into the test instance (https://digital-test.apps.silver.devops.gov.bc.ca/).
Verify WordPress version
Ensure that the WordPress version installed on production is the same as that running on the test instance.
Capture Screenshots
Now that the test instance contains the exact replica of production, run the Take screenshots workflow to capture the state of the site before any upgrades. For more information about this workflow, see the relevant section in the DevOps Guide.
Upgrades
The following sections lists the instructions for doing various kinds of upgrades on the test instance once the setup section above has been completed.
WordPress version upgrade
Check for new WordPress version
To see if a new WordPress version is available, check the status page of the production site logged in as administrator (https://digital.gov.bc.ca/wp-admin/update-core.php). Note: do not update WordPress through this interface, this is only for checking if a new version is available.
Determine tag name for the new WordPress version
The next step in the upgrade process is to find the tag name for the newly released version of WordPress. To do this, navigate to https://hub.docker.com/_/wordpress/tags page and locate the fpm version of tag with the latest version, for example 6.2.0-php8.2-fpm. Important: ensure that the format of the tag is precise, e.g. {WORDPRESS_VERSION}-php{PHP_VERSION}-fpm.
Build new WordPress version to latest tag in OpenShift
Rename latest tag to test tag
Now that the latest image has been built to “latest” tag, rename it to “test” tag in order for the new image to be available to the test instance of the site. To do this, run the Rename latest WordPress tag workflow with default parameter (“test”).