...
Code Block | ||
---|---|---|
| ||
const ( BlueService SelectorName = "blue" GreenService SelectorName = "green" InitialCanaryService SelectorName = "blue" ) |
...
Upgrading a Canary Service/Deployment
Upgrading a deployment/canary service is done by specifying the image hash value and putting it on the canary service. This affects the active canary service. See below for examples.
Update active canary service:
Code Block |
---|
POST /services
{
"selector": "green"
} |
...
If the active service is already the selector given, then a message telling the user is provided:
...
Before:
Code Block |
---|
iiq-wp-platform git:(dev) kc get configmap -n wp-platform -o yaml apiVersion: v1 items: - apiVersion: v1 data: canaryEnv: '{"selector":"blue","image":"961406424767.dkr.ecr.us-west-2.amazonaws.com/rezfusion-cloud:dev"}' kind: ConfigMap ... |
...
Code Block |
---|
POST /sites/create { "id": "gggrrr", "hostnames": ["gggrrr.cloud2-stg.rezfusion.com"], "service": "blue", "name": "Project Bluelaunch | GGGrrr", "canonicalHostname": "gggrrr.cloud2-stg.rezfusion.com" } |
This will create the AWS Dynamo DB entry for the site as well as relevant secrets for accessing the database and WP CMS.
Fetching Site Details
Site details can be viewed by running a GET
request against /sites/rrr
:
Code Block |
---|
GET /sites/{site-id} |
...
Provision
After creating a site, it is able to be provisioned. Provisioning a site means that an actual site instance, along with relevant databases created, S3 bucket subdirectories, etc. for the site to use. This endpoint kicks off the installation of a WP site, a job to add an Ingress entry, and a job to activate the desired theme for a given site.
...
Assuming all goes well, a site should be visible at the hostname configured during /sites/create
within 5-10 minutes.
Code Block |
---|
rrr-activate-theme-78-wqzk5 0/1 Completed 0 16m
rrr-install-78-zdlsg 0/1 Completed 0 16m |
Upgrade
Upgrading a site is the act of moving it from the current service to the active canary service. When a site upgrades the following queued jobs are triggered.
Jobs Executed:
FlushCaches
Code Block |
---|
PUT /sites/{site-id}/upgrade |
...
Code Block |
---|
rrr-cache-flush-79-ptwfc 0/1 Completed 0 20s |
Promote
Promoting, almost identical to upgrading, moves a site to the active Canary service. Additionally, this triggers several queued jobs on the given site after moving to the new image.
Jobs executed:
FlushCaches
PatchIngress
Code Block |
---|
PUT /sites/{site-id}/promote |
Reverting Bad Deployments/Rollbacks
...
Before:
...
Sent request:
...
After:
AWS Secrets are deleted (with a 7 day recovery period):
...
DB is deleted
...
Ingress entry removed
...