The packages port given at genesis is a module's setting, like every other
Every foundation port given at genesis became a per-node setting of the module
that binds it, except the package registry's: that one was fixed by rewriting
the builder's manifest when the installer registered it. Registering the builder
again from the catalogue undid it, and the forge's own module, when it took the
bootstrap forge over, came up on the catalogue's port — which on a machine where
a predecessor holds 3000 points the builder at the predecessor's forge.
So the rewrite is gone, and the port is recorded twice as a setting, both from
the one input:
- the forge's module is registered at genesis — not assigned, nothing of it runs
— so the controller has something to hold `{"ports": {"3000": <given>}}`
against. Assigning the forge later raises it on the port this machine was
given, and its container, its filter rule, its opening, what it serves and
what consumers are told all read it from there.
- the builder is given `{"serves": {"port": <given>}}`, which merges into the
binding it carries in place of one nothing can resolve yet.
A genesis on the catalogue's port records nothing and registers nothing, so it
does exactly what it did before.
novox/hq 04-ISSUES/085, ADR 0100
This commit is contained in:
@@ -47,6 +47,16 @@ const (
|
||||
defaultGiteaPort = 3000
|
||||
)
|
||||
|
||||
// ForgeModule is the module that owns the package registry — the one the bootstrap forge above is
|
||||
// a stand-in for, and which takes it over once the base exists.
|
||||
//
|
||||
// Named here because the port given for the package registry is that module's setting on this node
|
||||
// and not this installer's private number (novox/hq 04-ISSUES/085): the forge's own container, its
|
||||
// filter rule, its opening, what it says it serves and what consumers are told all read it from
|
||||
// there, so taking the bootstrap forge over does not move the registry back to the catalogue's
|
||||
// port.
|
||||
const ForgeModule = "gitea"
|
||||
|
||||
// RaisePackageRegistry puts a working npm registry in front of the base build. It is idempotent:
|
||||
// every step tolerates having been done, because genesis is safe to run again.
|
||||
func RaisePackageRegistry(ctx context.Context, o Options, d Deps, control controlPlane,
|
||||
@@ -100,6 +110,11 @@ func RaisePackageRegistry(ctx context.Context, o Options, d Deps, control contro
|
||||
return err
|
||||
}
|
||||
|
||||
say(" recording the port it was given as the forge module's own")
|
||||
if err := recordTheForgesPort(ctx, o, control, say); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
say(" delivering the builder its registry credential")
|
||||
if err := deliverBuilderNpm(ctx, o, control, builderPassword, say); err != nil {
|
||||
return err
|
||||
@@ -108,6 +123,43 @@ func RaisePackageRegistry(ctx context.Context, o Options, d Deps, control contro
|
||||
return nil
|
||||
}
|
||||
|
||||
// recordTheForgesPort makes the port given for the package registry a setting of the module that
|
||||
// serves it, on this node (novox/hq 04-ISSUES/085, ADR 0100).
|
||||
//
|
||||
// **The forge is the one foundation port that was not a setting.** The store's, the bus's, the
|
||||
// broker's management port and the registry's each become a `ports` setting of the module that
|
||||
// binds them, set where that module is registered and assigned; the forge is raised by hand here,
|
||||
// long before its module can be built, so there was no registration to hang it on and the number
|
||||
// lived in rewritten manifest text instead. So the manifest is registered here — not assigned, and
|
||||
// nothing of it runs — for the one thing registering buys: the controller will hold a setting
|
||||
// against it. Whenever somebody later assigns the forge on this node, it comes up on the port this
|
||||
// machine was given rather than on the catalogue's, and so does the address its consumers are told.
|
||||
//
|
||||
// A node given the catalogue's own port records nothing and registers nothing, so a genesis on the
|
||||
// defaults does exactly what it did before.
|
||||
func recordTheForgesPort(ctx context.Context, o Options, control controlPlane,
|
||||
say func(string)) error {
|
||||
if o.Ports.orDefaults().Packages == DefaultPorts().Packages {
|
||||
return nil
|
||||
}
|
||||
manifest, err := readManifest(o.Catalogue, ForgeModule)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%w\n"+
|
||||
"This is the module that owns the forge genesis just raised. Without it the port this "+
|
||||
"machine was given for the package registry is nobody's setting, and taking the forge "+
|
||||
"over would put it back on the catalogue's port", err)
|
||||
}
|
||||
remote := "/" + ForgeModule + "-module.json"
|
||||
if err := control.carrying(ctx, ForgeModule+"-module.json", manifest, remote); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := control.tell(ctx, "module", "add", remote); err != nil {
|
||||
return err
|
||||
}
|
||||
say(" registered " + ForgeModule + " — registered, not assigned: nothing of it runs yet")
|
||||
return setFoundationSettings(ctx, o, control, ForgeModule, say)
|
||||
}
|
||||
|
||||
// seedGiteaDatabase creates gitea's role and database inside the foundation postgres, the same way
|
||||
// the foundation creates its own — psql run through the store container (the map's Route B). The role
|
||||
// is created before the database because the database is owned by it. Both are tolerant of already
|
||||
|
||||
Reference in New Issue
Block a user