commands

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 17, 2026 License: Apache-2.0 Imports: 145 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Stamp = "Jan _2 03:04:05PM"
)

Variables

View Source
var (
	// ErrNoAutoConfigNeeded indicates that auto-configuration is not needed or not possible
	ErrNoAutoConfigNeeded = errors.New("no auto-configuration needed")
	// ErrAutoConfigFailed indicates that auto-configuration was attempted but failed
	ErrAutoConfigFailed = errors.New("auto-configuration failed")
)
View Source
var ErrAccessDenied = errors.New("access denied")
View Source
var ErrNoConfig = errors.New("no cluster config")
View Source
var Meter = spinner.Spinner{
	Frames: []string{
		line("⠋"),
		line("⠙"),
		line("⠹"),
		line("⠸"),
		line("⠼"),
		line("⠴"),
		line("⠦"),
		line("⠧"),
		line("⠇"),
		line("⠏"),
	},
	FPS: time.Second / 10,
}

Meter is the custom spinner animation

Functions

func AddClusterInteractive added in v0.0.3

func AddClusterInteractive(ctx *Context) error

AddClusterInteractive prompts the user to select and add a cluster interactively. It auto-selects the identity if only one is available. Returns nil if a cluster was successfully added.

func AddonCreate added in v0.4.0

func AddonCreate(ctx *Context, opts struct {
	AppCentric
	Spec string `position:"0" usage:"Addon spec (e.g., miren-postgresql:small)" required:"true"`
}) error

func AddonDestroy added in v0.4.0

func AddonDestroy(ctx *Context, opts struct {
	AppCentric
	Name  string `position:"0" usage:"Addon name (e.g., miren-postgresql)" required:"true"`
	Force bool   `short:"f" long:"force" description:"Skip confirmation prompt"`
}) error

func AddonList added in v0.4.0

func AddonList(ctx *Context, opts struct {
	FormatOptions
	AppCentric
}) error

func AddonListAvailable added in v0.4.0

func AddonListAvailable(ctx *Context, opts struct {
	FormatOptions
	ConfigCentric
}) error

func AddonVariants added in v0.4.0

func AddonVariants(ctx *Context, opts struct {
	FormatOptions
	ConfigCentric
	Addon string `position:"0" usage:"Addon name (e.g., miren-postgresql)" required:"true"`
}) error

func Admin added in v0.3.1

func Admin(ctx *Context, opts struct {
	AppCentric
	List       bool     `long:"list" short:"l" description:"List available admin methods"`
	FuncHelp   bool     `long:"func-help" description:"Show help for a specific admin method"`
	JSON       bool     `long:"json" short:"j" description:"Output as highlighted JSON (default for non-TTY)"`
	Pretty     bool     `long:"pretty" short:"p" description:"Render output in a human-friendly format (default for TTY)"`
	NoValidate bool     `long:"no-validate" description:"Skip method/parameter validation"`
	ParamsFile string   `long:"params-file" short:"f" description:"Read params as JSON from file (use - for stdin)"`
	Method     string   `position:"0" description:"Admin method to call"`
	Params     []string `rest:"true" description:"Method parameters as key=value pairs"`
	Unknown    []string `unknown:"true"`
}) error

func App

func App(ctx *Context, opts struct {
	AppCentric
	Watch bool `short:"w" long:"watch" description:"Watch the app stats"`
	Graph bool `short:"g" long:"graph" description:"Graph the app stats"`

	ConfigOnly bool `long:"config-only" description:"Only show the configuration"`
}) error

func AppDelete

func AppDelete(ctx *Context, opts struct {
	Force   bool   `short:"f" long:"force" description:"Force delete without confirmation"`
	AppName string `position:"0" usage:"Name of the app to delete"`
	ConfigCentric
}) error

func AppHistory

func AppHistory(ctx *Context, opts struct {
	AppCentric

	Limit      int    `short:"n" long:"limit" description:"Maximum number of deployments to show" default:"10"`
	All        bool   `long:"all" description:"Show all deployments (ignore limit)"`
	Status     string `short:"s" long:"status" description:"Filter by status (active, failed, rolled_back)"`
	HideFailed bool   `long:"hide-failed" description:"Hide failed deployments"`
	Detailed   bool   `long:"detailed" description:"Show all columns including git information"`
}) error

func AppList

func AppList(ctx *Context, opts struct {
	FormatOptions
	ConfigCentric
}) error

func AppRun added in v0.2.0

func AppRun(ctx *Context, opts struct {
	AppCentric

	Args []string `rest:"true"`
}) error

func AppStatus

func AppStatus(ctx *Context, opts struct {
	AppCentric
}) error

func Apps

func Apps(ctx *Context, opts struct {
	ConfigCentric
}) error

func AuthGenerate

func AuthGenerate(ctx *Context, opts struct {
	DataPath    string `short:"d" long:"data-path" description:"Data path" default:"/var/lib/miren"`
	ConfigPath  string `short:"c" long:"config-path" description:"Path to the config file, - for stdout" default:"clientconfig.yaml"`
	Name        string `short:"n" long:"name" description:"Name of the client certificate" default:"miren-user"`
	Target      string `short:"t" long:"target" description:"Hostname to embed in the config" default:"localhost"`
	ClusterName string `short:"C" long:"cluster-name" description:"Name of the cluster" default:"local"`
	PublicIP    bool   `short:"p" long:"public-ip" description:"Use public IP for the target, if available"`
}) error

func CheckIfUpgradeNeeded

func CheckIfUpgradeNeeded(ctx context.Context, targetVersion string, force bool, mgrOpts *release.ManagerOptions) (bool, error)

CheckIfUpgradeNeeded checks if target version is newer than current Returns true if upgrade is needed, false if already up to date If mgrOpts is nil, uses default manager options (for server path)

func CheckVersionStatus

func CheckVersionStatus(ctx context.Context, targetVersion string, mgrOpts *release.ManagerOptions) (current, latest release.VersionInfo, err error)

CheckVersionStatus checks if an update is available for the given target version Returns the current and latest version info If mgrOpts is nil, uses default manager options (for server path)

func Cluster

func Cluster(ctx *Context, opts struct {
	FormatOptions
	ConfigCentric
}) error

Cluster is the default command for the cluster group - shows the list

func ClusterAdd

func ClusterAdd(ctx *Context, opts struct {
	Identity string `short:"i" long:"identity" description:"Name of the identity to use (optional - will use the only one if single)"`
	Cluster  string `short:"c" long:"cluster" description:"Name of the cluster to create (optional - will list available)"`
	Address  string `short:"a" long:"address" description:"Address/hostname of the cluster (optional - will use from selected cluster)"`
	Force    bool   `short:"f" long:"force" description:"Overwrite existing cluster configuration"`
}) error

func ClusterCurrent added in v0.4.0

func ClusterCurrent(ctx *Context, opts struct {
	AppCentric
}) error

func ClusterList

func ClusterList(ctx *Context, opts struct {
	FormatOptions
	ConfigCentric
}) error

ClusterList lists all configured clusters (replaces config info)

func ClusterRemove

func ClusterRemove(ctx *Context, opts struct {
	Cluster string `position:"0" usage:"Name of the cluster to remove"`
	ConfigCentric
}) error

func ClusterSwitch

func ClusterSwitch(ctx *Context, opts struct {
	ConfigCentric
	Cluster string `position:"0" usage:"Name of the cluster to switch to"`
}) error

func Colors

func Colors(ctx *Context, opts struct {
}) error

