Files
llmgw/internal/cli/root.go
T
Ilker ManapandClaude Opus 5.5 383c4d5333
CI / test (push) Successful in 11m47s
A node with an NVIDIA card and no driver gets the driver its cards need
On Ubuntu, node add (and server init for its own machine) installs the
server driver ubuntu-drivers recommends for the cards on the PCI bus, with
the kernel modules Canonical builds and signs for the kernel: no DKMS, and
nothing to enrol under Secure Boot. nvidia-smi comes with it, and on an
HGX board the fabric manager, with nvlsm on Blackwell. When the driver
loads only after a restart, the console asks before restarting the
machine and goes on once it is back; --reboot restarts without asking,
--no-driver leaves the driver to the operator. `llmgw driver status` and
`llmgw driver install` do the same by hand.

Tried on node04 with a sysfs naming an RTX PRO 6000 Blackwell: real apt
and ubuntu-drivers installed 595-server-open and the 6.8.0-151 kernel its
signed modules are built for, and said a restart was needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 09:56:56 +01:00

77 lines
1.9 KiB
Go

// Package cli builds llmgw's command line surface.
package cli
import (
"log/slog"
"github.com/spf13/cobra"
"gitea.mynodes.xyz/ilker/llmgw/internal/obs"
"gitea.mynodes.xyz/ilker/llmgw/internal/version"
)
type globalFlags struct {
logLevel string
logFormat string
}
var global globalFlags
// Root returns the root command with all subcommands attached.
func Root() *cobra.Command {
root := &cobra.Command{
Use: "llmgw",
Short: "LLM gateway for multi-fabric InfiniBand and heterogeneous GPU clusters",
Long: "llmgw serves LLMs running on your own GPU servers behind a single\n" +
"OpenAI-compatible endpoint. One binary, different roles per subcommand.",
Version: version.Version,
SilenceUsage: true,
SilenceErrors: true,
PersistentPreRun: func(_ *cobra.Command, _ []string) {
obs.Setup(obs.Options{Level: global.logLevel, Format: global.logFormat})
},
// Bare, in a terminal: the setup screens or the console. Otherwise
// the help, as before.
RunE: func(cmd *cobra.Command, _ []string) error {
if interactive(cmd) {
return runHome(cmd)
}
return cmd.Help()
},
}
pf := root.PersistentFlags()
pf.StringVar(&global.logLevel, "log-level", "info", "log level: debug|info|warn|error")
pf.StringVar(&global.logFormat, "log-format", "text", "log format: text|json")
root.AddCommand(
newServerCmd(),
newAgentCmd(),
newCtlCmd(),
newTenancyCmd(),
newUsersCmd(),
newOrgCmd(),
newMirrorCmd(),
newBundleCmd(),
newSimEngineCmd(),
newComfyUIGateCmd(),
newStrataServeCmd(),
newDoctorCmd(),
newDriverCmd(),
newNodeCmd(),
newSelfUpgradeCmd(),
newReleaseCmd(),
newJoinCmd(),
newFirewallCmd(),
newWipeCmd(),
newDocsCmd(),
)
// status, start, stop and restart: the whole system; service: this
// machine's services.
root.AddCommand(newSystemCmds()...)
root.AddCommand(newServiceCmd())
return root
}
func logger() *slog.Logger { return slog.Default() }