bootstrap

package
v0.2.2 Latest Latest
Warning

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

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

Documentation

Overview

Package bootstrap assembles and runs Deploy.

Core owns its infrastructure and lifecycle. Embedding binaries customize only the deliberately public options supplied to AssembleCore or Run.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(version string, functionalOptions ...Option) error

Run assembles Core, owns SIGINT and SIGTERM, and blocks until shutdown. Returned errors retain their causes so the embedding command can choose how process failures are rendered.

Types

type Core

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

Core is one fully assembled deploy control plane. Run consumes the assembled resources, blocks for their complete lifecycle, and may be called exactly once.

func AssembleCore

func AssembleCore(
	ctx context.Context,
	version string,
	functionalOptions ...Option,
) (*Core, error)

AssembleCore builds the service in dependency order without starting any worker or listener. The returned Core owns every assembled dependency; its Run method releases them on every exit path and may be called exactly once.

func (*Core) Close

func (core *Core) Close() error

Close releases an assembled Core that will not be run. Run owns resources while active, so Close reports an error until Run reaches its terminal state. At either terminal boundary, repeated Close calls return the same result.

func (*Core) Run

func (core *Core) Run(ctx context.Context) error

Run starts the assembled workers and HTTP listener, then releases every owned dependency after cancellation or failure. A Core cannot be restarted.

type IHTTPService

type IHTTPService interface {
	Register(router gin.IRouter)
}

IHTTPService is one optional component that mounts routes on Core's single caller-owned Gin engine.

type Option

type Option func(settings *assemblyOptions) error

Option changes one public Core assembly policy.

func WithBrand

func WithBrand(brand webui.Brand) Option

WithBrand replaces the stock Deploy identity: the product name, the agent name, the wordmark, and the web UI's design tokens. Unset Brand fields keep their stock values.

The brand is applied in one place and read in two: Core stamps the two brand-bearing names into every snapshot it produces, and the web UI renders the wordmark and serves the palette. Both receive the same resolved value, so the pages and the browser client cannot disagree about who they are.

func WithComponent

func WithComponent(definition *component.Definition) Option

WithComponent registers one component the embedding repository owns. Core assembles it after its own dependencies and before the agent harness, starts it immediately before the harness starts, and stops it after the harness closes, in the exact reverse of the resolved order. The option is repeatable; registered components resolve among themselves by their declared requirements, with registration order breaking ties.

func WithHTTPService

func WithHTTPService(service IHTTPService) Option

WithHTTPService adds a caller-supplied HTTP component beside Core's default API and Web UI on the same Gin engine.

func WithHarnessFactory

func WithHarnessFactory(factory harness.IFactory) Option

WithHarnessFactory replaces the configuration-selected built-in harness. Core continues to own persistence, fleet observation, reconciliation, and the HTTP surface around the supplied implementation.

func WithNavItem

func WithNavItem(item webui.NavItem) Option

WithNavItem appends one entry to the operator sidebar, after Core's own Home, Apps, Fleet, and Activity entries. It is repeatable, entries render in registration order, and an entry that cannot be rendered as one labeled link fails assembly before any infrastructure is opened.

A registered entry is a plain link to somewhere the embedding product already serves — a page it mounted with WithHTTPService, for instance. Core's own routes, including the /claws/... paths, are unchanged by one.

func WithPII

func WithPII() Option

WithPII permits raw configuration-derived values in returned errors and structured diagnostics. Without this option, Core redacts its known secrets.

func WithUIOverlay

func WithUIOverlay(overlay fs.FS) Option

WithUIOverlay resolves the operator UI's templates and assets against a caller-supplied filesystem before the embedded one. The overlay carries a templates/ subtree whose files redefine the shipped named blocks and an assets/ subtree whose files replace the embedded asset of the same name; anything the overlay does not name keeps shipping from Core. The supported block names and the data each receives are documented on the webui package.

Only one overlay may be supplied, and a nil one is rejected here rather than silently ignored. A template that does not parse fails Core's HTTP startup component, since that is where the pages are built.

Jump to

Keyboard shortcuts

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