func ConfigInfo

func ConfigInfo(ctx *Context, opts struct {
	FormatOptions
	ConfigCentric
}) error

func ConfigLoad

func ConfigLoad(ctx *Context, opts struct {
	Config    string `long:"config" description:"Path to the config file to update"`
	Input     string `short:"i" long:"input" description:"Path to the input config file to add" required:"true"`
	Force     bool   `short:"f" long:"force" description:"Force the update"`
	SetActive bool   `short:"a" long:"set-active" description:"Set the active cluster"`
}) error

func ConfigRemove

func ConfigRemove(ctx *Context, opts struct {
	Cluster string `position:"0" usage:"Name of the cluster to remove"`
	Force   bool   `short:"f" long:"force" description:"Force removal without confirmation"`
	ConfigCentric
}) error

func ConfigSetActive

func ConfigSetActive(ctx *Context, opts struct {
	Cluster string `position:"0" usage:"Name of the cluster to set as active"`
	ConfigCentric
}) error

func CtrNuke

func CtrNuke(c *Context, opts struct {
	Namespace        string `short:"n" long:"namespace" description:"namespace to nuke"`
	Containers       bool   `short:"c" long:"containers" description:"nuke containers only"`
	ContainerdSocket string `long:"containerd-socket" description:"path to containerd socket"`
}) error

func DebugBundle added in v0.3.0

func DebugBundle(ctx *Context, opts struct {
	OutputFile      string `short:"o" long:"output" description:"Output file path" default:"miren-debug.tar.gz"`
	Since           string `short:"s" long:"since" description:"Include logs since this time" default:"1 day ago"`
	Namespace       string `long:"namespace" description:"containerd namespace" default:"miren"`
	Socket          string `long:"socket" description:"path to containerd socket"`
	DockerContainer string `short:"d" long:"docker-container" description:"Docker container name to get logs from" default:"miren"`
}) error

func DebugConnection

func DebugConnection(ctx *Context, opts struct {
	Identity string `short:"i" long:"identity" description:"Identity name to use for authentication"`
	Cluster  string `short:"c" long:"cluster" description:"Cluster name from config to test"`
	Server   string `short:"s" long:"server" description:"Server hostname or IP address to test directly"`
	Insecure bool   `long:"insecure" description:"Skip TLS certificate verification"`
}) error

DebugConnection tests connectivity and authentication with a server

func DebugCtr

func DebugCtr(ctx *Context, opts struct {
	Namespace string   `short:"n" long:"namespace" description:"containerd namespace" default:"miren"`
	Socket    string   `long:"socket" description:"path to containerd socket"`
	Args      []string `rest:"true"`
}) error

func DebugDiskCreate

func DebugDiskCreate(ctx *Context, opts struct {
	ConfigCentric
	Name       string `short:"n" long:"name" description:"Name for the disk" required:"true"`
	Size       int    `short:"s" long:"size" description:"Size of disk in GB" default:"10"`
	Filesystem string `short:"f" long:"filesystem" description:"Filesystem type (ext4, xfs, btrfs)" default:"ext4"`
	CreatedBy  string `short:"c" long:"created-by" description:"Creator ID for the disk"`
	RemoteOnly bool   `short:"r" long:"remote-only" description:"Store disk only in remote storage (no local replica)"`
	VolumeID   string `short:"V" long:"volume-id" description:"Attach to existing LSVD volume instead of creating new one"`
}) error

DebugDiskCreate creates a new disk entity for testing

func DebugDiskDelete

func DebugDiskDelete(ctx *Context, opts struct {
	ConfigCentric
	ID string `short:"i" long:"id" description:"Disk ID to delete" required:"true"`
}) error

DebugDiskDelete deletes a disk entity

func DebugDiskLease

func DebugDiskLease(ctx *Context, opts struct {
	ConfigCentric
	DiskID    string `short:"d" long:"disk" description:"Disk ID to lease" required:"true"`
	SandboxID string `short:"s" long:"sandbox" description:"Sandbox ID for the lease"`
	AppID     string `short:"a" long:"app" description:"App ID for the lease"`
	Path      string `short:"p" long:"path" description:"Mount path in sandbox" default:"/data"`
	ReadOnly  bool   `short:"r" long:"readonly" description:"Mount as read-only"`
	Hours     int    `short:"H" long:"hours" description:"Lease duration in hours" default:"2"`
}) error

DebugDiskLease creates a disk lease for testing

func DebugDiskLeaseDelete

func DebugDiskLeaseDelete(ctx *Context, opts struct {
	ConfigCentric
	ID    string `short:"i" long:"id" description:"Lease ID to delete" required:"true"`
	Force bool   `short:"f" long:"force" description:"Force deletion without releasing"`
}) error

DebugDiskLeaseDelete deletes a disk lease entity

func DebugDiskLeaseList

func DebugDiskLeaseList(ctx *Context, opts struct {
	ConfigCentric
	DiskID    string `short:"d" long:"disk" description:"Filter by disk ID"`
	SandboxID string `short:"s" long:"sandbox" description:"Filter by sandbox ID"`
	Status    string `long:"status" description:"Filter by status (pending, bound, released, failed)"`
}) error

DebugDiskLeaseList lists all disk lease entities

func DebugDiskLeaseRelease

func DebugDiskLeaseRelease(ctx *Context, opts struct {
	ConfigCentric
	ID string `short:"i" long:"id" description:"Lease ID to release" required:"true"`
}) error

DebugDiskLeaseRelease releases a disk lease

func DebugDiskLeaseStatus

func DebugDiskLeaseStatus(ctx *Context, opts struct {
	ConfigCentric
	ID string `short:"i" long:"id" description:"Lease ID to check" required:"true"`
}) error

DebugDiskLeaseStatus shows detailed status of a specific disk lease

func DebugDiskList

func DebugDiskList(ctx *Context, opts struct {
	ConfigCentric
}) error

DebugDiskList lists all disk entities

func DebugDiskMounts

func DebugDiskMounts(ctx *Context, opts struct{}) error

DebugDiskMounts lists all mounted runtime-managed disks by reading /proc/mounts

func DebugDiskStatus

func DebugDiskStatus(ctx *Context, opts struct {
	ConfigCentric
	ID string `short:"i" long:"id" description:"Disk ID to check" required:"true"`
}) error

DebugDiskStatus shows the status of a specific disk

func DebugLsvdInfo added in v0.3.1

func DebugLsvdInfo(ctx *Context, opts struct {
	DataPath string `short:"d" long:"data-path" description:"Base miren data directory" default:"/var/lib/miren"`
}) error

DebugLsvdInfo shows a combined view of lsvd-server volumes, mounts, and metrics.

func DebugLsvdMetrics added in v0.3.1

func DebugLsvdMetrics(ctx *Context, opts struct {
	DataPath string `short:"d" long:"data-path" description:"Base miren data directory" default:"/var/lib/miren"`
}) error

DebugLsvdMetrics shows reconciliation metrics from the lsvd-server.

func DebugLsvdMounts added in v0.3.1

func DebugLsvdMounts(ctx *Context, opts struct {
	DataPath string `short:"d" long:"data-path" description:"Base miren data directory" default:"/var/lib/miren"`
}) error

DebugLsvdMounts lists mounts managed by the lsvd-server.

func DebugLsvdVolumes added in v0.3.1

func DebugLsvdVolumes(ctx *Context, opts struct {
	DataPath string `short:"d" long:"data-path" description:"Base miren data directory" default:"/var/lib/miren"`
}) error

