Доработать инструменты экспериментов: чередовать повторы, останавливать лестницу на первой проваленной ступени, задавать maxconn и CPU базы в сериях, записывать замер скорости хоста и контроль шума, сократить комментарии

This commit is contained in:
2026-11-04 12:39:04 +03:00
parent ce47c138e4
commit baa5995938
24 changed files with 253 additions and 240 deletions
+8 -18
View File
@@ -1,21 +1,12 @@
#!/bin/sh
# Rolling update of the API without downtime, with docker rollout
# (https://github.com/wowu/docker-rollout, MIT): it starts as many new
# replicas as are running, waits until all of them are healthy, then stops
# and removes the old ones. If a new replica does not become healthy it
# removes the new ones and leaves the old ones serving, so the stand is never
# left with a mix of versions.
# Rolling update of the API with docker rollout (github.com/wowu/docker-rollout,
# MIT): new replicas start next to the old ones, and the old ones go once all
# new ones are healthy; if one is not, the new ones are removed instead.
#
# Every replica must be running. With a stopped one (say, after stop-one),
# docker rollout only replaces the stopped one and reports success, which
# would leave old and new versions side by side; the script refuses instead.
#
# The migrations of the new version run first, once, while the old replicas
# serve: they only add to the schema. docker rollout scales with `compose up`,
# which also starts the dependencies of the API and would rerun the old,
# exited migrate container. Recreating it beforehand from the new image,
# without starting it, makes that `up` run the new migrations exactly once,
# before any new replica starts.
# With a stopped replica docker rollout would replace only that one and leave
# two versions running, so the script refuses. The migrate container is
# recreated from the new image without starting: the `up` of docker rollout
# then applies the new migrations once, before any new replica starts.
set -eu
cd "$(dirname "$0")/.."
@@ -44,8 +35,7 @@ docker compose build api
docker compose up --no-start --no-deps --force-recreate migrate
# Run through sh: Windows cannot use the script as a docker CLI plugin.
if ! sh "$tool" rollout --wait-after-healthy 4 api; then
# A failed migration stops the scale-up after the new containers were
# created but before they started; remove them for a clean next attempt.
# A failed migration leaves the new containers created but not started.
created=$(docker compose ps -aq --status created api)
if [ -n "$created" ]; then
docker rm $created >/dev/null