Single Go binary with five commands: - build: podman build locally with registry tags + git version - push: podman push to MCR - deploy: SSH pull/stop/rm/run on target node - cert renew: issue TLS cert from Metacrypt via REST API - status: show container status on a node Config-driven via TOML service registry describing images, Dockerfiles, container configs per node. Shells out to podman for container operations and ssh for remote access. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
35 lines
673 B
Go
35 lines
673 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func statusCommand() *cobra.Command {
|
|
return &cobra.Command{
|
|
Use: "status <node>",
|
|
Short: "Show container status on a node",
|
|
Args: cobra.ExactArgs(1),
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
cfg, err := loadCfg()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
node, err := cfg.FindNode(args[0])
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
host := node.Host
|
|
if node.User != "" {
|
|
host = node.User + "@" + node.Host
|
|
}
|
|
|
|
fmt.Printf("Containers on %s (%s):\n\n", args[0], node.Host)
|
|
return sshRun(host, "podman ps --format 'table {{.Names}}\t{{.Status}}\t{{.Image}}'")
|
|
},
|
|
}
|
|
}
|