DebugLsvdVolumes lists volumes managed by the lsvd-server.

func DebugNetDBGC added in v0.2.0

func DebugNetDBGC(ctx *Context, opts struct {
	ConfigCentric
	Subnet string `short:"s" long:"subnet" description:"Only GC IPs in this subnet"`
	DryRun bool   `short:"n" long:"dry-run" description:"Show what would be released without making changes"`
	Force  bool   `short:"f" long:"force" description:"Skip confirmation prompt"`
}) error

DebugNetDBGC garbage collects IPs not associated with live sandboxes

func DebugNetDBList added in v0.2.0

func DebugNetDBList(ctx *Context, opts struct {
	ConfigCentric
	Subnet   string `short:"s" long:"subnet" description:"Filter by subnet CIDR"`
	Reserved bool   `short:"r" long:"reserved" description:"Show only reserved (in-use) IPs"`
	Released bool   `short:"R" long:"released" description:"Show only released IPs"`
}) error

DebugNetDBList lists all IP leases from the netdb

func DebugNetDBRelease added in v0.2.0

func DebugNetDBRelease(ctx *Context, opts struct {
	ConfigCentric
	IP     string `short:"i" long:"ip" description:"Specific IP to release"`
	Subnet string `short:"s" long:"subnet" description:"Release all reserved IPs in subnet"`
	All    bool   `short:"a" long:"all" description:"Release all reserved IPs (use with caution)"`
	Force  bool   `short:"f" long:"force" description:"Skip confirmation prompt"`
}) error

DebugNetDBRelease manually releases IP leases

func DebugNetDBStatus added in v0.2.0

func DebugNetDBStatus(ctx *Context, opts struct {
	ConfigCentric
}) error

DebugNetDBStatus shows subnet utilization stats

func DebugOutboardHealth added in v0.3.1

func DebugOutboardHealth(ctx *Context, opts struct {
	DataPath string `short:"d" long:"data-path" description:"Base miren data directory" default:"/var/lib/miren"`
	Name     string `short:"n" long:"name" description:"Outboard process name (omit for all)"`
}) error

DebugOutboardHealth connects to outboard processes and displays health status. If no name is given, it reports health for all outboard processes found.

func DebugRBAC

func DebugRBAC(ctx *Context, opts struct {
	OutputDir string `short:"d" long:"dir" description:"Registration directory" default:"/var/lib/miren/server"`
	Raw       bool   `short:"r" long:"raw" description:"Show raw JSON response"`
}) error

DebugRBAC fetches and displays the RBAC rules from miren.cloud

func DebugRBACTest

func DebugRBACTest(ctx *Context, opts struct {
	OutputDir string            `short:"d" long:"dir" description:"Registration directory" default:"/var/lib/miren/server"`
	Groups    []string          `short:"g" long:"group" description:"Groups to test with"`
	Tags      map[string]string `short:"t" long:"tag" description:"Tags to test with (key:value)"`
	Resource  string            `short:"r" long:"resource" description:"Resource to test" required:"true"`
	Action    string            `short:"a" long:"action" description:"Action to test" required:"true"`
}) error

DebugRBACTest tests RBAC evaluation locally with fetched rules

func DebugReindex

func DebugReindex(ctx *Context, opts struct {
	ConfigCentric
	DryRun  bool `short:"d" long:"dry-run" description:"Show what would be done without making changes"`
	Confirm bool `short:"y" long:"yes" description:"Skip confirmation prompt"`
}) error

DebugReindex rebuilds all entity indexes from scratch

func Deploy

func Deploy(ctx *Context, opts struct {
	AppCentric

	Version       string   `short:"V" long:"version" description:"Deploy an existing version (skip build)"`
	Analyze       bool     `long:"analyze" description:"Analyze the app without building (show detected stack, services, etc.)"`
	Explain       bool     `short:"x" long:"explain" description:"Explain the build process"`
	ExplainFormat string   `long:"explain-format" description:"Explain format" choice:"auto" choice:"plain" choice:"tty" choice:"rawjson" default:"auto"` //nolint
	Force         bool     `short:"f" long:"force" description:"Skip confirmation prompt"`
	Env           []string `short:"e" long:"env" description:"Set environment variable (KEY=VALUE, KEY=@file, or KEY to prompt)"`
	Sensitive     []string `short:"s" long:"sensitive" description:"Set sensitive environment variable (masked in output)"`
}) error

func DeployCancel added in v0.3.0

func DeployCancel(ctx *Context, opts struct {
	ConfigCentric
	DeploymentID string `short:"d" long:"deployment" description:"ID of the deployment to cancel" required:"true"`
}) error

func DialStdio

func DialStdio(ctx *Context, opts struct {
	Addr string `long:"addr" description:"address to dial" required:"true"`
}) error

func Doctor added in v0.2.0

func Doctor(ctx *Context, opts struct {
	ConfigCentric
}) error

Doctor shows a quick overview of the miren environment

func DoctorAuth added in v0.2.0

func DoctorAuth(ctx *Context, opts struct {
	ConfigCentric
}) error

DoctorAuth shows authentication and user information

func DoctorConfig added in v0.2.0

func DoctorConfig(ctx *Context, opts struct {
	ConfigCentric
}) error

DoctorConfig shows configuration file information

func DoctorServer added in v0.2.0

func DoctorServer(ctx *Context, opts struct {
	ConfigCentric
}) error

DoctorServer shows server health and connectivity details

func DownloadRelease

func DownloadRelease(ctx *Context, opts struct {
	Branch string `short:"b" long:"branch" description:"Branch name to download"`
	Global bool   `short:"g" long:"global" description:"Install globally to /var/lib/miren/release"`
	Force  bool   `short:"f" long:"force" description:"Force download even if release directory exists"`
	Output string `short:"o" long:"output" description:"Custom output directory"`
}) error

DownloadRelease is the CLI command handler for downloading a release

func EntityCheck

func EntityCheck(ctx *Context, opts struct {
	Path string `short:"p" long:"path" description:"Path to check"`
}) error

func EntityCreate

func EntityCreate(ctx *Context, opts struct {
	ConfigCentric
	Address string   `short:"a" long:"address" description:"Address to listen on" default:"localhost:8443"`
	Path    []string `short:"p" long:"path" description:"Path to the entity file"`
	Id      string   `short:"i" long:"id" description:"ID of the entity (optional, auto-generated if not provided)"`
	DryRun  bool     `short:"d" long:"dry-run" description:"Dry run, do not actually create the entity"`
}) error

func EntityDelete

func EntityDelete(ctx *Context, opts struct {
	ConfigCentric
	Id      string `short:"i" long:"id" description:"Entity ID" required:"true"`
	Address string `short:"a" long:"address" description:"Address to listen on" default:"localhost:8443"`
}) error

func EntityEnsure

func EntityEnsure(ctx *Context, opts struct {
	ConfigCentric
	Address string   `short:"a" long:"address" description:"Address to listen on" default:"localhost:8443"`
	Path    []string `short:"p" long:"path" description:"Path to the entity file"`
	Id      string   `short:"i" long:"id" description:"ID of the entity (required)" required:"true"`
	DryRun  bool     `short:"d" long:"dry-run" description:"Dry run, do not actually ensure the entity"`
}) error

func EntityGet

func EntityGet(ctx *Context, opts struct {
	ConfigCentric
	Id      string `short:"i" long:"id" description:"Entity ID" required:"true"`
	Address string `short:"a" long:"address" description:"Address to listen on" default:"localhost:8443"`
}) error

