Open setup screens or a console when llmgw runs bare in a terminal

With nothing installed, sudo llmgw asks for one machine or three, takes how
to reach the other two (ssh agent, key or password, and a sudo password used
only for the install), checks every machine first, shows the plan and its
command line, and installs. On a control plane it opens a console with the
cluster's state and the next steps. Machines are reached with Go's ssh so a
password works; the store's etcd and access rules use this machine's routed
address rather than a client-facing name.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ilker ManapandClaude Opus 5.5 committed 2026-10-03 21:33:59 +02:00
1 parent 975c93994f
commit 38f2671ed9
13 files changed
+1954 -5

No files matched your search

+18 -1
View File
@@ -26,7 +26,11 @@ func (in *serverInit) ensurePatroni(ctx context.Context) (err error) {
in.kept("%s: %s", step, detail)
}
}}
setup.DB = in.patroniNodes
for _, t := range in.patroni {
if len(in.patroniNodes) > 0 {
break
}
user, host, ok := strings.Cut(t, "@")
if !ok {
user, host = "", t
@@ -46,7 +50,7 @@ func (in *serverInit) ensurePatroni(ctx context.Context) (err error) {
Remote: remote,
})
}
self, err := ipv4Of(in.reachableAddr())
self, err := sourceIPToward(setup.DB[0].IP)
if err != nil {
return err
}
@@ -146,6 +150,19 @@ func (in *serverInit) moveInto(ctx context.Context, from, to string) error {
return nil
}
// sourceIPToward is this machine's address on the route to another: the one
// the other machine sees it connect from, which is what etcd advertises and
// what the database lets in. Not the first --host, which names the gateway
// for its clients and may not resolve yet, or resolve to a floating address.
func sourceIPToward(ip string) (string, error) {
c, err := net.Dial("udp", net.JoinHostPort(ip, "5432"))
if err != nil {
return "", fmt.Errorf("no route from this machine to %s: %w", ip, err)
}
defer c.Close()
return c.LocalAddr().(*net.UDPAddr).IP.String(), nil
}
// ipv4Of is the address a host name or address stands for, as the other
// machines will be told to reach it.
func ipv4Of(host string) (string, error) {