host

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package host manages the Miabi stack on the machine the CLI runs on, as opposed to talking to a panel over HTTP. It is the CLI's half of the platform-stack engine: everything Docker-specific lives behind Open, which is stubbed out on platforms that cannot host a stack.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupported = errors.New("stack management requires a Linux or macOS host with Docker")

ErrUnsupported is returned by Open on a platform with no Docker host to manage.

Functions

func InspectSelfImage

func InspectSelfImage(ctx context.Context, id string) string

InspectSelfImage reads back the image of the container with the given id, so an installer running as a container can pin the exact ref it was started from. Empty when it cannot be determined.

func ManifestPath

func ManifestPath(flag string) string

ManifestPath resolves the manifest to operate on: the --file flag if given, else the platform default (see stack.ManifestPath).

func OtherInstall added in v0.13.2

func OtherInstall(path string) string

OtherInstall returns a manifest that exists somewhere other than path, or "" when there is none.

Two installs on one host are not two installs: they converge the same container, volume and network names against the same Docker daemon, and the second one adopts and then fights over the first one's containers. Better to refuse than to discover it as a restart loop.

func RequireReadable added in v0.13.2

func RequireReadable(path string) error

RequireReadable fails early when the manifest exists but this process cannot read it. The file is mode 0600 because it holds the database password, so "you are not the owner" is the likely reason and is worth saying outright.

func RequireWritable added in v0.13.2

func RequireWritable(path string) error

RequireWritable fails early when this process cannot write the manifest, rather than surfacing a permission error from three layers down.

func UserManifestPath added in v0.13.2

func UserManifestPath() string

UserManifestPath is where a non-root install keeps its manifest: ~/.miabi/miabi.yaml, beside the CLI's own config. The gateway config lands next to it, because everything an install needs is resolved relative to the manifest. Empty when there is no home directory.

It mirrors stack.UserConfigPath in the platform module, which this CLI tracks by release: fold this into a call to that one on the next dependency bump.

Types

type Session

type Session struct {
	Svc      *stack.Service
	Manifest string
	// contains filtered or unexported fields
}

Session is an open connection to the local Docker engine plus the stack service driving it. Close releases the connection.

func Open

func Open(manifestPath string, log func(string, ...any)) (*Session, error)

Open connects to the local Docker engine and returns a stack service bound to manifestPath. The daemon is pinged before anything else so an unreachable or permission-denied socket is reported once, in the operator's language, instead of failing inside the first converge step.

func (*Session) Close

func (s *Session) Close() error

Close releases the Docker connection.

Jump to

Keyboard shortcuts

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