default swarm.attic domain and cache to the swarm's own cache on every host
This commit is contained in:
parent
61292e865e
commit
606817a994
3 changed files with 80 additions and 57 deletions
|
|
@ -258,16 +258,18 @@ grant the forge refuses fails the build with no verdict.
|
|||
|
||||
## Binary cache
|
||||
|
||||
With `services.hyperhive.swarm.attic.domain` and `cache` set, the builder pushes
|
||||
each green meta build's closure to that cache, an attic server inside or outside the
|
||||
swarm, before it replies. It runs `attic push swarm:<cache> <out path>` once per build,
|
||||
`services.hyperhive.swarm.attic.domain` and `cache` default to the swarm's own
|
||||
cache (`attic.<swarm domain>` and `swarm`) on every host, so the builder pushes
|
||||
each green meta build's closure to it, or to the cache you override them with,
|
||||
before it replies. It runs `attic push swarm:<cache> <out path>` once per build,
|
||||
not `attic watch`, and the builder pushes again when the controller runs a build again. The
|
||||
push has ten minutes, or less when the reply is due sooner, because it must end
|
||||
inside the 61 minutes the controller waits. `attic` checks the server's certificate
|
||||
against the system roots and pins nothing, so a Let's Encrypt certificate
|
||||
works.
|
||||
|
||||
Set both options or neither: evaluation refuses a domain without a cache name.
|
||||
Set both options to a name or both to null: evaluation refuses one without the
|
||||
other. Null in both is how a swarm opts out of pushing.
|
||||
The cache name follows attic's rule, 1 to 50 letters, digits, `-`, `_` or `+`,
|
||||
starting with a letter or digit, and evaluation refuses any other name.
|
||||
|
||||
|
|
@ -281,8 +283,8 @@ The token is in no argument or variable, so no process listing shows it.
|
|||
The reply's `cached` says whether the push finished. A push that fails, times out
|
||||
or can't read the token leaves the build green with `cached` false and logs a
|
||||
warning with the reason; the deploy goes ahead and the next build of the agent
|
||||
tries again. With no cache set, the builder pushes nothing and `cached` is always
|
||||
false.
|
||||
tries again. With no attic behind the defaults, every push fails this way. With
|
||||
both options null, the builder pushes nothing and `cached` is always false.
|
||||
|
||||
Mixed versions:
|
||||
|
||||
|
|
@ -315,11 +317,9 @@ mints nothing. Both tokens last ten years and nothing renews them. To replace on
|
|||
write the new token to its path in the store: nothing mints over a value that
|
||||
exists. A new signing key invalidates both tokens.
|
||||
|
||||
With the switch on, `swarm.attic.domain` and `swarm.attic.cache` default to
|
||||
`attic.<swarm domain>` and `swarm`, so the builder on that host pushes to it.
|
||||
Naming either option yourself wins over its default. The defaults apply only on
|
||||
the host that runs the cache: on any other host, name both options too, with the
|
||||
same values.
|
||||
`swarm.attic.domain` and `swarm.attic.cache` default to `attic.<swarm domain>`
|
||||
and `swarm` on every host, whether or not it runs the cache, so a builder on any
|
||||
host pushes to it.
|
||||
|
||||
Storage is local disk in the container's state (`/var/lib/swarm-attic`). A store
|
||||
path nobody added or fetched for 14 days goes at the next garbage collection,
|
||||
|
|
@ -336,9 +336,10 @@ to its journal only; its journal doesn't reach the swarm log store.
|
|||
The cache can be an attic tenant on an instance outside the swarm. To point
|
||||
the swarm at an existing tenant:
|
||||
|
||||
1. On the builder host, set `services.hyperhive.swarm.attic.domain` to the
|
||||
1. Override the defaults: set `services.hyperhive.swarm.attic.domain` to the
|
||||
instance's host name (no scheme, `host:port` if it isn't on 443) and
|
||||
`services.hyperhive.swarm.attic.cache` to the cache's name on it.
|
||||
`services.hyperhive.swarm.attic.cache` to the cache's name on it. Set
|
||||
both options on every host that reads them.
|
||||
2. Seed the push token in the swarm secret store at
|
||||
`secret/swarm/services/attic/push-token`, field `value`. Use the store's UI,
|
||||
or `bao kv put` with `value=-` and the token on stdin, so the token is in no
|
||||
|
|
@ -350,9 +351,9 @@ pins nothing, so a Let's Encrypt certificate needs no setup. The builder
|
|||
reads the token again on every push, so a new token takes effect on the next
|
||||
build.
|
||||
|
||||
Where you host the shared services, `deploy.attic.enable` defaults on and runs
|
||||
the swarm's own cache. To use an external one, set it to `false` with
|
||||
`lib.mkForce`, then set the two options by hand and seed the token as above.
|
||||
To use an external cache, override the two defaults and don't set
|
||||
`deploy.attic.enable` anywhere. Where you host the shared services with
|
||||
`allSwarmServices`, it defaults on, so set it to `lib.mkForce false` there.
|
||||
The swarm then renders no container, vhost or unit of its own cache, and
|
||||
creates no secret in the store. The store's host still mints the cache's
|
||||
leaf and writes its role, which nothing logs in to.
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ the rest of the cell says how.
|
|||
| `swarm/services/review-classifier/acp-provider` | you, in the store's UI, field `api_key` | `swarm-review-classifier` | ❌ write a new key | ✅ read on every run |
|
||||
| `swarm/services/review-classifier/forge/token` | `swarm-controller`, at start and every 5 minutes | `swarm-controller` | ✅ when missing or no longer matching the forge | ✅ read on every review |
|
||||
| `swarm/services/builder/forge/token` | `swarm-controller`, at start and every 5 minutes | `swarm-builder`, `swarm-controller` | ✅ when missing or no longer matching the forge | ✅ read on every build |
|
||||
| `swarm/services/attic/push-token` | `swarm-bao-attic-tokens` on the cache's host, when none is stored; with an external cache, you, in the store's UI (field `value`), or `bao kv put` with `value=-` and the token on stdin | `swarm-builder` | ❌ write a new token; a token the cache refuses fails the push, and the build stays green with `cached` false | ✅ read on every push; with no `swarm.attic` cache set, nothing reads it |
|
||||
| `swarm/services/attic/push-token` | `swarm-bao-attic-tokens` on the cache's host, when none is stored; with an external cache, you, in the store's UI (field `value`), or `bao kv put` with `value=-` and the token on stdin | `swarm-builder` | ❌ write a new token; a token the cache refuses fails the push, and the build stays green with `cached` false | ✅ read on every push; with both `swarm.attic` options null, nothing reads it |
|
||||
| `swarm/services/attic/pull-token` | `swarm-bao-attic-tokens` on the cache's host, when none is stored; read-only, ten years | nothing yet | ❌ write a new token | must be stated |
|
||||
| `swarm/services/attic/jwt-secret` | `swarm-bao-attic-secret` on the cache's host, when none is stored | `swarm-bao-attic-secret`, `swarm-bao-attic-tokens` | ❌ a new key invalidates both tokens | ❌ atticd restarts when the file changes |
|
||||
| `swarm/services/ci-metrics/forge/token` | `swarm-controller`, at start and every 5 minutes | `swarm-ci-metrics`, `swarm-controller` | ✅ when missing or no longer matching the forge | ✅ read on every pass |
|
||||
|
|
|
|||
|
|
@ -437,12 +437,13 @@ for the CI runner. What it builds and why are in [`builder.md`](builder.md).
|
|||
The swarm's attic server, in a `swarm-attic` container on the host that sets
|
||||
`deploy.attic.enable`. `allSwarmServices` defaults it on wherever the host has
|
||||
the cache's store identity, as for the builder: the host that runs the store has
|
||||
it. Set `deploy.attic.enable = lib.mkForce false` to use an external cache
|
||||
instead and name `swarm.attic.{domain,cache}` yourself.
|
||||
it. For an external cache, override `swarm.attic.{domain,cache}` and don't set
|
||||
`deploy.attic.enable` anywhere, or set it to `lib.mkForce false` under
|
||||
`allSwarmServices`.
|
||||
|
||||
The container shares the host's network namespace and atticd listens on loopback
|
||||
only. The gateway serves it at `swarm.attic.domain` (default
|
||||
`attic.<swarm domain>`) over TLS, with no login in front, because attic checks
|
||||
`attic.<swarm domain>`, on every host) over TLS, with no login in front, because attic checks
|
||||
its own tokens. Storage is local disk in the container's state.
|
||||
|
||||
It needs no manual secret. Two host units, under the cache's own `attic` leaf,
|
||||
|
|
|
|||
Loading…
Reference in a new issue