Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackupType ¶
type BackupType string
const ( BackupLitestream BackupType = "litestream" BackupNone BackupType = "none" )
type DatabaseType ¶
type DatabaseType string
const ( DatabaseSQLite DatabaseType = "sqlite" DatabasePostgres DatabaseType = "postgres" DatabaseNone DatabaseType = "none" )
type Generator ¶
type Generator interface {
// Generate creates deployment configuration files
Generate(ctx context.Context, config StackConfig, outputDir string) error
// Validate checks if the generated stack is valid
Validate(ctx context.Context, stackDir string) error
// GetInfo returns information about the stack
GetInfo(ctx context.Context, stackDir string) (*StackInfo, error)
}
Generator is the interface all providers must implement
type IngressType ¶
type IngressType string
const ( IngressNginx IngressType = "nginx" IngressTraefik IngressType = "traefik" IngressNone IngressType = "none" )
type RegistryType ¶
type RegistryType string
const ( RegistryGHCR RegistryType = "ghcr" RegistryDocker RegistryType = "docker" RegistryGCR RegistryType = "gcr" RegistryECR RegistryType = "ecr" )
type StackConfig ¶
type StackConfig struct {
Provider Provider
Database DatabaseType
Backup BackupType
Redis RedisType
Storage StorageType
CI CIType
Namespace string
MultiRegion bool
Ingress IngressType
Registry RegistryType
// ProjectDir is the project root directory. When set, generators use it
// instead of deriving the root via filepath.Dir(outputDir). This makes
// the contract explicit and avoids assumptions about directory depth.
ProjectDir string
}
func (*StackConfig) NeedsCompose ¶
func (c *StackConfig) NeedsCompose() bool
NeedsCompose returns true when the stack needs multiple services.
func (StackConfig) ResolveProjectDir ¶
func (c StackConfig) ResolveProjectDir(outputDir string) string
ResolveProjectDir returns ProjectDir if set, otherwise derives it from outputDir by taking its parent directory (filepath.Dir). The fallback assumes outputDir is exactly one level below the project root (e.g., <project>/deploy). Callers should prefer setting ProjectDir explicitly to avoid relying on this assumption.
func (*StackConfig) ToTemplateData ¶
func (c *StackConfig) ToTemplateData(projectName string) *TemplateData
func (*StackConfig) Validate ¶
func (c *StackConfig) Validate() error
type StackInfo ¶
type StackInfo struct {
Provider string
Configuration TrackingConfig
ModifiedFiles []string
RequiredSecrets []string
DeploymentCommand string
EstimatedCost string
}
StackInfo contains information about a deployed stack
type StorageType ¶
type StorageType string
const ( StorageS3 StorageType = "s3" StorageDO StorageType = "do-spaces" StorageB2 StorageType = "b2" StorageNone StorageType = "none" )
type TemplateData ¶
type TrackedFile ¶
type TrackedFile struct {
Path string `yaml:"path"`
Checksum string `yaml:"checksum"`
Modified bool `yaml:"modified"`
}
TrackedFile represents a single tracked file
type TrackingConfig ¶
type TrackingConfig struct {
Database string `yaml:"database"`
Backup string `yaml:"backup"`
Redis string `yaml:"redis"`
Storage string `yaml:"storage"`
CI string `yaml:"ci"`
Namespace string `yaml:"namespace,omitempty"`
MultiRegion bool `yaml:"multi_region,omitempty"`
Ingress string `yaml:"ingress,omitempty"`
Registry string `yaml:"registry,omitempty"`
}
TrackingConfig holds the configuration used to generate the stack
type TrackingFile ¶
type TrackingFile struct {
Version int `yaml:"version"`
Provider string `yaml:"provider"`
GeneratedAt time.Time `yaml:"generated_at"`
GeneratorVersion string `yaml:"generator_version"`
Configuration TrackingConfig `yaml:"configuration"`
Files []TrackedFile `yaml:"files"`
}
TrackingFile represents the .lvtstack file
func NewTrackingFile ¶
func NewTrackingFile(config StackConfig, generatorVersion string) *TrackingFile
NewTrackingFile creates a new tracking file from config
func ReadTrackingFile ¶
func ReadTrackingFile(path string) (*TrackingFile, error)
ReadTrackingFile reads a tracking file from disk
func (*TrackingFile) AddFile ¶
func (t *TrackingFile) AddFile(path, checksum string)
AddFile adds a file to tracking
func (*TrackingFile) CheckModifications ¶
func (t *TrackingFile) CheckModifications(baseDir string) ([]string, error)
CheckModifications checks if any tracked files have been modified
func (*TrackingFile) Write ¶
func (t *TrackingFile) Write(path string) error
Write writes the tracking file to disk