A bundle carries what a cluster would download — llmgw's release with its signed checksums, every llama.cpp build per architecture with GitHub's checksums, model files pinned and checked against Hugging Face's — into a directory or a tar whose manifest sha256 is carried apart. Import checks everything, the release against the signing key, before anything is put in the mirror. With offline.mirror set, nodes install llama.cpp from the mirror against checksums the control plane holds and sends over the agent stream; releases default to the mirror for node add, ctl upgrade and agent upgrades. server init and the setup form install from a bundle. The Helm chart runs one control plane with SQLite on a claim or an external PostgreSQL, Secrets for the agent certificate and admin token, Services, Ingress and ServiceMonitor; deploy/container/Dockerfile builds its image. GPU nodes stay outside Kubernetes, as docs/kubernetes.md explains. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
68 lines
2.4 KiB
Go
68 lines
2.4 KiB
Go
package cli
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
"os"
|
|
"runtime"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
joinpkg "gitea.mynodes.xyz/ilker/llmgw/internal/join"
|
|
"gitea.mynodes.xyz/ilker/llmgw/internal/release"
|
|
"gitea.mynodes.xyz/ilker/llmgw/internal/version"
|
|
)
|
|
|
|
func newJoinCmd() *cobra.Command {
|
|
return &cobra.Command{
|
|
Use: "join <code>",
|
|
Short: "Let a setup on another machine set this one up, with the code it gave",
|
|
Long: "For a machine nothing may log into: the setup screens (sudo llmgw on\n" +
|
|
"the control plane) show a code for each machine they expect. Run this\n" +
|
|
"with it, as root, on that machine. It dials out to the setup — nothing\n" +
|
|
"dials in — checks it is the setup the code was made by, and runs what\n" +
|
|
"the setup sends until it is done: the same checks and installs ssh\n" +
|
|
"would carry. Each step is printed here as it runs.\n\n" +
|
|
"A code is good for one machine, for an hour, and only while the setup\n" +
|
|
"that made it is waiting.",
|
|
Args: cobra.ExactArgs(1),
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
if runtime.GOOS != "linux" {
|
|
return fmt.Errorf("join sets up a Linux machine; this is %s", runtime.GOOS)
|
|
}
|
|
if os.Geteuid() != 0 {
|
|
return errors.New("run it as root — sudo llmgw join … — since the setup installs software here")
|
|
}
|
|
code, err := joinpkg.Parse(args[0])
|
|
if err != nil {
|
|
return err
|
|
}
|
|
out := cmd.OutOrStdout()
|
|
role := code.Role
|
|
if role == "" {
|
|
role = "part of a cluster"
|
|
}
|
|
fmt.Fprintf(out, "Joining the setup at %s, as %s. It runs as root here until it is done.\n", code.Addr, role)
|
|
return joinpkg.Serve(cmd.Context(), code, func(s string) { fmt.Fprintln(out, s) })
|
|
},
|
|
}
|
|
}
|
|
|
|
// joinInstall is what to run on a machine that has no llmgw yet, to fetch
|
|
// this version for its architecture: short lines, since it is copied from a
|
|
// screen that cuts long ones off.
|
|
func joinInstall() []string {
|
|
v := version.Version
|
|
// From where this cluster takes its releases: on an offline one, its
|
|
// mirror, which the new machine can reach when the internet is not.
|
|
base := release.DefaultBase
|
|
if cfg, ok := loadServerConfig("/etc/llmgw/server.yaml"); ok && cfg.ReleasesBase() != "" {
|
|
base = cfg.ReleasesBase()
|
|
}
|
|
return []string{
|
|
`a=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')`,
|
|
fmt.Sprintf("sudo curl -fsSL -o /usr/local/bin/llmgw \\\n %s/%s/llmgw-%s-linux-$a", base, v, v),
|
|
"sudo chmod 755 /usr/local/bin/llmgw",
|
|
}
|
|
}
|