func EntityList

func EntityList(ctx *Context, opts struct {
	ConfigCentric
	Attribute string `short:"a" long:"attribute" description:"Attribute to filter by"`
	Value     string `short:"V" long:"value" description:"Value to filter by"`
	Kind      string `short:"k" long:"kind" description:"Kind of entity to filter by"`
	Address   string `long:"address" description:"Address to listen on" default:"localhost:8443"`
}) error

func EntityPatch

func EntityPatch(ctx *Context, opts struct {
	ConfigCentric
	Address  string   `short:"a" long:"address" description:"Address to listen on" default:"localhost:8443"`
	Path     []string `short:"p" long:"path" description:"Path to the entity file with updates"`
	Id       string   `short:"i" long:"id" description:"ID of the entity (required)" required:"true"`
	Revision int64    `short:"r" long:"revision" description:"Expected revision for optimistic concurrency"`
	DryRun   bool     `short:"d" long:"dry-run" description:"Dry run, do not actually patch the entity"`
}) error

func EntityPut

func EntityPut(ctx *Context, opts struct {
	ConfigCentric
	Address string   `short:"a" long:"address" description:"Address to listen on" default:"localhost:8443"`
	Path    []string `short:"p" long:"path" description:"Path to the entity"`
	Id      string   `short:"i" long:"id" description:"ID of the entity"`
	DryRun  bool     `short:"d" long:"dry-run" description:"Dry run, do not actually put the entity"`
	Update  bool     `short:"u" long:"update" description:"Update the entity if it exists"`
}) error

func EntityReplace

func EntityReplace(ctx *Context, opts struct {
	ConfigCentric
	Address  string   `short:"a" long:"address" description:"Address to listen on" default:"localhost:8443"`
	Path     []string `short:"p" long:"path" description:"Path to the entity file"`
	Id       string   `short:"i" long:"id" description:"ID of the entity (required)" required:"true"`
	Revision int64    `short:"r" long:"revision" description:"Expected revision for optimistic concurrency"`
	DryRun   bool     `short:"d" long:"dry-run" description:"Dry run, do not actually replace the entity"`
}) error

func EnvDelete

func EnvDelete(ctx *Context, opts struct {
	Keys    []string `rest:"true" usage:"Environment variable keys to delete" required:"true"`
	Service string   `short:"S" long:"service" description:"Delete env var from specific service only (if not specified, deletes global env var)"`
	Force   bool     `short:"f" long:"force" description:"Skip confirmation prompt"`
	AppCentric
}) error

func EnvGet

func EnvGet(ctx *Context, opts struct {
	Key     string `position:"0" usage:"Environment variable key to get" required:"true"`
	Service string `short:"S" long:"service" description:"Get env var for specific service (if not specified, gets global env var)"`
	Unmask  bool   `short:"u" long:"unmask" description:"Show actual value of sensitive variables instead of masking them"`
	AppCentric
}) error

func EnvList

func EnvList(ctx *Context, opts struct {
	FormatOptions
	AppCentric
}) error

func EnvSet

func EnvSet(ctx *Context, opts struct {
	AppCentric
	Service   string   `short:"S" long:"service" description:"Set env var for specific service only (if not specified, sets for all services)"`
	Env       []string `` /* 136-byte string literal not displayed */
	Sensitive []string `` /* 165-byte string literal not displayed */
}) error

func ExpandPath

func ExpandPath(path string) string

func FindReleasePath

func FindReleasePath() string

FindReleasePath looks for an existing miren release directory. It checks the user's home directory first (~/.miren/release), then falls back to the system path (/var/lib/miren/release). Returns empty string if no release directory is found.

func HiddenCommands

func HiddenCommands() []string

func Init

func Init(ctx *Context, opts struct {
	Name string `short:"n" long:"name" description:"Application name (defaults to directory name)"`
	Dir  string `short:"d" long:"dir" description:"Application directory (defaults to current directory)"`
	ConfigCentric
}) error

func Login

func Login(ctx *Context, opts struct {
	CloudURL     string `short:"u" long:"url" description:"Cloud URL" default:"https://miren.cloud"`
	IdentityName string `short:"i" long:"identity" description:"Name for this identity in config" default:"cloud"`
	KeyName      string `short:"k" long:"key-name" description:"Name for the authentication key" default:"miren-cli"`
	NoSave       bool   `long:"no-save" description:"Don't save credentials to config file"`
	Force        bool   `short:"f" long:"force" description:"Overwrite existing identity without prompting"`
}) error

Login authenticates with miren.cloud using device flow

func LoginWithDefaults added in v0.2.1

func LoginWithDefaults(ctx *Context) error

LoginWithDefaults runs the login flow with default settings

func Logout

func Logout(ctx *Context, opts struct {
	ConfigCentric
	IdentityName string `short:"i" long:"identity" description:"Name of the identity to remove"`
}) error

Logout removes the local identity and key files

func Logs

func Logs(ctx *Context, opts struct {
	ConfigCentric

	App     string         `short:"a" long:"app" description:"Application get logs for" env:"MIREN_APP"`
	Dir     string         `short:"d" long:"dir" description:"Directory to run from" default:"."`
	Last    *time.Duration `short:"l" long:"last" description:"Show logs from the last duration"`
	Sandbox string         `short:"s" long:"sandbox" description:"Show logs for a specific sandbox ID"`
	Build   string         `short:"b" long:"build" description:"Show build logs for a specific version"`
	Follow  bool           `short:"f" long:"follow" description:"Follow log output (live tail)"`
	Filter  string         `short:"g" long:"grep" description:"Filter logs (e.g., 'error', '\"exact phrase\"', 'error -debug', '/regex/')"`
	Service string         `long:"service" description:"Filter logs by service name (e.g., 'web', 'worker')"`
}) error

func MinuteLabeler

func MinuteLabeler(i int, v float64) string

func PerformDownloadRelease

func PerformDownloadRelease(ctx *Context, opts DownloadReleaseOptions) error

PerformDownloadRelease performs the actual download with the given options

func PrintJSON

func PrintJSON(data any) error

PrintJSON prints data as formatted JSON to stdout

func PrintJSONTo

func PrintJSONTo(w io.Writer, data any) error

PrintJSONTo prints JSON to the given writer with pretty formatting.

func PrintUpgradeSuccess

func PrintUpgradeSuccess(ctx context.Context, oldVersion release.VersionInfo, commandType string, mgrOpts *release.ManagerOptions)

PrintUpgradeSuccess prints a formatted success message after upgrade If mgrOpts is nil, uses default manager options (for server path)

func PrintVersionComparison

func PrintVersionComparison(current, latest release.VersionInfo)

PrintVersionComparison prints a formatted comparison of current vs latest versions

func Register

func Register(ctx *Context, opts RegisterOptions) error

Register handles cluster registration with miren.cloud

func RegisterAll added in v0.3.0

func RegisterAll(d *mflags.Dispatcher)

func RegisterStatus

func RegisterStatus(ctx *Context, opts struct {
	Dir string `short:"d" long:"dir" description:"Registration directory" default:"/var/lib/miren/server"`
}) error

RegisterStatus displays the current registration status

func Rollback added in v0.4.0

func Rollback(ctx *Context, opts struct {
	AppCentric
}) error

func Route

func Route(ctx *Context, opts struct {
	FormatOptions
	ConfigCentric
}) error

Route is the default command for the route group - shows the list

func RouteList

func RouteList(ctx *Context, opts struct {
	FormatOptions
	ConfigCentric
}) error

