Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SaveStackToFile ¶
SaveStackToFile saves a stack definition to a JSON-LD file.
func StackToJSON ¶
StackToJSON converts a stack to JSON-LD bytes.
Types ¶
type Action ¶
type Action struct {
// Type is the schema.org type (Action)
Type string `json:"@type"`
// Name is a human-readable name for the action
Name string `json:"name"`
// ActionType categorizes the action (migration, init, seed, etc.)
ActionType string `json:"actionType,omitempty"`
// Target specifies which container to run the command in
// If empty, runs in the container this action belongs to
Target string `json:"target,omitempty"`
// Command is the command to execute
Command []string `json:"command"`
// Timeout in seconds (0 = no timeout)
Timeout int `json:"timeout,omitempty"`
// WorkingDirectory for command execution
WorkingDirectory string `json:"workingDirectory,omitempty"`
}
Action represents a post-start command (migration, initialization, etc.).
Schema.org Reference: https://schema.org/Action
type HealthCheckConfig ¶
type HealthCheckConfig struct {
// Type is the health check type (http, tcp, command, postgres, redis, etc.)
Type string `json:"type"`
// Command for command-based health checks
Command []string `json:"command,omitempty"`
// Interval in seconds between health checks
Interval int `json:"interval,omitempty"`
// Timeout in seconds for each health check
Timeout int `json:"timeout,omitempty"`
// Retries before considering unhealthy
Retries int `json:"retries,omitempty"`
// StartPeriod grace period before health checks start
StartPeriod int `json:"startPeriod,omitempty"`
// Path for HTTP health checks
Path string `json:"path,omitempty"`
// Port for TCP/HTTP health checks (0 = use first exposed port)
Port int `json:"port,omitempty"`
}
HealthCheckConfig defines health check configuration.
type NetworkConfig ¶
type NetworkConfig struct {
// Name is the network name
Name string `json:"name"`
// Driver is the network driver (bridge, overlay, etc.)
Driver string `json:"driver,omitempty"`
// CreateIfNotExists creates the network if it doesn't exist
CreateIfNotExists bool `json:"createIfNotExists,omitempty"`
}
NetworkConfig defines network configuration for the stack.
type PortMapping ¶
type PortMapping struct {
// ContainerPort is the port inside the container
ContainerPort int `json:"containerPort"`
// HostPort is the port on the host (0 = random port)
HostPort int `json:"hostPort,omitempty"`
// Protocol is the protocol (tcp, udp)
Protocol string `json:"protocol,omitempty"`
}
PortMapping defines a port mapping for a container.
type SoftwareRequirement ¶
type SoftwareRequirement struct {
// Type is the schema.org type (SoftwareApplication)
Type string `json:"@type"`
// Name is the name of the required container
Name string `json:"name"`
// WaitForHealthy indicates whether to wait for the container to be healthy
WaitForHealthy bool `json:"waitForHealthy"`
}
SoftwareRequirement specifies a dependency on another container.
Schema.org Reference: https://schema.org/SoftwareApplication (softwareRequirements)
type Stack ¶
type Stack struct {
// Context is the JSON-LD context (schema.org)
Context string `json:"@context"`
// Type is the schema.org type (ItemList)
Type string `json:"@type"`
// Name is the stack name
Name string `json:"name"`
// Description provides a human-readable description
Description string `json:"description,omitempty"`
// ItemListElement contains the containers in the stack
ItemListElement []StackItemElement `json:"itemListElement"`
// Network configuration for the stack
Network NetworkConfig `json:"network,omitempty"`
// Volumes shared across containers in the stack
Volumes []VolumeConfig `json:"volumes,omitempty"`
}
Stack represents a schema.org ItemList containing multiple containers.
This implements the schema.org ItemList structure for defining multi-container deployments with dependency ordering and orchestration.
Schema.org Reference: https://schema.org/ItemList
func LoadStackFromFile ¶
LoadStackFromFile loads a stack definition from a JSON-LD file.
The file should contain a schema.org ItemList with SoftwareApplication elements.
Example:
stack, err := LoadStackFromFile("definitions/infisical.json")
if err != nil {
log.Fatal(err)
}
func LoadStackFromJSON ¶
LoadStackFromJSON loads a stack definition from JSON-LD bytes.
func (*Stack) GetContainerByName ¶
func (s *Stack) GetContainerByName(name string) (*StackItemElement, error)
GetContainerByName returns a container by name.
func (*Stack) GetDependencies ¶
GetDependencies returns all dependencies for a container (direct and transitive).
func (*Stack) GetStartupOrder ¶
func (s *Stack) GetStartupOrder() []StackItemElement
GetStartupOrder returns containers in the order they should be started.
type StackDeployment ¶
type StackDeployment struct {
// Stack is the stack definition
Stack Stack
// Containers maps container names to their IDs
Containers map[string]string
// Network is the network ID
Network string
// Volumes maps volume names to their IDs
Volumes map[string]string
// StartTime when the stack was deployed
StartTime time.Time
}
StackDeployment represents a deployed stack with container IDs.
type StackItemElement ¶
type StackItemElement struct {
// Type is the schema.org type (SoftwareApplication)
Type string `json:"@type"`
// Position determines startup order (lower numbers start first)
Position int `json:"position"`
// Name is the container name (unique identifier)
Name string `json:"name"`
// ApplicationCategory categorizes the application (Database, Cache, etc.)
ApplicationCategory string `json:"applicationCategory,omitempty"`
// SoftwareVersion is the version/tag of the software
SoftwareVersion string `json:"softwareVersion,omitempty"`
// Image is the Docker image (e.g., "postgres:17")
Image string `json:"image"`
// Dependencies and ordering
// Requirements lists the names of containers that must start before this one
Requirements []string `json:"requirements,omitempty"`
// SoftwareRequirements provides detailed dependency specifications
SoftwareRequirements []SoftwareRequirement `json:"softwareRequirements,omitempty"`
// Container configuration
// Environment variables for the container
Environment map[string]string `json:"environment,omitempty"`
// Ports to expose and map
Ports []PortMapping `json:"ports,omitempty"`
// Volumes to mount
Volumes []VolumeMount `json:"volumeMounts,omitempty"`
// HealthCheck configuration
HealthCheck HealthCheckConfig `json:"healthCheck,omitempty"`
// Command overrides the default container command
Command []string `json:"command,omitempty"`
// Post-start actions (migrations, initialization)
// PotentialAction uses schema.org Action for post-start commands
// Schema.org Reference: https://schema.org/potentialAction
PotentialAction []Action `json:"potentialAction,omitempty"`
}
StackItemElement represents a container in the stack as a schema.org SoftwareApplication.
Each container is modeled as a SoftwareApplication with dependencies, health checks, and post-start actions (migrations, initialization).
Schema.org Reference: https://schema.org/SoftwareApplication
type VolumeConfig ¶
type VolumeConfig struct {
// Name is the volume name
Name string `json:"name"`
// Driver is the volume driver
Driver string `json:"driver,omitempty"`
// CreateIfNotExists creates the volume if it doesn't exist
CreateIfNotExists bool `json:"createIfNotExists,omitempty"`
}
VolumeConfig defines a shared volume for the stack.
type VolumeMount ¶
type VolumeMount struct {
// Source is the volume name or host path
Source string `json:"source"`
// Target is the mount path inside the container
Target string `json:"target"`
// ReadOnly indicates if the mount is read-only
ReadOnly bool `json:"readOnly,omitempty"`
// Type is the mount type (volume, bind, tmpfs)
Type string `json:"type,omitempty"`
}
VolumeMount defines a volume mount for a container.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package production provides production-ready stack deployment functions.
|
Package production provides production-ready stack deployment functions. |
|
Package testing provides testcontainers-based stack setup for integration tests.
|
Package testing provides testcontainers-based stack setup for integration tests. |