deployment

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package deployment enters the runtime described by a deployed release. Applications opt in only when neither --config nor --env-file was supplied.

Index

Constants

View Source
const BindingsEnvironment = "FOUNDRY_DEPLOY_RUNTIME_FILE"

BindingsEnvironment selects the root-owned descriptor for this role invocation.

View Source
const RuntimeDescriptor = "config/deploy-runtime.json"

RuntimeDescriptor is the release-relative deployment descriptor path.

Variables

This section is empty.

Functions

This section is empty.

Types

type BindingName added in v0.31.0

type BindingName string

BindingName identifies a binding declared by the consuming role.

type Bindings added in v0.31.0

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

Bindings is an immutable startup snapshot. Pass concrete values to business handlers. Its zero value has no bindings; a missing name returns fault.Missing.

func LoadBindings added in v0.31.0

func LoadBindings() (Bindings, bool, error)

LoadBindings reads the descriptor selected by the deployment unit. Absence is reported separately from malformed configuration; an explicit bad path never falls back.

func ReadBindings added in v0.31.0

func ReadBindings(path string) (Bindings, error)

ReadBindings loads a bounded, nonsecret descriptor. Host-side executable and artifact verification remains the deployment owner's responsibility.

func (Bindings) Bundle added in v0.31.0

func (b Bindings) Bundle(name BindingName) (BundleDirectory, error)

Bundle returns the named service-local bundle directory. A missing name returns an error classified as fault.Missing.

func (Bindings) DeploymentSHA256 added in v0.31.0

func (b Bindings) DeploymentSHA256() SHA256

DeploymentSHA256 returns the digest of the selected deployment.

func (Bindings) Endpoint added in v0.31.0

func (b Bindings) Endpoint(name BindingName) (Endpoint, error)

Endpoint returns the named private endpoint. A missing name returns an error classified as fault.Missing.

func (Bindings) Executable added in v0.31.0

func (b Bindings) Executable(name BindingName) (Executable, error)

Executable returns the named executable. A missing name returns an error classified as fault.Missing.

func (Bindings) Unit added in v0.31.0

func (b Bindings) Unit() Unit

Unit returns the identity of the role invocation that owns these bindings.

type BundleDirectory added in v0.31.0

type BundleDirectory struct {
	// Path is the absolute path of the protected directory view.
	Path string
	// SHA256 identifies the artifact that supplies this bundle.
	SHA256 SHA256
}

BundleDirectory is the protected service-local view, not the artifact's host path.

type Endpoint added in v0.31.0

type Endpoint struct {
	// Role identifies the producer of this endpoint.
	Role RoleName
	// Listener identifies the producer's listener.
	Listener ListenerName
	// Scheme selects HTTP or TCP addressing.
	Scheme EndpointScheme
	// Address is the allocated loopback address.
	Address netip.Addr
	// Port is the allocated private port, not the public edge port.
	Port uint16
}

Endpoint is an allocated private endpoint. It is immutable for this invocation.

func (Endpoint) URL added in v0.31.0

func (e Endpoint) URL() url.URL

URL returns the endpoint scheme and host with its port, without a path.

type EndpointScheme added in v0.31.0

type EndpointScheme string

EndpointScheme identifies the protocol used to address a private endpoint.

const (
	// HTTP addresses a private HTTP listener.
	HTTP EndpointScheme = "http"
	// TCP addresses a private TCP listener.
	TCP EndpointScheme = "tcp"
)

type Executable added in v0.31.0

type Executable struct {
	// Path is the absolute path of the host-verified executable.
	Path string
	// SHA256 identifies the executable source recorded by the host.
	SHA256 SHA256
}

Executable is a host-verified absolute file, never a PATH search or shell command.

type InstanceID added in v0.31.0

type InstanceID string

InstanceID is the UUID of the deployed environment instance.

type ListenerName added in v0.31.0

type ListenerName string

ListenerName identifies a listener within its producing role.

type RoleName added in v0.31.0

type RoleName string

RoleName identifies a builtin or executable role in the topology.

type Runtime

type Runtime struct {
	// Release is the absolute path of the selected release.
	Release string
	// Instance is the deployed instance name.
	Instance string
	// User is the instance account used to run the application.
	User string
	// ConfigFile is the selected release's application configuration file.
	ConfigFile string
	// EnvFile is the selected runtime environment file.
	EnvFile string
	// WorkDir is the application working directory.
	WorkDir string
	// PublicDir is the selected release's public asset directory.
	PublicDir string
}

Runtime contains the release profile and the instance's runtime paths. Use Detect to obtain it before calling Enter.

func Detect

func Detect() (Runtime, bool, error)

Detect reads the role descriptor selected by BindingsEnvironment, or the descriptor beside the resolved executable when that variable is absent. An absent legacy descriptor returns ok=false; an invalid or unreadable descriptor returns an error without falling back.

func (Runtime) Enter

func (r Runtime) Enter(args []string) error

Enter replaces a root Linux process with runuser and forwards args unchanged (pass os.Args[1:]). Other users enter WorkDir and default WEB__PUBLIC_DIR to PublicDir only when unset. After Enter, load ConfigFile and EnvFile explicitly. A successful root exec never returns. Root on other platforms is unsupported.

type SHA256 added in v0.31.0

type SHA256 string

SHA256 is a lowercase hexadecimal SHA-256 digest.

type Unit added in v0.31.0

type Unit struct {
	// Instance identifies the deployed environment instance.
	Instance InstanceID
	// Role identifies the placed service role.
	Role RoleName
	// Ordinal is the service copy number; the preview supports only one.
	Ordinal uint16
}

Unit identifies a single placed service. Ordinals above one require a later capability.

Jump to

Keyboard shortcuts

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