Help us shape the future of Go! Take the 2026 Go Developer Survey

runtime

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultPostgresPort = 5432
	DefaultOpenBaoPort  = 8200
)

Variables

View Source
var ErrResourceOwnership = errors.New("runtime resource ownership does not match the application project")
View Source
var ErrRuntimeNotFound = errors.New("docker compose or podman compose not found")

Functions

func IsPortBindingConflict

func IsPortBindingConflict(err error) bool

IsPortBindingConflict reports whether a Docker/Podman Compose failure is a host-port allocation conflict. Runtime engines phrase the same condition differently, so keep the classifier deliberately narrow but multi-engine.

Types

type Compose

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

Compose provides the small lifecycle surface BaseHarbor needs from a container runtime. Application code should not shell out to Docker/Podman directly.

func DetectCompose

func DetectCompose(ctx context.Context) (Compose, error)

func (Compose) Config

func (c Compose) Config(ctx context.Context, composeFile, envFile string) error

func (Compose) ConfigJSONProjectFilesEnv

func (c Compose) ConfigJSONProjectFilesEnv(ctx context.Context, project, workdir string, environment map[string]string, composeFiles ...string) (string, error)

func (Compose) ConfigProject

func (c Compose) ConfigProject(ctx context.Context, project, composeFile, envFile string) error

func (Compose) ConfigProjectFiles

func (c Compose) ConfigProjectFiles(ctx context.Context, project, workdir string, composeFiles ...string) error

func (Compose) ConfigProjectFilesEnv

func (c Compose) ConfigProjectFilesEnv(ctx context.Context, project, workdir string, environment map[string]string, composeFiles ...string) error

func (Compose) DestroyProject

func (c Compose) DestroyProject(ctx context.Context, project, composeFile, envFile string) error

func (Compose) Down

func (c Compose) Down(ctx context.Context, composeFile, envFile string) error

func (Compose) DownProject

func (c Compose) DownProject(ctx context.Context, project, composeFile, envFile string) error

func (Compose) DownProjectFiles

func (c Compose) DownProjectFiles(ctx context.Context, project, workdir string, composeFiles ...string) error

func (Compose) DownProjectFilesEnv

func (c Compose) DownProjectFilesEnv(ctx context.Context, project, workdir string, environment map[string]string, composeFiles ...string) error

func (Compose) ExecProject

func (c Compose) ExecProject(ctx context.Context, project, composeFile, envFile, service string, args ...string) (string, error)

func (Compose) ExecProjectFiles

func (c Compose) ExecProjectFiles(ctx context.Context, project, workdir, service string, composeFiles []string, args ...string) (string, error)

func (Compose) ExecProjectInput

func (c Compose) ExecProjectInput(ctx context.Context, project, composeFile, envFile string, input []byte, service string, args ...string) (string, error)

ExecProjectInput executes a command inside a Compose service while supplying stdin without placing that input in the host process argument list. It is intended for sensitive operator flows such as OpenBao unseal/authentication.

func (Compose) InspectProjectResource

func (c Compose) InspectProjectResource(ctx context.Context, project string, resource ProjectResource) (bool, error)

InspectProjectResource verifies an exact runtime resource name before a destructive operation. A resource with the expected name but a different Compose project label is an ownership conflict, never an implicit match.

func (Compose) RunningServicesProject

func (c Compose) RunningServicesProject(ctx context.Context, project, composeFile, envFile string) ([]string, error)

func (Compose) RunningServicesProjectFiles

func (c Compose) RunningServicesProjectFiles(ctx context.Context, project, workdir string, composeFiles ...string) ([]string, error)

func (Compose) RunningServicesProjectFilesEnv

func (c Compose) RunningServicesProjectFilesEnv(ctx context.Context, project, workdir string, environment map[string]string, composeFiles ...string) ([]string, error)

func (Compose) ServicesProjectFiles

func (c Compose) ServicesProjectFiles(ctx context.Context, project, workdir string, composeFiles ...string) ([]string, error)

func (Compose) ServicesProjectFilesEnv

func (c Compose) ServicesProjectFilesEnv(ctx context.Context, project, workdir string, environment map[string]string, composeFiles ...string) ([]string, error)

func (Compose) Status

func (c Compose) Status(ctx context.Context, composeFile, envFile string) (string, error)

func (Compose) StatusProject

func (c Compose) StatusProject(ctx context.Context, project, composeFile, envFile string) (string, error)

func (Compose) StatusProjectFiles

func (c Compose) StatusProjectFiles(ctx context.Context, project, workdir string, composeFiles ...string) (string, error)

func (Compose) StopProjectFilesSelected

func (c Compose) StopProjectFilesSelected(ctx context.Context, project, workdir string, environment map[string]string, services []string, composeFiles ...string) error

func (Compose) Up

func (c Compose) Up(ctx context.Context, composeFile, envFile string) error

func (Compose) UpProject

func (c Compose) UpProject(ctx context.Context, project, composeFile, envFile string) error

func (Compose) UpProjectFiles

func (c Compose) UpProjectFiles(ctx context.Context, project, workdir string, composeFiles ...string) error

func (Compose) UpProjectFilesSelected

func (c Compose) UpProjectFilesSelected(ctx context.Context, project, workdir string, environment map[string]string, services []string, composeFiles ...string) error

type Config

type Config struct {
	PostgresDB       string
	PostgresUser     string
	PostgresPassword string
	PostgresPort     int
	OpenBaoPort      int
}

func LoadConfig

func LoadConfig(envPath string) (Config, error)

type Files

type Files struct {
	Compose string
	Env     string
}

func EnsureFiles

func EnsureFiles(stateDir string) (Files, error)

func EnsureFilesWithPorts

func EnsureFilesWithPorts(stateDir string, ports Ports) (Files, error)

func ExistingFiles

func ExistingFiles(stateDir string) (Files, error)

type Ports

type Ports struct {
	Postgres int
	OpenBao  int
}

type ProjectResource

type ProjectResource struct {
	Kind string
	Name string
}

Jump to

Keyboard shortcuts

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