func RouteOidcDisable added in v0.4.0

func RouteOidcDisable(ctx *Context, opts struct {
	Host    string `position:"0" usage:"Hostname for the route (e.g., example.com)"`
	Default bool   `long:"default" description:"Disable OIDC on the default route"`
	ConfigCentric
}) error

func RouteOidcEnable added in v0.4.0

func RouteOidcEnable(ctx *Context, opts struct {
	Host         string   `position:"0" usage:"Hostname for the route (e.g., example.com)"`
	Default      bool     `long:"default" description:"Apply to the default route"`
	Provider     string   `long:"provider" description:"Name of existing OIDC provider (use --provider-url for inline creation)"`
	ProviderURL  string   `long:"provider-url" description:"OIDC provider URL (e.g., https://accounts.google.com) - creates provider if not exists"`
	ClientID     string   `long:"client-id" description:"OAuth2 client ID (required with --provider-url)"`
	ClientSecret string   `long:"client-secret" description:"OAuth2 client secret (required with --provider-url)"`
	Scopes       []string `long:"scope" description:"OAuth2 scopes (can be specified multiple times)"`
	ClaimHeader  []string `long:"claim-header" description:"Claim to header mapping in format 'claim:header' (e.g., 'email:X-User-Email')"`
	ConfigCentric
}) error

func RouteOidcShow added in v0.4.0

func RouteOidcShow(ctx *Context, opts struct {
	Host    string `position:"0" usage:"Hostname for the route (e.g., example.com)"`
	Default bool   `long:"default" description:"Show OIDC config for the default route"`
	FormatOptions
	ConfigCentric
}) error

func RouteRemove

func RouteRemove(ctx *Context, opts struct {
	Host string `position:"0" usage:"Hostname of the route to remove"`
	ConfigCentric
}) error

func RouteSet

func RouteSet(ctx *Context, opts struct {
	Host    string `position:"0" usage:"Hostname for the route (e.g., example.com)" required:"true"`
	AppName string `position:"1" usage:"Application name to route to"`
	ConfigCentric
}) error

func RouteSetDefault

func RouteSetDefault(ctx *Context, opts struct {
	AppName string `position:"0" usage:"Application name to set as default route"`
	ConfigCentric
}) error

func RouteShow

func RouteShow(ctx *Context, opts struct {
	Host string `position:"0" usage:"Hostname of the route to show" required:"true"`
	FormatOptions
	ConfigCentric
}) error

func RouteUnsetDefault

func RouteUnsetDefault(ctx *Context, opts struct {
	ConfigCentric
}) error

func RunnerInvite added in v0.3.1

func RunnerInvite(ctx *Context, opts struct {
	ConfigCentric

	Labels  []string `short:"l" long:"labels" description:"Labels to apply to the runner (key=value format)"`
	Expires int      `short:"e" long:"expires" default:"1" description:"Hours until the invite expires"`
}) error

func RunnerInviteList added in v0.3.1

func RunnerInviteList(ctx *Context, opts struct {
	FormatOptions
	ConfigCentric
}) error

func RunnerJoin added in v0.3.1

func RunnerJoin(ctx *Context, opts struct {
	Coordinator string   `short:"c" long:"coordinator" description:"Coordinator address (host:port)"`
	ListenAddr  string   `short:"l" long:"listen" description:"Address this runner will listen on"`
	Labels      []string `long:"labels" description:"Additional labels for the runner (key=value)"`
	ConfigPath  string   `long:"config" description:"Path to save runner config" default:"/var/lib/miren/runner/config.yaml"`
	RunnerID    string   `long:"runner-id" description:"Specific runner ID to use (for reconnecting)"`

	Args struct {
		Coordinator string `positional-arg-name:"coordinator" description:"Coordinator address (host:port)"`
		JoinCode    string `positional-arg-name:"join-code" description:"Join code from 'miren runner invite'"`
	} `positional-args:"yes"`
}) error

func RunnerList added in v0.3.1

func RunnerList(ctx *Context, opts struct {
	FormatOptions
	ConfigCentric
}) error

func RunnerRevoke added in v0.3.1

func RunnerRevoke(ctx *Context, opts struct {
	ConfigCentric

	Args struct {
		InviteID string `positional-arg-name:"invite-id" description:"ID of the invite to revoke" required:"true"`
	} `positional-args:"yes" required:"true"`
}) error

func RunnerStart added in v0.4.0

func RunnerStart(ctx *Context, opts struct {
	ConfigPath       string `long:"config" description:"Path to runner config" default:"/var/lib/miren/runner/config.yaml"`
	DataPath         string `long:"data-path" description:"Path to store runner data" default:"/var/lib/miren/runner"`
	ContainerdSocket string `long:"containerd-socket" description:"Path to containerd socket"`
	ListenAddr       string `short:"l" long:"listen" description:"Address this runner will listen on (overrides config)"`
}) error

func SandboxCreate

func SandboxCreate(ctx *Context, opts struct {
	Address string `short:"a" long:"address" description:"Address to listen on" default:":8443"`
}) error

func SandboxDelete

func SandboxDelete(ctx *Context, opts struct {
	Force     bool   `short:"f" long:"force" description:"Force delete without confirmation"`
	SandboxID string `position:"0" usage:"ID of the sandbox to delete" required:"true"`
	ConfigCentric
}) error

func SandboxExec

func SandboxExec(ctx *Context, opts struct {
	ConfigCentric
	Id string `short:"i" long:"id" description:"Sandbox ID" default:"miren-sandbox"`

	Args []string `rest:"true"`
}) error

func SandboxList

func SandboxList(ctx *Context, opts struct {
	All    bool   `short:"a" long:"all" description:"Include dead sandboxes (excluded by default)"`
	Status string `short:"s" long:"status" description:"Filter by status (pending, not_ready, running, stopped, dead)"`
	FormatOptions
	ConfigCentric
}) error

func SandboxMetrics

func SandboxMetrics(ctx *Context, opts struct {
	Server  string `long:"server" description:"Server address to connect to" default:"localhost:8444"`
	Sandbox string `short:"s" long:"sandbox" description:"Sandbox name to get metrics for"`
}) error

func SandboxPoolList

func SandboxPoolList(ctx *Context, opts struct {
	FormatOptions
	ConfigCentric
}) error

func SandboxPoolSetDesired

func SandboxPoolSetDesired(ctx *Context, opts struct {
	RawID   bool   `long:"raw-id" description:"Use the provided ID as-is without adding the pool/ prefix"`
	PoolID  string `position:"0" usage:"Pool ID (e.g., pool-CUSkT8J58BmgkDeGyPP2e or pool/pool-CUSkT8J58BmgkDeGyPP2e)" required:"true"`
	Desired string `position:"1" usage:"Desired instance count (absolute number, +N to increase, or -N to decrease)" required:"true"`
	ConfigCentric
}) error

func SandboxStop

func SandboxStop(ctx *Context, opts struct {
	SandboxID string `position:"0" usage:"ID of the sandbox to stop" required:"true"`
	ConfigCentric
}) error

func Section

func Section(name, desc, help string) mflags.Command

func SelectCluster

func SelectCluster(ctx *Context, title string, clusters []string, activeCluster string, dimActive bool) (string, error)

Helper function to run cluster selection

func Server

func Server(ctx *Context, opts serverconfig.CLIFlags) error

func ServerConfigGenerate

