Repository navigation
Commit c8b9781
authored
deploy.sh: pre-flight checks in one table before announcing, an earlier nexus warm, and a safer image check (#14799)
* deploy.sh: warm the nexus cache during the wizard's earlier steps
The wizard now starts the one-server olbase pull that warms the registry
mirror as soon as the image is built, so it runs during the announcement
and olsystem deploy, not while deploy_images waits on it.
deploy_images still looks up the digest after deploy_openlibrary's image
check, and pulls again if olbase:latest has changed since the early warm,
so it never deploys an older image than the one the check passed.
Also:
- Pick the amd64 image's digest; `.images[0]` could be the arm64 one.
- Check server access at the start of the wizard, not half an hour later,
and list every unreachable server rather than stopping at the first.
- Stop background jobs on any exit (EXIT trap), not only via clean_exit.
- Add `deploy.sh warm` to run just the warm.
* deploy.sh: check server access in parallel, while olbase builds
- check_server_access runs on every server at once, with the same
per-server board as deploy_images (now shared: start_server_job,
wait_for_server_jobs, end_server_jobs). SSH's error is shown indented
under the server that failed. BatchMode, so a password or host key
prompt fails instead of six prompts drawing over each other.
- The wizard starts the olbase build (or the early warm) first and checks
access while it builds.
- Server jobs drop only their own pids from BACKGROUND_PIDS rather than
emptying it, so the exit trap still stops a warm that is running.
- Add `deploy.sh access` to run just the access check.
* deploy.sh: check server storage in parallel
Same per-server board as the access check and image pulls, with each
failing server's df output shown under it. A server ssh can't reach now
fails the check; before, it got no sizes back and showed ✓.
* deploy.sh: no background ssh prompts, and simpler job cleanup
- Every background ssh (the nexus warm and server jobs) runs with
BatchMode, so a password or host key prompt fails instead of being drawn
over the wizard. The warm could start before the access check, so it
could prompt. The access check now says to ssh once by hand when that's
why it failed.
- The exit trap kills `jobs -p`, the jobs still running, rather than a
list of pids that could hold a finished warm's pid, since reused by
another process. Job output goes in one directory, removed on exit.
- wait_for_server_jobs also prints the failures and cleans up, replacing
the wait/end_server_jobs pair every caller repeated.
- Say why the wizard checks access where it does, and what replacing a
warm does.
* deploy.sh: don't treat a failed GitHub lookup as an up-to-date image
When GitHub's unauthenticated API limit (60 an hour per IP) ran out, the
latest commit came back as `null`, the timestamp comparison errored, and
check_olbase_image_up_to_date reported the image as up to date. The wizard
then skipped the olbase build, and deploy_openlibrary's check passed too.
- Call GitHub's API through `gh api` when gh is logged in (5,000 an hour),
falling back to curl.
- If the commit or image date can't be read, say so and return 1.
- Warn before the announcement when the latest release tag is missing,
since the links in it are then broken.
* test_deploy_sh: fail if deploy.sh's dispatch marker moves
The fixture sources deploy.sh up to the comment that starts its CLI
dispatch. If that comment changed, the split returned the whole file and
the tests would run the wizard (git checkout, pull) instead of failing.
* deploy.sh: drop the wizard's own server access check
deploy_olsystem already checks access a few minutes in, while olbase
builds, and deploy_openlibrary checks again; with the parallel check each
takes a couple of seconds. The extra check at the wizard's start only
moved a failure ahead of the Slack announcement, and made a full run
check three times.
* deploy.sh: run the pre-flight checks before announcing, in one table
Access, critical crons (ol-home0) and storage now run together as
preflight_checks: a row per server, a column per check, each cell filled
in as its check finishes. The wizard runs it before the Slack
announcement; the olsystem step a minute later skips it then, and the
openlibrary step runs it again after the olbase build. A failure lists
each server's output with how to fix it, then offers to retry; this
replaces check_server_access and check_crons (`deploy.sh preflight`
replaces `deploy.sh access`).
At most 6 ssh connections run at once. The servers are reached through
IA's ssh gateway, which dropped some of the 13 the table opened together
("Connection closed by ... port 22"). An unreachable server's error is
shown once, not under each check.
* deploy.sh: check local changes, copy and test nginx on all servers at once
Each was a loop of ssh calls, one server after another, and every ssh
goes through IA's ssh gateway, so each call cost two handshakes.
- The local-changes check runs one call per server in the server table;
if any server has changes it shows them and asks whether to go on.
- Copying streams the tarball through one ssh per server (tar reads it
on stdin), instead of scp plus three or four ssh calls each.
- The nginx test runs on its three hosts at once. Each host's command
tells a missing certificate (exit 3) from a bad rule, which the
classification used to do from the collected output.
- The ssh calls still made one after another (the swap, prune,
restart_servers.sh, are_servers_in_sync.sh) reuse one connection per
server for 5 minutes. The parallel jobs and the warm open their own
(-S none): a connection reused from before the access check would lack
the docker group that check adds.
* deploy.sh warm: say why it stops when the image is out of date
It stops rather than warm an image a deploy wouldn't use, but the stop
came through the ERR trap with no reason given.1 parent 1f8a33f commit c8b9781
2 files changed
Lines changed: 790 additions & 316 deletions
0 commit comments