Skip to content

Commit eda21c3

Browse files
Merge branch 'claude/stoic-wescoff-9fc052' into master: the blue-green switch restarts nothing with the server's docker 29.8.1 (checked on the four Folia services: the raw PreviousSpec equals the Spec after a switch, every task older than its switch still runs); a docker CLI before 29.8.0 sorts the mounts on every service update (docker/cli#7227) and so restarts Folia, which 55-switch.sh now says in its comments and in the warning it prints when the tasks change; docker service inspect fills swarm's defaults into Spec only, so its PreviousSpec/Spec diff always shows an empty DNSConfig
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 parents 9b7e642 + c8949a6 commit eda21c3

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

‎deploy/vps/55-switch.sh‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
# than the schema its build reads. Asked directly on docker_gwbridge, past Traefik, which
1313
# still sends the host to the other one.
1414
# 2. Its router gets a priority above every other router for the host. That is a label of the
15-
# service, not of its tasks: nothing restarts. Traefik reads it the next time it looks at
16-
# the swarm (every 15 s).
15+
# service, not of its tasks: nothing restarts (with docker 29.8.0 or newer; raise_priority
16+
# says why). Traefik reads it the next time it looks at the swarm (every 15 s).
1717
# 3. Requests to https://<host>/livez until Traefik's access log names this instance's router
1818
# three times in a row (up to SWITCH_TIMEOUT seconds).
1919
# The other instance keeps running as it is: it is the rollback, and while this one has no healthy
@@ -115,13 +115,21 @@ raise_priority() {
115115
return 0
116116
fi
117117
before="$(running_tasks "${SERVICE}")"
118-
# --detach: a label of the service changes no task, so there is nothing to wait for.
118+
# --detach: a label of the service changes no task, so there is nothing to wait for, as long as
119+
# the CLI changes nothing else: "service update" hands swarm the whole spec back. Before docker
120+
# 29.8.0 it sorted the mounts on every call (docker/cli#7227), which moved Folia's tmpfs to the
121+
# front: a new task template for swarm, so the web server restarted, and Traefik sent the host
122+
# back to the other colour until it was healthy (a test swarm with 29.3.1). The switches on the
123+
# server (29.8.1) changed the label and nothing else (checked 2026-09-30). What an update
124+
# changed: .PreviousSpec against .Spec from the Engine API (curl -s --unix-socket
125+
# /var/run/docker.sock http://localhost/services/<name>), not from "docker service inspect",
126+
# which fills swarm's defaults into .Spec only (an empty DNSConfig, the rollback's Monitor).
119127
docker service update --detach=true --label-add "${PRIORITY_LABEL}=$((best + 1))" "${SERVICE}" >/dev/null
120128
log "${ROUTER}: priority ${own} -> $((best + 1)) (${others[*]}: ${best})"
121129
sleep 3
122130
after="$(running_tasks "${SERVICE}")"
123131
if [[ "${before}" != "${after}" ]]; then
124-
warn "the tasks of ${SERVICE} changed with the label (${before}-> ${after}); swarm is not meant to restart them for it"
132+
warn "the tasks of ${SERVICE} changed with the label (${before}-> ${after}): docker $(docker version --format '{{.Client.Version}}' 2>/dev/null || true) sent swarm more than the label (before 29.8.0 the CLI sorts the mounts), and swarm restarts the web server for it. Until the new task is healthy, Traefik sends https://${INSTANCE_HOST} to ${others[*]}; the next step waits for that"
125133
fi
126134
}
127135

0 commit comments

Comments
 (0)