func ServerConfigGenerate(ctx *Context, opts struct {
	Output   string `short:"o" long:"output" description:"Output file path (defaults to stdout)"`
	Mode     string `short:"m" long:"mode" description:"Server mode: standalone (default), distributed (experimental)" default:"standalone"`
	Defaults bool   `short:"d" long:"defaults" description:"Generate config with default values"`
}) error

ServerConfigGenerate generates a server configuration file

func ServerConfigValidate

func ServerConfigValidate(ctx *Context, opts struct {
	ConfigFile string `short:"f" long:"file" description:"Configuration file to validate" required:"true"`
}) error

ServerConfigValidate validates a server configuration file

func ServerInstall

func ServerInstall(ctx *Context, opts struct {
	Address      string            `short:"a" long:"address" description:"Server address to bind to" default:"0.0.0.0:8443"`
	Verbosity    string            `long:"verbosity" description:"Verbosity level" default:"-vv"`
	Branch       string            `short:"b" long:"branch" description:"Branch to download if release not found"`
	Force        bool              `short:"f" long:"force" description:"Overwrite existing service file"`
	NoStart      bool              `long:"no-start" description:"Do not start the service after installation"`
	WithoutCloud bool              `long:"without-cloud" description:"Skip cloud registration setup"`
	ClusterName  string            `short:"n" long:"name" description:"Cluster name for cloud registration"`
	CloudURL     string            `short:"u" long:"url" description:"Cloud URL for registration" default:"https://miren.cloud"`
	Tags         map[string]string `short:"t" long:"tag" description:"Tags for the cluster (key:value)"`
}) error

ServerInstall sets up systemd units to run the miren server

func ServerInstallDocker

func ServerInstallDocker(ctx *Context, opts struct {
	Image        string            `short:"i" long:"image" description:"Docker image to use" default:"oci.miren.cloud/miren:latest"`
	Name         string            `short:"n" long:"name" description:"Container name"`
	Force        bool              `short:"f" long:"force" description:"Remove existing container if present"`
	HTTPPort     int               `long:"http-port" description:"HTTP port mapping" default:"80"`
	HostNetwork  bool              `long:"host-network" description:"Use host networking (ignores port mappings)"`
	WithoutCloud bool              `long:"without-cloud" description:"Skip cloud registration setup"`
	ClusterName  string            `long:"cluster-name" description:"Cluster name for cloud registration"`
	CloudURL     string            `short:"u" long:"url" description:"Cloud URL for registration" default:"https://miren.cloud"`
	Tags         map[string]string `short:"t" long:"tag" description:"Tags for the cluster (key:value)"`
	Labs         []string          `short:"l" long:"labs" description:"Miren Labs features to enable (e.g. routeoidc,adminapi). Prefix with - to disable."`
}) error

ServerInstallDocker sets up a Docker container to run the miren server

func ServerLsvd added in v0.3.1

func ServerLsvd(ctx *Context, opts struct {
	DataPath         string `long:"data-path" description:"Path for LSVD data" default:"/var/lib/miren/disk-data"`
	NodeId           string `long:"node-id" description:"Node ID for filtering entities" required:"true"`
	EntityServerAddr string `long:"entity-server" description:"Entity server RPC address" required:"true"`
	SkipVerify       bool   `long:"skip-verify" description:"Skip TLS verification"`
}) error

ServerLsvd runs the LSVD server for managing disk volumes and mounts. This command is only meant to be invoked as an outboard process by the main miren server. It will error if OUTBOARD_CONFIG is not set.

func ServerStatus

func ServerStatus(ctx *Context, opts struct {
	Follow bool `short:"f" long:"follow" description:"Follow logs in real-time"`
}) error

ServerStatus shows the status of the miren systemd service

func ServerStatusDocker

func ServerStatusDocker(ctx *Context, opts struct {
	Name   string `short:"n" long:"name" description:"Container name" default:"miren"`
	Follow bool   `short:"f" long:"follow" description:"Follow logs in real-time"`
}) error

ServerStatusDocker shows the status of the miren Docker container

func ServerUninstall

func ServerUninstall(ctx *Context, opts struct {
	RemoveData bool   `long:"remove-data" description:"Remove /var/lib/miren directory after backing it up"`
	BackupDir  string `long:"backup-dir" description:"Directory to save backup tarball" default:"."`
	SkipBackup bool   `long:"skip-backup" description:"Skip backup when removing data (dangerous)"`
}) error

ServerUninstall removes the systemd service and optionally removes /var/lib/miren

func ServerUninstallDocker

func ServerUninstallDocker(ctx *Context, opts struct {
	Name         string `short:"n" long:"name" description:"Container name" default:"miren"`
	RemoveVolume bool   `long:"remove-volume" description:"Remove the data volume"`
	Force        bool   `short:"f" long:"force" description:"Force removal even if container is running"`
}) error

ServerUninstallDocker removes the miren Docker container and optionally the volume

func ServerUpgrade

func ServerUpgrade(ctx *Context, opts struct {
	Version        string `short:"V" long:"version" description:"Specific version to upgrade to (e.g., v0.2.0)"`
	Channel        string `long:"channel" description:"Channel to use: 'latest' (stable releases, default) or 'main' (bleeding edge)"`
	Check          bool   `short:"c" long:"check" description:"Check for available updates only"`
	Force          bool   `short:"f" long:"force" description:"Force upgrade even if already up to date"`
	Release        bool   `short:"r" long:"release" description:"Upgrade full release package (not just base)"`
	SkipHealth     bool   `long:"skip-health" description:"Skip health check after upgrade"`
	NoAutoRollback bool   `long:"no-auto-rollback" description:"Disable automatic rollback on failure"`
	HealthTimeout  int    `long:"health-timeout" description:"Health check timeout in seconds (default: 60)"`
}) error

ServerUpgrade upgrades the miren server to the latest or specified version

func ServerUpgradeRollback

func ServerUpgradeRollback(ctx *Context, opts struct {
	SkipHealth bool `long:"skip-health" description:"Skip health check after rollback"`
}) error

ServerUpgradeRollback rolls back the server to the previous version

func Set

func Set(ctx *Context, opts struct {
	AppCentric
	Concurrency int `short:"c" long:"concurrency" description:"Set maximum concurrency of application instances" required:"true"`
}) error

func TestLoad

func TestLoad(ctx *Context, opts struct {
	Requests    int           `short:"n" long:"requests" description:"Number of requests to make" default:"200"`
	Concurrency int           `short:"c" long:"concurrency" description:"Number of concurrent requests to make" default:"50"`
	RateLimit   float64       `short:"q" long:"rate-limit" description:"Rate limit in requests per second" default:"0"`
	Duration    time.Duration `short:"z" long:"duration" description:"Duration of the test"`

	Method      string   `short:"m" long:"method" description:"HTTP method to use" default:"GET"`
	Header      []string `short:"H" long:"header" description:"HTTP header to use"`
	Timeout     int      `short:"t" long:"timeout" description:"Timeout for each request in seconds" default:"20"`
	HTTP2       bool     `long:"h2" description:"Use HTTP/2"`
	Host        string   `long:"host" description:"Host header to use"`
	ContentType string   `short:"T" long:"content-type" description:"Content-Type header to use" default:"text/html"`
	AuthHeader  string   `short:"a" long:"auth" description:"Basic auth header to use"`
	Accept      string   `short:"A" long:"accept" description:"Accept header to use"`
	Body        string   `short:"d" long:"data" description:"HTTP request body"`
	BodyFile    string   `short:"D" long:"data-file" description:"File to use as request body"`
	ProxyAddr   string   `short:"x" long:"proxy" description:"Proxy URL to use"`
	UserAgent   string   `short:"U" long:"user-agent" description:"User-Agent header to use"`

	CPUS   *int   `long:"cpus" description:"Number of CPUs to use"`
	Output string `short:"o" long:"output" description:"Output type, the only support value is 'csv'"`

	DisableCompression bool `long:"disable-compression" description:"Disable compression"`
	DisableKeepAlives  bool `long:"disable-keepalives" description:"Disable keep-alives"`
	DisableRedirects   bool `long:"disable-redirects" description:"Disable redirects"`

	URL string `position:"0" usage:"URL to load test" required:"true"`
}) error

