This script is a wrapper to ensure that services are healthy and ready for code push and deployment tasks on Pantheon sites. It hardens the release process by adding:
- Parallel execution of healthcheck and deployment tasks on many sites
- Race condition handling for workflows and
terminus
commands - Automatic retry and wake of failed sites' services
To use this script, follow these steps:
-
Clone the gist and make the scripts executable:
git clone [email protected]:c0216cea7acfc042dcc78785ac1d0e7c.git keepalive-checks && cd keepalive-checks && chmod +x keepalive-checks.sh && chmod +x backend-tasks && chmod +x healthcheck-tasks
-
Set the
$SITES
variable inkeepalive-checks.sh
to the list of customer site UUIDs which should be primed for release. See https://gist.github.com/lcatlett/c0216cea7acfc042dcc78785ac1d0e7c#file-keepalive-checks-sh-L20-L22. The easiest method is via aterminus
command: eg:Voya clone org, sites which are tagged with "deploy":
SITES=$(terminus org:sites voya-financial-clone --field id --tag deploy --format=list)
Voya live org, sites using drupal platform upstream:
SITES=$(terminus org:sites voya-financial --upstream=b3d1c0a1-7aed-417e-95a6-510f0fe6ce34 --field=id --format=list)
-
Set the
$ENV
variable inkeepalive-checks.sh
to the desired Pantheon environment to run against - this should be the target environment for the release. See https://gist.github.com/lcatlett/c0216cea7acfc042dcc78785ac1d0e7c#file-keepalive-checks-sh-L20-L22 -
Ensure that you have installed and configured
nspct
, the CSE command line tool. See https://github.com/pantheon-systems/nspct and https://dev-nspct.pantheonsite.io/getting-started. -
To start the keepalive tasks against a customer site portfolio, execute the
keepalive-checks.sh
script in your cli:~/scripts/keepalive-checks ❯ ./keepalive-checks.sh
A logs directory will be created in your working directory indicating the status of each task per site as well as any failures that are retried.
-
Ensure that you have the required dependencies installed (e.g.,
terminus
,parallel
, etc.) before running the script. -
Adjust the number of parallel jobs by modifying the
--jobs
flag in therun_healthcheck_task
s andrun_backend_tasks
functions. -
Check the
logs
directory for execution logs and failed task retry information. -
To run this script at scheduled intervals or for a specific amount of time, use crontab or execute the script in a loop as a background process. eg:
while true do ./keepalive-checks.sh & sleep 1200 done