default swarm.attic domain and cache to the swarm's own cache on every host
This commit is contained in:
parent
61292e865e
commit
606817a994
1 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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue