feat(swarm): jq and labelled 50m x 5 container logs #44

Merged
claudiomaradonna merged 2 commits from feat/swarm-jq-docker-logs into main 2026-10-22 23:02:20 +02:00
Collaborator

Why

Swarm nodes need jq as a system tool, for scripts and for inspecting what
docker ... --format json prints. Their containers also need bigger logs
that carry every container label on each line, so log shippers can tell
services, stacks and tasks apart.

What changed

  • Every host with swarm_enabled set (the clustered group) gets
    swarm_packages, [jq] by default. This is the first task of the swarm
    role.
  • Swarm nodes override docker-engine's 10m x 3 log default with
    json-file, labels-regex: "^.+", max-size: "50m" and max-file: "5".
    The options reach a node only when its host_vars run docker-engine in
    install mode. Other hosts keep the role default.
  • The docker-engine README now says how to adopt an engine installed by
    hand from download.docker.com: remove the hand-added apt source before
    the first install run.

The engine is never restarted. The options apply from the next engine
restart, and only to containers created after it.

How to verify

  • ./tests/molecule/run.sh roles/swarm exits 0 with no ^ERROR line: jq
    is installed, and the second run reports no change.
  • ./tests/gates/check_docker_engine.sh: case 8 finds the clustered log
    options in daemon.json, and case 2 still finds 10m x 3.

Checks already run on the tip:

  • make check passed, on each commit.
  • check_docker_engine.sh passed; its case 8 fails on main at the
    assertion.
  • .agents/hooks/shellcheck.sh repo passed.
  • Not run: make test (every molecule scenario, including the new swarm
    one, and the tag_propagation gate), because podman was not available.

Considerations

  • Leaving the old one-line Docker source in place gives an apt warning that
    the repository is configured twice. If that source names a different key
    file, apt stops reading its sources instead. The README states the
    removal step but not this second case: a low review finding, set aside.
  • The swarm README says twice that the role installs packages: a low review
    finding, set aside.
## Why Swarm nodes need `jq` as a system tool, for scripts and for inspecting what `docker ... --format json` prints. Their containers also need bigger logs that carry every container label on each line, so log shippers can tell services, stacks and tasks apart. ## What changed - Every host with `swarm_enabled` set (the `clustered` group) gets `swarm_packages`, `[jq]` by default. This is the first task of the `swarm` role. - Swarm nodes override `docker-engine`'s `10m` x `3` log default with `json-file`, `labels-regex: "^.+"`, `max-size: "50m"` and `max-file: "5"`. The options reach a node only when its host_vars run `docker-engine` in `install` mode. Other hosts keep the role default. - The `docker-engine` README now says how to adopt an engine installed by hand from download.docker.com: remove the hand-added apt source before the first `install` run. The engine is never restarted. The options apply from the next engine restart, and only to containers created after it. ## How to verify - `./tests/molecule/run.sh roles/swarm` exits 0 with no `^ERROR` line: `jq` is installed, and the second run reports no change. - `./tests/gates/check_docker_engine.sh`: case 8 finds the `clustered` log options in `daemon.json`, and case 2 still finds `10m` x `3`. Checks already run on the tip: - `make check` passed, on each commit. - `check_docker_engine.sh` passed; its case 8 fails on `main` at the assertion. - `.agents/hooks/shellcheck.sh repo` passed. - Not run: `make test` (every molecule scenario, including the new `swarm` one, and the `tag_propagation` gate), because podman was not available. ## Considerations - Leaving the old one-line Docker source in place gives an apt warning that the repository is configured twice. If that source names a different key file, apt stops reading its sources instead. The README states the removal step but not this second case: a low review finding, set aside. - The swarm README says twice that the role installs packages: a low review finding, set aside.
The swarm role runs its first task: it installs swarm_packages, jq by
default, on hosts with swarm_enabled, so scripts and inspections on a
node can parse what docker prints as JSON. A molecule scenario proves
the install and its idempotence; the shared image pre-downloads jq.
Swarm nodes override docker-engine's 10m x 3 log default: json-file at
max-size 50m, max-file 5, with every container label on each line
(labels-regex "^.+") so log shippers can tell services and tasks apart.
They land where docker-engine runs in install mode, at the next engine
restart; other hosts keep the role default.
claudiomaradonna deleted branch feat/swarm-jq-docker-logs 2026-10-22 23:02:28 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
claudiomaradonna/castrum!44
No description provided.