Rename mesh-control -> mesh-controller, substrate -> foundation
One name per thing, per the HQ glossary: the module/container/image/binary/repo becomes mesh-controller, the seat the-controller, and the store+broker pair the foundation (embedded base bundles, default template and example lock renamed with their go:embed directives). No behaviour change — a pure vocabulary rename. Claude-Session: https://claude.ai/code/session_01D6qtiYU3P9jk3pnAXyAFyx
This commit is contained in:
@@ -14,7 +14,7 @@ import (
|
||||
// The base (mesh-tools) resolves the SDK by version from the mesh's package registry rather than
|
||||
// cloning it from a git URL (novox/hq ADR 0076, issue 053). So the registry has to answer, and the
|
||||
// SDK has to be in it, before the base build runs. That is a pivot like the control plane's: gitea's
|
||||
// SERVER is raised directly here, on the substrate's own postgres, and adopted as an ordinary module
|
||||
// SERVER is raised directly here, on the foundation's own postgres, and adopted as an ordinary module
|
||||
// only after the base exists (which is what lets its provisioner image — built on the base — run).
|
||||
//
|
||||
// Nothing here is the steady state. It is the smallest set of acts that puts a working npm registry
|
||||
@@ -22,9 +22,9 @@ import (
|
||||
// and the SDK published under it. The gitea MODULE, installed after the base, takes all of this over.
|
||||
|
||||
const (
|
||||
// substrateStore is the substrate's postgres container — the mesh's own memory, raised from the
|
||||
// foundationStore is the foundation's postgres container — the mesh's own memory, raised from the
|
||||
// bundle. gitea's bootstrap database lives here too, so a mesh runs one postgres (issue 051).
|
||||
substrateStore = "mesh-store"
|
||||
foundationStore = "mesh-store"
|
||||
// giteaBootstrap is the gitea server raised directly at genesis, before gitea is a module.
|
||||
giteaBootstrap = "mesh-gitea-server"
|
||||
// giteaImage is the same upstream image the gitea module runs, pinned identically so the module
|
||||
@@ -39,7 +39,7 @@ const (
|
||||
// builderGiteaUser is the gitea account the builder publishes and pulls with at genesis. It is
|
||||
// the `as` the builder's static package binding names.
|
||||
builderGiteaUser = "mesh-builder"
|
||||
// giteaDBRole/giteaDBName is gitea's own database in the substrate store.
|
||||
// giteaDBRole/giteaDBName is gitea's own database in the foundation store.
|
||||
giteaDBRole = "mesh_gitea"
|
||||
giteaDBName = "mesh_gitea"
|
||||
// giteaPort is where the raised server answers on the machine.
|
||||
@@ -59,7 +59,7 @@ func RaisePackageRegistry(ctx context.Context, o Options, d Deps, control contro
|
||||
return err
|
||||
}
|
||||
|
||||
say(" seeding gitea's database in the substrate store")
|
||||
say(" seeding gitea's database in the foundation store")
|
||||
if err := seedGiteaDatabase(ctx, run, o.Timeout, dbPassword, say); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -106,8 +106,8 @@ func RaisePackageRegistry(ctx context.Context, o Options, d Deps, control contro
|
||||
return nil
|
||||
}
|
||||
|
||||
// seedGiteaDatabase creates gitea's role and database inside the substrate postgres, the same way
|
||||
// the substrate creates its own — psql run through the store container (the map's Route B). The role
|
||||
// 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
|
||||
// existing, so a re-run changes nothing.
|
||||
func seedGiteaDatabase(ctx context.Context, run Runner, timeout time.Duration, password string,
|
||||
@@ -119,7 +119,7 @@ func seedGiteaDatabase(ctx context.Context, run Runner, timeout time.Duration, p
|
||||
// transaction and \gexec does not parse through -c. The password is base64url, so it carries no
|
||||
// quote or backslash to escape inside a SQL literal.
|
||||
psql := func(sql string) (string, error) {
|
||||
return run(asking, "docker", "exec", substrateStore, "psql", "-U", "postgres", "-tAc", sql)
|
||||
return run(asking, "docker", "exec", foundationStore, "psql", "-U", "postgres", "-tAc", sql)
|
||||
}
|
||||
|
||||
// The role: create it, and if it is already there (create fails) reset its password so a re-run
|
||||
@@ -128,7 +128,7 @@ func seedGiteaDatabase(ctx context.Context, run Runner, timeout time.Duration, p
|
||||
if _, err := psql(create); err != nil {
|
||||
alter := fmt.Sprintf("ALTER ROLE %s LOGIN PASSWORD '%s'", giteaDBRole, password)
|
||||
if _, err := psql(alter); err != nil {
|
||||
return fmt.Errorf("could not create gitea's role in %s: %w", substrateStore, err)
|
||||
return fmt.Errorf("could not create gitea's role in %s: %w", foundationStore, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,17 +136,17 @@ func seedGiteaDatabase(ctx context.Context, run Runner, timeout time.Duration, p
|
||||
// second create is an error rather than a no-op.
|
||||
present, err := psql(fmt.Sprintf("SELECT 1 FROM pg_database WHERE datname='%s'", giteaDBName))
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not check for gitea's database in %s: %w", substrateStore, err)
|
||||
return fmt.Errorf("could not check for gitea's database in %s: %w", foundationStore, err)
|
||||
}
|
||||
if strings.TrimSpace(present) != "1" {
|
||||
if _, err := psql(fmt.Sprintf("CREATE DATABASE %s OWNER %s", giteaDBName, giteaDBRole)); err != nil {
|
||||
return fmt.Errorf("could not create gitea's database in %s: %w", substrateStore, err)
|
||||
return fmt.Errorf("could not create gitea's database in %s: %w", foundationStore, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// raiseGiteaServer starts the gitea server container against the substrate store. It joins the
|
||||
// raiseGiteaServer starts the gitea server container against the foundation store. It joins the
|
||||
// store's network namespace so `127.0.0.1:5432` reaches postgres, and publishes its own port on the
|
||||
// machine so the builder and this installer can reach it. Started if absent, left alone if present.
|
||||
func raiseGiteaServer(ctx context.Context, run Runner, timeout time.Duration, dbPassword string,
|
||||
@@ -179,7 +179,7 @@ func raiseGiteaServer(ctx context.Context, run Runner, timeout time.Duration, db
|
||||
}
|
||||
args := append([]string{
|
||||
"run", "-d", "--name", giteaBootstrap,
|
||||
// Host network, like the control plane: it reaches the substrate store on the machine's
|
||||
// Host network, like the control plane: it reaches the foundation store on the machine's
|
||||
// loopback (where the store publishes 5432) and answers on the machine's own 3000, which is
|
||||
// where mesh-bootstrap and the builder's build containers look for it.
|
||||
"--network", "host",
|
||||
|
||||
Reference in New Issue
Block a user