mirror of
https://github.com/DeBrosOfficial/orama.git
synced 2026-03-17 21:26:58 +00:00
Replaces plaintext password-based SSH authentication (sshpass) across the entire Go CLI with wallet-derived ed25519 keys via RootWallet. - Add `rw vault ssh agent-load` command to RootWallet CLI for SSH agent forwarding in push fanout - Create wallet.go bridge: PrepareNodeKeys resolves keys from `rw vault ssh get --priv`, writes temp PEMs (0600), zero-overwrites on cleanup - Remove Password field from Node struct, update config parser to new 3-field format (env|user@host|role) - Remove all sshpass branches from inspector/ssh.go and remotessh/ssh.go, require SSHKey on all SSH paths - Add WithAgentForward() option to RunSSHStreaming for hub fanout - Add PrepareNodeKeys + defer cleanup to all 7 entry points: inspect, monitor, push, upgrade, clean, recover, install - Update push fanout to use SSH agent forwarding instead of sshpass on hub - Delete install/ssh.go duplicate, replace with remotessh calls - Create nodes.conf from remote-nodes.conf (topology only, no secrets) - Update all config defaults and help text from remote-nodes.conf to nodes.conf - Use StrictHostKeyChecking=accept-new consistently everywhere
81 lines
2.3 KiB
Go
81 lines
2.3 KiB
Go
package cluster
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
// HandleCommand handles cluster subcommands.
|
|
func HandleCommand(args []string) {
|
|
if len(args) == 0 {
|
|
ShowHelp()
|
|
return
|
|
}
|
|
|
|
subcommand := args[0]
|
|
subargs := args[1:]
|
|
|
|
switch subcommand {
|
|
case "status":
|
|
HandleStatus(subargs)
|
|
case "health":
|
|
HandleHealth(subargs)
|
|
case "rqlite":
|
|
HandleRQLite(subargs)
|
|
case "watch":
|
|
HandleWatch(subargs)
|
|
case "help":
|
|
ShowHelp()
|
|
default:
|
|
fmt.Fprintf(os.Stderr, "Unknown cluster subcommand: %s\n", subcommand)
|
|
ShowHelp()
|
|
os.Exit(1)
|
|
}
|
|
}
|
|
|
|
// hasFlag checks if a flag is present in the args slice.
|
|
func hasFlag(args []string, flag string) bool {
|
|
for _, a := range args {
|
|
if a == flag {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
// getFlagValue returns the value of a flag from the args slice.
|
|
// Returns empty string if the flag is not found or has no value.
|
|
func getFlagValue(args []string, flag string) string {
|
|
for i, a := range args {
|
|
if a == flag && i+1 < len(args) {
|
|
return args[i+1]
|
|
}
|
|
}
|
|
return ""
|
|
}
|
|
|
|
// ShowHelp displays help information for cluster commands.
|
|
func ShowHelp() {
|
|
fmt.Printf("Cluster Management Commands\n\n")
|
|
fmt.Printf("Usage: orama cluster <subcommand> [options]\n\n")
|
|
fmt.Printf("Subcommands:\n")
|
|
fmt.Printf(" status - Show cluster node status (RQLite + Olric)\n")
|
|
fmt.Printf(" Options:\n")
|
|
fmt.Printf(" --all - SSH into all nodes from nodes.conf (TODO)\n")
|
|
fmt.Printf(" health - Run cluster health checks\n")
|
|
fmt.Printf(" rqlite <subcommand> - RQLite-specific commands\n")
|
|
fmt.Printf(" status - Show detailed Raft state for local node\n")
|
|
fmt.Printf(" voters - Show current voter list\n")
|
|
fmt.Printf(" backup [--output FILE] - Trigger manual backup\n")
|
|
fmt.Printf(" watch - Live cluster status monitor\n")
|
|
fmt.Printf(" Options:\n")
|
|
fmt.Printf(" --interval SECONDS - Refresh interval (default: 10)\n\n")
|
|
fmt.Printf("Examples:\n")
|
|
fmt.Printf(" orama cluster status\n")
|
|
fmt.Printf(" orama cluster health\n")
|
|
fmt.Printf(" orama cluster rqlite status\n")
|
|
fmt.Printf(" orama cluster rqlite voters\n")
|
|
fmt.Printf(" orama cluster rqlite backup --output /tmp/backup.db\n")
|
|
fmt.Printf(" orama cluster watch --interval 5\n")
|
|
}
|