How-to library · Developer docs

How-to library

Task-shaped pages: a title that starts with a verb, the situation in a few lines, the steps, the working code in both engines, and why this way rather than another. Found from a search, done, and left.

Run the go-live checklist

Launch day in the order it has to happen, with one script that checks the things people forget after the DNS switch, and the template guard that keeps staging out of search engines.

Context

Context. The site is ready, the date is set, and the team has the printed checklist (The go-live checklist). This how-to is the launch day itself: the order of the steps, and a script that runs every check that can be automated, so that nobody tests the redirects by clicking three of them. Run the script once on staging the day before, so its output on the day holds no surprises.

Steps

  1. Release to production and confirm the commit is live from the release meta tag (seeing which commit is live).
  2. Import the redirects on production (importing in bulk).
  3. Open robots: the template guard below does it per environment; check robots.txt allows crawling.
  4. Switch the DNS.
  5. Clear the production cache, so that no page stored before the redirects and the robots change is served (the manual clear).
  6. Run the script below and fix every line it prints.
  7. Place a real order and refund it, if the site sells (the live check).
  8. Submit the sitemap once the script reports it as ready, and start the first-hour monitoring (Launch-day monitoring).

Code

The robots guard, in the base template: production's primary hostname is indexed, everything else is not, so the change on launch day is the DNS, not a template edit:

Template code
{if $_currentSite->isPrimary()}
  <meta name="robots" content="index, follow">
{else}
  <meta name="robots" content="noindex, nofollow">
{/if}
{% if _currentSite.isPrimary() %}
  <meta name="robots" content="index, follow">
{% else %}
  <meta name="robots" content="noindex, nofollow">
{% endif %}

The launch-day script. It warms the cache with the most-visited pages, checks every other hostname redirects to the primary one, runs the redirect test over the whole map, looks for test payment methods, and checks the sitemap and robots.txt:

Shell
#!/bin/sh
# go-live-checks.sh: run after the DNS switch and the cache clear
site="https://www.example.com"
other_hosts="example.com"

echo "== warming the most-visited pages"
while read -r path; do
  code=$(curl -s -o /dev/null -w '%{http_code}' "$site$path")
  [ "$code" = 200 ] || echo "FAIL $path answered $code"
done < top-urls.txt

echo "== other hostnames redirect to the primary one"
for host in $other_hosts; do
  loc=$(curl -s -o /dev/null -w '%{http_code} %{redirect_url}' "https://$host/")
  [ "$loc" = "301 $site/" ] || echo "FAIL https://$host/ -> $loc"
done

echo "== redirect map"
./test-redirects.sh "$site" redirects.csv

echo "== no test payment methods"
curl -s "$site/cdna-api/invoices/payment-methods?active=1" \
  | grep -E '"paymentServiceProviderType": ?"mock-pay"|"testMode": ?true' && echo "FAIL a test payment method is active"

echo "== sitemap and robots"
[ "$(curl -s -o /dev/null -w '%{http_code}' "$site/sitemap.xml")" = 200 ] || echo "WAIT sitemap is still being generated; run again in a few minutes"
curl -s "$site/robots.txt" | grep -qi '^disallow: /$' && echo "FAIL robots.txt disallows the whole site"

echo "== done: anything above marked FAIL needs fixing before you announce the launch"

test-redirects.sh is the script on testing every entry, and top-urls.txt is the list of the old site's most-visited paths.

Why this and not that

Clicking through a launch by hand checks what the team remembers to check; a script checks the same things every time, on staging the day before and on production on the day, and leaves a record. The robots guard keys on the primary hostname rather than a flag someone has to flip on launch day, because flags flipped under pressure are the ones forgotten: every staging site that ended up in search results had a "remember to remove noindex" step in its plan. The order of the steps is the order of their dependencies: redirects before the cache clear, the cache clear before the redirect test, and the test before anyone announces the launch.

Go deeper

Was this page helpful?

Your answer goes to the docs team.