func Upgrade

func Upgrade(ctx *Context, opts struct {
	Version string `short:"V" long:"version" description:"Specific version to upgrade to (e.g., v0.2.0)"`
	Channel string `long:"channel" description:"Channel to use: 'latest' (stable releases, default) or 'main' (bleeding edge)"`
	Check   bool   `short:"c" long:"check" description:"Check for available updates only"`
	Force   bool   `short:"f" long:"force" description:"Force upgrade even if already up to date or server running"`
	User    bool   `short:"u" long:"user" description:"Install to user directory (~/.miren/release/miren) instead of system location"`
}) error

Upgrade upgrades the miren CLI to the latest or specified version

func Version

func Version(ctx *Context, opts VersionOptions) error

func Whoami

func Whoami(ctx *Context, opts struct {
	ConfigCentric
	JSON bool `long:"json" description:"Output as JSON"`
}) error

Whoami displays information about the current authenticated user

Types

type AppCentric

type AppCentric struct {
	ConfigCentric `group:"Config Options"`

	App string `short:"a" long:"app" env:"MIREN_APP" description:"Application get info about"`
	Dir string `short:"d" long:"dir" description:"Directory to run from" default:"."`
	// contains filtered or unexported fields
}

func (*AppCentric) LoadCluster added in v0.4.0

func (a *AppCentric) LoadCluster() (*clientconfig.ClusterConfig, string, error)

LoadCluster implements per-app cluster pinning. Resolution priority:

  1. -C flag (explicit override) — also saves to state
  2. Per-app cluster from ~/.config/miren/app-state.toml
  3. Global active_cluster from clientconfig (fallback)

func (*AppCentric) Validate

func (a *AppCentric) Validate(glbl *GlobalFlags) error

type BeginKeyRegistrationRequest

type BeginKeyRegistrationRequest struct {
	Name      string `json:"name"`
	KeyType   string `json:"key_type"`
	PublicKey string `json:"public_key"`
}

BeginKeyRegistrationRequest represents the request to begin key registration

type BeginKeyRegistrationResponse

type BeginKeyRegistrationResponse struct {
	Envelope  string `json:"envelope"`
	Challenge string `json:"challenge"`
}

BeginKeyRegistrationResponse represents the response from begin key registration

type ClusterResponse

type ClusterResponse struct {
	XID               string                 `json:"xid"`
	Name              string                 `json:"name"`
	Description       string                 `json:"description,omitempty"`
	Tags              map[string]interface{} `json:"tags"`
	APIAddresses      []string               `json:"api_addresses,omitempty"`
	CACertFingerprint string                 `json:"ca_cert_fingerprint,omitempty"`
	OrganizationXID   string                 `json:"organization_xid"`
	OrganizationName  string                 `json:"organization_name"`
}

ClusterResponse represents a cluster returned from the API

type Cmd

type Cmd struct {
	// contains filtered or unexported fields
}

Cmd wraps a command function with mflags parsing

func Infer

func Infer(name, syn string, f interface{}) *Cmd

Infer creates a command from a function with the signature: func(ctx *Context, opts StructType) error

func (*Cmd) FlagSet added in v0.3.0

func (w *Cmd) FlagSet() *mflags.FlagSet

FlagSet implements mflags.Command

func (*Cmd) Help

func (w *Cmd) Help() string

Help returns help text for the command

func (*Cmd) Invoke

func (w *Cmd) Invoke(args ...string) error

func (*Cmd) ReadOptions

func (w *Cmd) ReadOptions(path string) error

func (*Cmd) Run

func (w *Cmd) Run(fs *mflags.FlagSet, args []string) error

Run implements mflags.Command

func (*Cmd) Synopsis

func (w *Cmd) Synopsis() string

Synopsis returns a short description

func (*Cmd) Usage added in v0.3.0

func (w *Cmd) Usage() string

Usage implements mflags.Command

type CommandOutput

type CommandOutput struct {
	Stderr bytes.Buffer
	Stdout bytes.Buffer
}

func RunCommand

func RunCommand(f any, args ...string) (*CommandOutput, error)

type CompleteKeyRegistrationRequest

type CompleteKeyRegistrationRequest struct {
	Envelope  string `json:"envelope"`
	Signature string `json:"signature"`
}

CompleteKeyRegistrationRequest represents the request to complete key registration

type ConfigCentric

type ConfigCentric struct {
	Config  string `long:"config" description:"Path to the config file"`
	Cluster string `short:"C" long:"cluster" description:"Cluster name"`
	// contains filtered or unexported fields
}

func (*ConfigCentric) LoadCluster

func (c *ConfigCentric) LoadCluster() (*clientconfig.ClusterConfig, string, error)

func (*ConfigCentric) LoadConfig

func (c *ConfigCentric) LoadConfig() (*clientconfig.Config, error)

func (*ConfigCentric) SaveConfig

func (c *ConfigCentric) SaveConfig() error

type Context

type Context struct {
	context.Context

	Log *slog.Logger

	// A separate logger for UI output, which is always at least debug level
	UILog *slog.Logger

	Stdout io.Writer
	Stderr io.Writer

	// ServerState holds explicit server dependencies
	ServerState *ServerState

	ClientConfig  *clientconfig.Config
	ClusterConfig *clientconfig.ClusterConfig
	ClusterName   string

	Config struct {
		ServerAddress string
	}
	// contains filtered or unexported fields
}

func (*Context) Begin

func (c *Context) Begin(format string, args ...interface{})

func (*Context) Close

func (c *Context) Close() error

func (*Context) Completed

func (c *Context) Completed(format string, args ...interface{})

func (*Context) DisplayTable

func (c *Context) DisplayTable(headers []string, rows [][]string)

DisplayTable renders a formatted table with headers and rows

func (*Context) DisplayTableTemplate

func (c *Context) DisplayTableTemplate(template string, items []any)

DisplayTableTemplate renders a table using a template string to infer headers and data Template format: "HEADER1:field1,HEADER2:method2,HEADER3:field3"

func (*Context) Info

func (c *Context) Info(format string, args ...interface{})

func (*Context) Level

func (c *Context) Level() slog.Level

func (*Context) Printf

func (c *Context) Printf(format string, args ...interface{})

func (*Context) RPCClient

func (c *Context) RPCClient(name string) (*rpc.NetworkClient, error)

func (*Context) SetExitCode

func (c *Context) SetExitCode(code int)

func (*Context) Verbose added in v0.4.0

func (c *Context) Verbose() bool

func (*Context) Warn

func (c *Context) Warn(format string, args ...interface{})

type DebugAuthResponse

type DebugAuthResponse struct {
	Success       bool              `json:"success"`
	ServerVersion string            `json:"server_version,omitempty"`
	AuthMethod    string            `json:"auth_method,omitempty"`
	Identity      string            `json:"identity,omitempty"`
	UserInfo      map[string]string `json:"user_info,omitempty"`
	Message       string            `json:"message,omitempty"`
}

DebugAuthResponse represents the response from the debug-auth endpoint

type DeviceFlowExchangeResponse

type DeviceFlowExchangeResponse struct {
	Status           string `json:"status"`
	Error            string `json:"error,omitempty"`
	ErrorDescription string `json:"error_description,omitempty"`
	AccessToken      string `json:"access_token,omitempty"`
	TokenType        string `json:"token_type,omitempty"`
	ExpiresIn        int    `json:"expires_in,omitempty"`
}

DeviceFlowExchangeResponse represents the response from /api/v1/device/token

type DeviceFlowInitResponse

type DeviceFlowInitResponse struct {
	DeviceCode              string `json:"device_code"`
	UserCode                string `json:"user_code"`
	VerificationURL         string `json:"verification_uri"`
	VerificationURLComplete string `json:"verification_uri_complete,omitempty"`
	ExpiresIn               int    `json:"expires_in"`
	PollingInterval         int    `json:"polling_interval"`
}

DeviceFlowInitResponse represents the response from /api/v1/device/code

type DownloadReleaseOptions

type DownloadReleaseOptions struct {
	Branch string
	Global bool
	Force  bool
	Output string
}

DownloadReleaseOptions contains options for downloading a release

type EnvVarSpec added in v0.3.0

type EnvVarSpec struct {
	Key       string
	Value     string
	Sensitive bool
	FromFile  bool   // true if value was read from a file
	FromFile_ string // original filename if FromFile is true
}

EnvVarSpec represents a parsed environment variable specification

func ParseEnvVarSpecs added in v0.3.0

func ParseEnvVarSpecs(envSpecs, sensitiveSpecs []string) ([]EnvVarSpec, error)

ParseEnvVarSpecs parses environment variable specifications from -e and -s flags. Each spec can be: KEY=VALUE, KEY=@file, or KEY (to prompt interactively).

type ErrExitCode

type ErrExitCode int

func (ErrExitCode) Error

func (e ErrExitCode) Error() string

type FormatOptions

type FormatOptions struct {
	Format string `long:"format" description:"Output format (table, json)" default:"table"`
}

FormatOptions provides common output formatting options

func (*FormatOptions) IsJSON

func (f *FormatOptions) IsJSON() bool

IsJSON returns true if JSON format is selected (case-insensitive)

type GlobalFlags

type GlobalFlags struct {
	Verbose       []bool `short:"v" long:"verbose" description:"Enable verbose output"`
	ServerAddress string `long:"server-address" description:"Server address to connect to" default:"127.0.0.1:8443"`
	// We actually process this manually, but we include it here so that it validates.
	Options string `long:"options" description:"Path to file containing options"`
}

type KeyRegistrationResponse

type KeyRegistrationResponse struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Fingerprint string `json:"fingerprint"`
	CreatedAt   string `json:"created_at"`
}

KeyRegistrationResponse represents a successfully registered key

type Model

type Model struct {
	// contains filtered or unexported fields
}

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Model) View

func (m Model) View() string

type OptsValidate

type OptsValidate interface {
	Validate(glbl *GlobalFlags) error
}

type RegisterOptions

type RegisterOptions struct {
	ClusterName string            `short:"n" long:"name" description:"Cluster name" required:"true"`
	CloudURL    string            `short:"u" long:"url" description:"Cloud URL" default:"https://miren.cloud"`
	Tags        map[string]string `short:"t" long:"tag" description:"Tags for the cluster (key:value)"`
	OutputDir   string            `short:"o" long:"output" description:"Output directory for registration" default:"/var/lib/miren/server"`
}

RegisterOptions contains options for cluster registration

type SelectionModel

type SelectionModel struct {
	Title string
	Items []string

	Selected  string
	Cancelled bool
	Footer    string // Optional footer text

	// Optional styling/marking functions
	ItemMarker func(item string) string         // Returns marker like " *" for special items
	ItemStyle  func(item string) lipgloss.Style // Returns style for special items
	// contains filtered or unexported fields
}

SelectionModel is a generic model for selecting from a list of items

func (*SelectionModel) Init

func (m *SelectionModel) Init() tea.Cmd

func (*SelectionModel) SetCursor

func (m *SelectionModel) SetCursor(index int)

SetCursor sets the cursor to the specified index

func (*SelectionModel) Update

func (m *SelectionModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*SelectionModel) View

func (m *SelectionModel) View() string

type ServerState added in v0.3.0

type ServerState struct {
	// Containerd
	ContainerdSocket string
	CC               *containerd.Client
	Namespace        string

	// Network
	Bridge          string
	Subnet          *netdb.Subnet
	ServicePrefixes []netip.Prefix
	NetServ         *network.ServiceManager
	IPv4Routable    netip.Prefix

	// Paths
	DataPath string
	Tempdir  string

	// VictoriaLogs
	VictorialogsAddress string
	VictorialogsTimeout time.Duration

	// VictoriaMetrics
	VictoriametricsAddress string
	VictoriametricsTimeout time.Duration

	// Metrics
	Writer      *metrics.VictoriaMetricsWriter
	Reader      *metrics.VictoriaMetricsReader
	CPU         *metrics.CPUUsage
	Mem         *metrics.MemoryUsage
	HTTPMetrics *metrics.HTTPMetrics

	// Observability
	LogsMaintainer *observability.LogsMaintainer
	LogWriter      observability.LogWriter
	Logs           *observability.LogReader
	StatusMon      *observability.StatusMonitor

	// Sandbox
	SandboxMetrics *sandbox.Metrics
}

ServerState holds all server dependencies explicitly, replacing the asm.Registry.

func NewServerState added in v0.3.0

func NewServerState() *ServerState

NewServerState creates a new ServerState with default values.

func (*ServerState) InitContainerd added in v0.3.0

func (s *ServerState) InitContainerd() error

InitContainerd creates the containerd client if not already set.

func (*ServerState) InitLogsMaintainer added in v0.3.0

func (s *ServerState) InitLogsMaintainer()

InitLogsMaintainer creates the logs maintainer if not already set.

func (*ServerState) InitMetricsReader added in v0.3.0

func (s *ServerState) InitMetricsReader(log *slog.Logger)

InitMetricsReader creates the VictoriaMetrics reader if not already set.

func (*ServerState) InitMetricsWriter added in v0.3.0

func (s *ServerState) InitMetricsWriter(log *slog.Logger)

InitMetricsWriter creates the VictoriaMetrics writer if not already set.

func (*ServerState) InitNetServ added in v0.3.0

func (s *ServerState) InitNetServ(log *slog.Logger, eac *entityserver_v1alpha.EntityAccessClient)

InitNetServ creates the network service manager if not already set.

func (*ServerState) InitSandboxMetrics added in v0.3.0

func (s *ServerState) InitSandboxMetrics(log *slog.Logger)

InitSandboxMetrics creates the sandbox metrics if not already set. Note: CPU and Mem should be initialized before calling this method.

func (*ServerState) InitStatusMonitor added in v0.3.0

func (s *ServerState) InitStatusMonitor(log *slog.Logger)

InitStatusMonitor creates the status monitor if not already set.

type TickMsg

type TickMsg struct {
	Time time.Time
}

type VersionOptions

type VersionOptions struct {
	Deps   bool   `long:"deps" description:"Show dependencies"`
	Format string `long:"format" description:"Output format (text, json)" default:"text"`
}

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL