api

package
v0.0.0-...-2c85719 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClientSchemaVersion = "1.0"

	ClientTypeCloudCompose = "cloud-compose"
	ClientTypeStatic       = "static"
	ClientTypeSingleImage  = "single-image"
)
View Source
const (
	ComposeLabelIngressContainer            = "simple-container.com/ingress"
	ComposeLabelVolumeSize                  = "simple-container.com/volume-size"
	ComposeLabelVolumeAccessModes           = "simple-container.com/volume-access-modes"
	ComposeLabelVolumeStorageClass          = "simple-container.com/volume-storage-class"
	ComposeLabelIngressPort                 = "simple-container.com/ingress/port"
	ComposeLabelHealthcheckSuccessCodes     = "simple-container.com/healthcheck/success-codes"
	ComposeLabelHealthcheckHealthyThreshold = "simple-container.com/healthcheck/healthy-threshold"
	ComposeLabelHealthcheckPath             = "simple-container.com/healthcheck/path"
	ComposeLabelHealthcheckPort             = "simple-container.com/healthcheck/port"
)
View Source
const (
	ScConfigDirectory                  = ".sc"
	EnvConfigFileTemplate              = "cfg.%s.yaml"
	ScConfigEnvVariable                = "SIMPLE_CONTAINER_CONFIG"
	ScContainerResourceTypeEnvVariable = "SIMPLE_CONTAINER_RESOURCE_TYPE"
)
View Source
const (
	ServerDescriptorFileName  = "server.yaml"
	SecretsDescriptorFileName = "secrets.yaml"
	ClientDescriptorFileName  = "client.yaml"
)
View Source
const SecretsSchemaVersion = "1.0"
View Source
const ServerSchemaVersion = "1.0"

Variables

View Source
var (
	ReadIgnoreNoClientCfg           = ReadOpts{IgnoreClientMissing: true}
	ReadIgnoreNoServerCfg           = ReadOpts{IgnoreServerMissing: true, IgnoreSecretsMissing: true}
	ReadIgnoreNoSecretsAndClientCfg = ReadOpts{IgnoreSecretsMissing: true, IgnoreClientMissing: true}
	ReadIgnoreNoSecretsAndServerCfg = ReadOpts{IgnoreSecretsMissing: true, IgnoreServerMissing: true}
	ReadIgnoreNoAnyCfg              = ReadOpts{IgnoreSecretsMissing: true, IgnoreServerMissing: true, IgnoreClientMissing: true}
)
View Source
var ComputeEnv = ComputeEnvVariables{
	CloudHelperType:   "SIMPLE_CONTAINER_CLOUD_HELPER_TYPE",
	DiscordWebhookUrl: "SIMPLE_CONTAINER_DISCORD_WEBHOOK_URL",
	SlackWebhookUrl:   "SIMPLE_CONTAINER_SLACK_WEBHOOK_URL",
	TelegramChatID:    "SIMPLE_CONTAINER_TELEGRAM_CHAT_ID",
	TelegramToken:     "SIMPLE_CONTAINER_TELEGRAM_TOKEN",
	AlertName:         "SIMPLE_CONTAINER_ALERT_NAME",
	AlertDescription:  "SIMPLE_CONTAINER_ALERT_DESCRIPTION",
	StackName:         "SIMPLE_CONTAINER_STACK",
	StackEnv:          "SIMPLE_CONTAINER_ENV",
	StackVersion:      "SIMPLE_CONTAINER_VERSION",
}

Functions

func AuthToString

func AuthToString[T any](sa *T) string

func ConfigFilePath

func ConfigFilePath(workDir string, profile string) string

func ConvertAuth

func ConvertAuth[T any](auth AuthConfig, creds *T) error

func ConvertDescriptor

func ConvertDescriptor[T any](from any, to *T) (*T, error)

func MarshalDescriptor

func MarshalDescriptor[T any](descriptor *T) ([]byte, error)

func ReadDescriptor

func ReadDescriptor[T any](filePath string, descriptor *T) (*T, error)

func RegisterCloudComposeConverter

func RegisterCloudComposeConverter(mapping CloudComposeConfigRegister)

func RegisterCloudHelper

func RegisterCloudHelper(mapping CloudHelpersRegisterMap)

func RegisterCloudSingleImageConverter

func RegisterCloudSingleImageConverter(mapping CloudSingleImageConfigRegister)

func RegisterCloudStaticSiteConverter

func RegisterCloudStaticSiteConverter(mapping CloudStaticSiteConfigRegister)

func RegisterProviderConfig

func RegisterProviderConfig(configMapping ConfigRegisterMap)

func RegisterProvisioner

func RegisterProvisioner(provisionerMapping ProvisionerRegisterMap)

func RegisterProvisionerFieldConfig

func RegisterProvisionerFieldConfig(mapping ProvisionerFieldConfigRegister)

func UnmarshalDescriptor

func UnmarshalDescriptor[T any](bytes []byte) (*T, error)

Types

type Alert

type Alert struct {
	Name        string    `json:"name" yaml:"name"`
	Title       string    `json:"title" yaml:"title"`
	Reason      string    `json:"reason" yaml:"reason"`
	Description string    `json:"description" yaml:"description"`
	StackName   string    `json:"stackName" yaml:"stackName"`
	StackEnv    string    `json:"stackEnv" yaml:"stackEnv"`
	DetailsUrl  string    `json:"detailsUrl" yaml:"detailsUrl"`
	AlertType   AlertType `json:"alertType" yaml:"alertType"`
}

type AlertSender

type AlertSender interface {
	Send(Alert) error
}

type AlertType

type AlertType string
const (
	// Monitoring Alert Types
	AlertTriggered AlertType = "TRIGGERED"
	AlertResolved  AlertType = "RESOLVED"

	// Build/Deployment Notification Types
	BuildStarted   AlertType = "BUILD_STARTED"
	BuildSucceeded AlertType = "BUILD_SUCCEEDED"
	BuildFailed    AlertType = "BUILD_FAILED"
	BuildCancelled AlertType = "BUILD_CANCELLED"
)

type AlertsConfig

type AlertsConfig struct {
	MaxCPU    *MaxCPUConfig    `json:"maxCPU,omitempty" yaml:"maxCPU,omitempty"`
	MaxMemory *MaxMemoryConfig `json:"maxMemory,omitempty" yaml:"maxMemory,omitempty"`
	MaxErrors *MaxErrorConfig  `json:"maxErrors,omitempty" yaml:"maxErrors,omitempty"`
	Discord   *DiscordCfg      `json:"discord,omitempty" yaml:"discord,omitempty"`
	Slack     *SlackCfg        `json:"slack,omitempty" yaml:"slack,omitempty"`
	Telegram  *TelegramCfg     `json:"telegram,omitempty" yaml:"telegram,omitempty"`
}

type AuthConfig

type AuthConfig interface {
	WithProviderType
	CredentialsValue() string
	ProjectIdValue() string
}

AuthConfig defines configuration for a single cloud provider

type AuthDescriptor

type AuthDescriptor struct {
	Type    string `json:"type" yaml:"type"`
	Config  `json:",inline" yaml:",inline"`
	Inherit `json:",inline" yaml:",inline"`
}

func DetectAuthProvider

func DetectAuthProvider(auth *AuthDescriptor) (*AuthDescriptor, error)

func (*AuthDescriptor) AuthConfig

func (a *AuthDescriptor) AuthConfig() (AuthConfig, error)

func (*AuthDescriptor) Copy

func (s *AuthDescriptor) Copy() AuthDescriptor

type CiCdDescriptor

type CiCdDescriptor struct {
	Type    string `json:"type" yaml:"type"`
	Config  `json:",inline" yaml:",inline"`
	Inherit `json:",inline" yaml:",inline"`
}

func (*CiCdDescriptor) Copy

func (s *CiCdDescriptor) Copy() CiCdDescriptor

type ClientDescriptor

type ClientDescriptor struct {
	SchemaVersion string                           `json:"schemaVersion" yaml:"schemaVersion"`
	Defaults      map[string]interface{}           `json:"defaults,omitempty" yaml:"defaults,omitempty"` // Maximum flexibility - supports any user-defined YAML anchors, templates, and configuration
	Stacks        map[string]StackClientDescriptor `json:"stacks" yaml:"stacks"`
}

ClientDescriptor describes the client schema

func ReadClientDescriptor

func ReadClientDescriptor(path string) (*ClientDescriptor, error)

func (*ClientDescriptor) Copy

func (*ClientDescriptor) GetDefaultValue

func (c *ClientDescriptor) GetDefaultValue(key string) (interface{}, bool)

GetDefaultValue retrieves a specific value from the defaults section Supports nested access using dot notation (e.g., "stack.type", "config.baseDnsZone")

func (*ClientDescriptor) GetDefaultsSection

func (c *ClientDescriptor) GetDefaultsSection() map[string]interface{}

GetDefaultsSection returns the defaults section as a map for flexible access This allows users to define any YAML anchors and templates they need

func (*ClientDescriptor) HasDefaults

func (c *ClientDescriptor) HasDefaults() bool

HasDefaults checks if the client configuration has a defaults section

func (*ClientDescriptor) SetDefaultValue

func (c *ClientDescriptor) SetDefaultValue(key string, value interface{})

SetDefaultValue sets a specific value in the defaults section

func (*ClientDescriptor) SetDefaultsSection

func (c *ClientDescriptor) SetDefaultsSection(defaults map[string]interface{})

SetDefaultsSection sets the entire defaults section (used for programmatic configuration)

type CloudComposeConfigRegister

type CloudComposeConfigRegister map[string]ToCloudComposeConvertFunc

type CloudComposeDescriptor

type CloudComposeDescriptor struct {
	StackName       string `json:"stackName" yaml:"stackName"`
	StackDescriptor `json:",inline" yaml:",inline"`
}

type CloudHelper

type CloudHelper interface {
	Run() error
	SetLogger(l logger.Logger)
}

func NewCloudHelper

func NewCloudHelper(chType string, opts ...CloudHelperOption) (CloudHelper, error)

type CloudHelperInitFunc

type CloudHelperInitFunc func(opts ...CloudHelperOption) (CloudHelper, error)

type CloudHelperOption

type CloudHelperOption func(c CloudHelper) error

func WithLogger

func WithLogger(l logger.Logger) CloudHelperOption

type CloudHelperType

type CloudHelperType string

type CloudHelpersRegisterMap

type CloudHelpersRegisterMap map[CloudHelperType]CloudHelperInitFunc

func GetRegisteredCloudHelpers

func GetRegisteredCloudHelpers() CloudHelpersRegisterMap

GetRegisteredCloudHelpers returns all registered cloud helper configurations Used by schema generator to automatically discover cloud helper types

type CloudSingleImageConfigRegister

type CloudSingleImageConfigRegister map[string]ToCloudSingleImageConvertFunc

type CloudStaticSiteConfigRegister

type CloudStaticSiteConfigRegister map[string]ToCloudStaticSiteConvertFunc

type CommonAlertConfig

type CommonAlertConfig struct {
	Threshold   float64 `json:"threshold" yaml:"threshold"`
	PeriodSec   int     `json:"periodSec" yaml:"periodSec"`
	AlertName   string  `json:"alertName" yaml:"alertName"`
	Description string  `json:"description" yaml:"description"`
}

type ComputeEnvVariables

type ComputeEnvVariables struct {
	DiscordWebhookUrl string
	SlackWebhookUrl   string
	TelegramChatID    string
	TelegramToken     string
	AlertName         string
	AlertDescription  string
	StackName         string
	StackEnv          string
	CloudHelperType   string
	StackVersion      string
}

type Config

type Config struct {
	Config any `json:"config" yaml:"config"`
}

func ConvertConfig

func ConvertConfig[T any](config *Config, to *T) (Config, error)

func ReadProvisionerFieldConfig

func ReadProvisionerFieldConfig(cType string, config *Config) (Config, error)

func (*Config) Copy

func (s *Config) Copy() Config

type ConfigFile

type ConfigFile struct {
	ProjectName        string `json:"projectName" yaml:"projectName"`
	PrivateKeyPath     string `yaml:"privateKeyPath,omitempty" json:"privateKeyPath,omitempty"`
	PublicKeyPath      string `yaml:"publicKeyPath,omitempty" json:"publicKeyPath,omitempty"`
	PrivateKey         string `yaml:"privateKey,omitempty" json:"privateKey,omitempty"`
	PrivateKeyPassword string `yaml:"privateKeyPassword,omitempty" json:"privateKeyPassword,omitempty"`
	PublicKey          string `yaml:"publicKey,omitempty" json:"publicKey,omitempty"`
	StacksDir          string `yaml:"stacksDir,omitempty" json:"stacksDir,omitempty"`
	ParentRepository   string `yaml:"parentRepository,omitempty" json:"parentRepository,omitempty"`
}

func ReadConfigFile

func ReadConfigFile(workDir, profile string) (*ConfigFile, error)

func (*ConfigFile) ToYaml

func (f *ConfigFile) ToYaml() ([]byte, error)

func (*ConfigFile) WriteConfigFile

func (f *ConfigFile) WriteConfigFile(workDir, profile string) error

type ConfigReaderFunc

type ConfigReaderFunc func(config *Config) (Config, error)

type ConfigRegisterMap

type ConfigRegisterMap map[string]ConfigReaderFunc

func GetRegisteredProviderConfigs

func GetRegisteredProviderConfigs() ConfigRegisterMap

GetRegisteredProviderConfigs returns all registered provider configurations Used by schema generator to automatically discover all resource types

type Container

type Container struct {
	ContainerImage `json:",inline" yaml:",inline"`
	Name           string `json:"name" yaml:"name"`
}

type ContainerImage

type ContainerImage struct {
	Name       string `json:"name" yaml:"name"`
	Dockerfile string `json:"dockerfile" yaml:"dockerfile"`
	Context    string `json:"context" yaml:"context"`

	Build    *ContainerImageBuild `json:"build" yaml:"build"`
	Platform ImagePlatform        `json:"platform" yaml:"platform"`
}

type ContainerImageBuild

type ContainerImageBuild struct {
	Args map[string]string `json:"args" yaml:"args"`
}

type CorsConfig

type CorsConfig struct {
	AllowedOrigins string   `json:"allowedOrigins" yaml:"allowedOrigins"`
	AllowedMethods []string `json:"allowedMethods,omitempty" yaml:"allowedMethods"`
}

type Credentials

type Credentials struct {
	Credentials string `json:"credentials" yaml:"credentials"` // required for proper deserialization
}

type DeployParams

type DeployParams struct {
	StackParams `json:",inline" yaml:",inline"`
	Vars        VariableValues `json:"vars" yaml:"vars"`
}

type DestroyParams

type DestroyParams struct {
	StackParams         `json:",inline" yaml:",inline"`
	DestroySecretsStack bool `json:"destroySecretsStack" yaml:"destroySecretsStack"`
}

type DestroyResult

type DestroyResult struct {
	Operations map[string]int `json:"operations" yaml:"operations"`
}

func (*DestroyResult) String

func (r *DestroyResult) String() string

type DiscordCfg

type DiscordCfg struct {
	WebhookUrl string `json:"webhookUrl" yaml:"webhookUrl"`
}

type DnsConfigAware

type DnsConfigAware interface {
	OverriddenBaseZone() string
}

type DnsRecord

type DnsRecord struct {
	Name     string           `json:"name" yaml:"name"`
	Type     string           `json:"type" yaml:"type"`
	ValueOut sdk.StringOutput `json:"valueOut" yaml:"valueOut"`
	Value    string           `json:"value" yaml:"value"`
	Proxied  bool             `json:"proxied" yaml:"proxied"`
}

type Headers

type Headers map[string]string

type ImagePlatform

type ImagePlatform string
const (
	ImagePlatformLinuxAmd64 ImagePlatform = "linux/amd64"
)

type Inherit

type Inherit struct {
	Inherit string `json:"inherit" yaml:"inherit"`
}

func (Inherit) IsInherited

func (i Inherit) IsInherited() bool

type InitParams

type InitParams struct {
	ProjectName         string `json:"projectName" yaml:"projectName"`
	RootDir             string `json:"rootDir,omitempty" yaml:"rootDir"`
	Profile             string `json:"profile,omitempty" yaml:"profile"`
	SkipInitialCommit   bool   `json:"skipInitialCommit" yaml:"skipInitialCommit"`
	SkipProfileCreation bool   `json:"skipProfileCreation" yaml:"skipProfileCreation"`
	SkipScDirCreation   bool   `json:"skipScDirCreation" yaml:"skipScDirCreation"`
	IgnoreWorkdirErrors bool   `json:"skipCreateConfigDir" yaml:"skipCreateConfigDir"`
	GenerateKeyPair     bool   `json:"generateKeyPair" yaml:"generateKeyPair"`
}

type MaxCPUConfig

type MaxCPUConfig struct {
	CommonAlertConfig `json:",inline" yaml:",inline"`
}

type MaxErrorConfig

type MaxErrorConfig struct {
	CommonAlertConfig     `json:",inline" yaml:",inline"`
	ErrorLogMessageRegexp string `json:"errorLogMessageRegexp" yaml:"errorLogMessageRegexp"`
}

type MaxMemoryConfig

type MaxMemoryConfig struct {
	CommonAlertConfig `json:",inline" yaml:",inline"`
}

type OutputsResult

type OutputsResult struct {
	StackName string         `json:"stackName" yaml:"stackName"`
	Outputs   map[string]any `json:"outputs" yaml:"outputs"`
}

type ParentResourceDependency

type ParentResourceDependency struct {
	Name string `json:"name" yaml:"name"`
}

ParentResourceDependency when a resource depends on resource within the same stack

type PerEnvResourcesDescriptor

type PerEnvResourcesDescriptor struct {
	Template  string                        `json:"template" yaml:"template"`
	Resources map[string]ResourceDescriptor `json:"resources" yaml:"resources"`
	Inherit   `json:",inline" yaml:",inline"`
}

func (*PerEnvResourcesDescriptor) Copy

type PerStackResourcesDescriptor

type PerStackResourcesDescriptor struct {
	Registrar RegistrarDescriptor                  `json:"registrar" yaml:"registrar"`
	Resources map[string]PerEnvResourcesDescriptor `json:"resources" yaml:"resources"`
}

func (*PerStackResourcesDescriptor) Copy

type PreviewResult

type PreviewResult struct {
	StackName  string         `json:"stackName" yaml:"stackName"`
	Summary    string         `json:"summary" yaml:"summary"`
	Operations map[string]int `json:"operations" yaml:"operations"`
}

func (*PreviewResult) String

func (r *PreviewResult) String() string

type ProvisionParams

type ProvisionParams struct {
	StacksDir   string   `json:"rootDir" yaml:"rootDir"`
	Profile     string   `json:"profile" yaml:"profile"`
	Stacks      []string `json:"stacks" yaml:"stacks"`
	SkipRefresh bool     `json:"skipRefresh" yaml:"skipRefresh"`
	SkipPreview bool     `json:"skipPreview" yaml:"skipPreview"`
	Timeouts    Timeouts `json:",inline" yaml:",inline"`
}

type Provisioner

type Provisioner interface {
	ProvisionStack(ctx context.Context, cfg *ConfigFile, stack Stack, params ProvisionParams) error

	SetPublicKey(pubKey string)

	DeployStack(ctx context.Context, cfg *ConfigFile, stack Stack, params DeployParams) error

	DestroyChildStack(ctx context.Context, cfg *ConfigFile, stack Stack, params DestroyParams, preview bool) error

	PreviewStack(ctx context.Context, cfg *ConfigFile, parentStack Stack, params ProvisionParams) (*PreviewResult, error)

	PreviewChildStack(ctx context.Context, cfg *ConfigFile, parentStack Stack, params DeployParams) (*PreviewResult, error)

	OutputsStack(ctx context.Context, cfg *ConfigFile, stack Stack, params StackParams) (*OutputsResult, error)

	CancelStack(ctx context.Context, cfg *ConfigFile, stack Stack, params StackParams) error

	DestroyParentStack(ctx context.Context, cfg *ConfigFile, parentStack Stack, params DestroyParams, preview bool) error

	SetConfigReader(ProvisionerFieldConfigReaderFunc)
}

type ProvisionerDescriptor

type ProvisionerDescriptor struct {
	Type    string `json:"type" yaml:"type"`
	Config  `json:",inline" yaml:",inline"`
	Inherit `json:",inline" yaml:",inline"`
	// contains filtered or unexported fields
}

ProvisionerDescriptor describes the provisioner schema

func (*ProvisionerDescriptor) Copy

func (*ProvisionerDescriptor) GetProvisioner

func (s *ProvisionerDescriptor) GetProvisioner() Provisioner

func (*ProvisionerDescriptor) SetProvisioner

func (s *ProvisionerDescriptor) SetProvisioner(p Provisioner)

func (*ProvisionerDescriptor) ValuesOnly

ValuesOnly returns copy of descriptor without provisioner reference

type ProvisionerFieldConfigReadFunc

type ProvisionerFieldConfigReadFunc func(config *Config) (Config, error)

type ProvisionerFieldConfigReaderFunc

type ProvisionerFieldConfigReaderFunc func(cType string, c *Config) (Config, error)

type ProvisionerFieldConfigRegister

type ProvisionerFieldConfigRegister map[string]ProvisionerFieldConfigReadFunc

func GetRegisteredProvisionerFieldConfigs

func GetRegisteredProvisionerFieldConfigs() ProvisionerFieldConfigRegister

GetRegisteredProvisionerFieldConfigs returns all registered provisioner field configurations Used by schema generator to automatically discover provisioner resource types

type ProvisionerInitFunc

type ProvisionerInitFunc func(config Config, opts ...ProvisionerOption) (Provisioner, error)

type ProvisionerOption

type ProvisionerOption func(p Provisioner) error

type ProvisionerRegisterMap

type ProvisionerRegisterMap map[string]ProvisionerInitFunc

type ReadOpts

type ReadOpts struct {
	IgnoreServerMissing  bool
	IgnoreClientMissing  bool
	IgnoreSecretsMissing bool
	RequireClientConfigs []string
	RequireServerConfigs []string
	RequireSecretConfigs []string
}

type RefreshResult

type RefreshResult struct {
	Operations map[string]int `json:"operations" yaml:"operations"`
}

func (*RefreshResult) String

func (r *RefreshResult) String() string

type RegistrarConfig

type RegistrarConfig interface {
	ProviderType() string
	DnsRecords() []DnsRecord
}

type RegistrarDescriptor

type RegistrarDescriptor struct {
	Type    string `json:"type" yaml:"type"`
	Config  `json:",inline" yaml:",inline"`
	Inherit `json:",inline" yaml:",inline"`
}

func (*RegistrarDescriptor) Copy

type RemoteImage

type RemoteImage struct {
	Name string `json:"name" yaml:"name"`
	Tag  string `json:"tag" yaml:"tag"`
}

type ResourceAware

type ResourceAware interface {
	Uses() []string
}

type ResourceDescriptor

type ResourceDescriptor struct {
	Type    string `json:"type" yaml:"type"`
	Name    string `json:"name" yaml:"name"`
	Config  `json:",inline" yaml:",inline"`
	Inherit `json:",inline" yaml:",inline"`
}

func (*ResourceDescriptor) Copy

type ResourceInput

type ResourceInput struct {
	Descriptor  *ResourceDescriptor `json:"descriptor" yaml:"descriptor"`
	StackParams *StackParams        `json:"deployParams" yaml:"deployParams"`
}

func (*ResourceInput) ToResName

func (r *ResourceInput) ToResName(resName string) string

ToResName adds environment suffix if environment is specified in the resource input

type ResourceOutput

type ResourceOutput struct {
	Ref any `json:"ref" yaml:"ref"`
}

type SecretsConfigDescriptor

type SecretsConfigDescriptor struct {
	Type    string `json:"type" yaml:"type"`
	Config  `json:",inline" yaml:",inline"`
	Inherit `json:",inline" yaml:",inline"`
}

func (*SecretsConfigDescriptor) Copy

type SecretsDescriptor

type SecretsDescriptor struct {
	SchemaVersion string                    `json:"schemaVersion" yaml:"schemaVersion"`
	Auth          map[string]AuthDescriptor `json:"auth" yaml:"auth"`
	Values        map[string]string         `json:"values" yaml:"values"`
}

SecretsDescriptor describes the secrets schema

func DetectAuthType

func DetectAuthType(descriptor *SecretsDescriptor) (*SecretsDescriptor, error)

func ReadSecretsConfigs

func ReadSecretsConfigs(descriptor *SecretsDescriptor) (*SecretsDescriptor, error)

func ReadSecretsDescriptor

func ReadSecretsDescriptor(path string) (*SecretsDescriptor, error)

func (*SecretsDescriptor) Copy

type SecretsProviderConfig

type SecretsProviderConfig interface {
	AuthConfig
	IsProvisionEnabled() bool
	KeyUrl() string
}

type ServerDescriptor

type ServerDescriptor struct {
	SchemaVersion string                        `json:"schemaVersion" yaml:"schemaVersion"`
	Provisioner   ProvisionerDescriptor         `json:"provisioner" yaml:"provisioner"`
	Secrets       SecretsConfigDescriptor       `json:"secrets" yaml:"secrets"`
	CiCd          CiCdDescriptor                `json:"cicd" yaml:"cicd"`
	Templates     map[string]StackDescriptor    `json:"templates" yaml:"templates"`
	Resources     PerStackResourcesDescriptor   `json:"resources" yaml:"resources"`
	Variables     map[string]VariableDescriptor `json:"variables" yaml:"variables"`
}

ServerDescriptor describes the server schema

func DetectCiCdType

func DetectCiCdType(descriptor *ServerDescriptor) (*ServerDescriptor, error)

func DetectProvisionerType

func DetectProvisionerType(descriptor *ServerDescriptor) (*ServerDescriptor, error)

func DetectResourcesType

func DetectResourcesType(descriptor *ServerDescriptor) (*ServerDescriptor, error)

func DetectSecretsType

func DetectSecretsType(descriptor *ServerDescriptor) (*ServerDescriptor, error)

func DetectTemplatesType

func DetectTemplatesType(descriptor *ServerDescriptor) (*ServerDescriptor, error)

func ReadServerConfigs

func ReadServerConfigs(descriptor *ServerDescriptor) (*ServerDescriptor, error)

func ReadServerDescriptor

func ReadServerDescriptor(path string) (*ServerDescriptor, error)

func (*ServerDescriptor) Copy

func (*ServerDescriptor) ValuesOnly

func (sd *ServerDescriptor) ValuesOnly() *ServerDescriptor

ValuesOnly returns copy of descriptor without additional state (e.g. provisioner reference etc.)

type SimpleContainerLBConfig

type SimpleContainerLBConfig struct {
	Https        bool     `json:"https" yaml:"https"`
	ExtraHelpers []string `json:"extraHelpers" yaml:"extraHelpers"`
}

type SlackCfg

type SlackCfg struct {
	WebhookUrl string `json:"webhookUrl" yaml:"webhookUrl"`
}

type Stack

type Stack struct {
	Name    string            `json:"name" yaml:"name"`
	Secrets SecretsDescriptor `json:"secrets" yaml:"secrets"`
	Server  ServerDescriptor  `json:"server" yaml:"server"`
	Client  ClientDescriptor  `json:"client" yaml:"client"`
}

func (*Stack) ChildStack

func (s *Stack) ChildStack(name string) Stack

func (*Stack) ValuesOnly

func (s *Stack) ValuesOnly() Stack

type StackClientDescriptor

type StackClientDescriptor struct {
	Type        string `json:"type" yaml:"type"`
	ParentStack string `json:"parent" yaml:"parent"`
	ParentEnv   string `json:"parentEnv" yaml:"parentEnv"`
	Template    string `json:"template" yaml:"template"`
	Config      Config `json:",inline" yaml:",inline"`
}

func ConvertClientConfig

func ConvertClientConfig(clientDesc StackClientDescriptor) (*StackClientDescriptor, error)

func (*StackClientDescriptor) Copy

type StackConfigCompose

type StackConfigCompose struct {
	DockerComposeFile string                          `json:"dockerComposeFile" yaml:"dockerComposeFile"`
	Domain            string                          `json:"domain" yaml:"domain"`
	Prefix            string                          `json:"prefix" yaml:"prefix"`                   // prefix for service under LB (e.g. /<service>) default: empty
	ProxyKeepPrefix   bool                            `json:"proxyKeepPrefix" yaml:"proxyKeepPrefix"` // if prefix is specified, whether we need to keep it when proxying to service
	DomainProxied     *bool                           `json:"domainProxied" yaml:"domainProxied"`
	BaseDnsZone       string                          `json:"baseDnsZone" yaml:"baseDnsZone"` // only necessary if differs from parent stack
	Uses              []string                        `json:"uses" yaml:"uses"`
	Runs              []string                        `json:"runs" yaml:"runs"`
	Env               map[string]string               `json:"env" yaml:"env"`
	Secrets           map[string]string               `json:"secrets" yaml:"secrets"`
	Version           string                          `json:"version" yaml:"version"` // only when need to forcefully redeploy (e.g. aws secrets)
	Size              *StackConfigComposeSize         `json:"size,omitempty" yaml:"size,omitempty"`
	Scale             *StackConfigComposeScale        `json:"scale,omitempty" yaml:"scale,omitempty"`
	Dependencies      []StackConfigDependencyResource `json:"dependencies,omitempty" yaml:"dependencies,omitempty"` // when service wants to use resources from another service
	Alerts            *AlertsConfig                   `json:"alerts,omitempty" yaml:"alerts,omitempty"`
	TextVolumes       *[]TextVolume                   `json:"textVolumes" yaml:"textVolumes"`           // extra text volumes to mount to containers (e.g. for k8s deployments)
	Headers           *Headers                        `json:"headers" yaml:"headers"`                   // extra headers to add when serving requests
	LBConfig          *SimpleContainerLBConfig        `json:"lbConfig" yaml:"lbConfig"`                 // load balancer configuration (so far only applicable for k8s deployments)
	CloudExtras       *any                            `json:"cloudExtras" yaml:"cloudExtras"`           // when need to specify additional extra config for the specific cloud (e.g. AWS extra roles)
	StaticEgressIP    *bool                           `json:"staticEgressIP" yaml:"staticEgressIP"`     // when need to provision NAT with fixed egress IP address (e.g. AWS Lambda with static IP)
	ImagePullPolicy   *string                         `json:"imagePullPolicy" yaml:"imagePullPolicy"`   // applicable only for certain compute types, e.g. Kubernetes
	ClusterIPAddress  *string                         `json:"clusterIPAddress" yaml:"clusterIPAddress"` // applicable only for certain compute types, e.g. Kubernetes
}

func (*StackConfigCompose) Copy

func (s *StackConfigCompose) Copy() any

type StackConfigComposeScale

type StackConfigComposeScale struct {
	Min int `yaml:"min" json:"min"`
	Max int `yaml:"max" json:"max"`

	Policy *StackConfigComposeScalePolicy `json:"policy" yaml:"policy"`
}

type StackConfigComposeScaleCpu

type StackConfigComposeScaleCpu struct {
	Max int `yaml:"max" json:"max"`
}

type StackConfigComposeScaleMemory

type StackConfigComposeScaleMemory struct {
	Max int `yaml:"max" json:"max"`
}

type StackConfigComposeScalePolicy

type StackConfigComposeScalePolicy struct {
	Cpu    *StackConfigComposeScaleCpu    `yaml:"cpu" json:"cpu"`
	Memory *StackConfigComposeScaleMemory `yaml:"memory" json:"memory"`
}

type StackConfigComposeSize

type StackConfigComposeSize struct {
	Name      string `yaml:"name" json:"name"`
	Cpu       string `yaml:"cpu" json:"cpu"`
	Memory    string `yaml:"memory" json:"memory"`
	Ephemeral string `yaml:"ephemeral" json:"ephemeral"`
}

type StackConfigDependencyResource

type StackConfigDependencyResource struct {
	Name     string  `json:"name" yaml:"name"`
	Owner    string  `json:"owner" yaml:"owner"`
	Resource string  `json:"resource" yaml:"resource"`
	Env      *string `json:"env" yaml:"env"`
}

StackConfigDependencyResource when stack depends on resource context of another stack (client configuration)

type StackConfigSingleImage

type StackConfigSingleImage struct {
	Image               *ContainerImage   `json:"image" yaml:"image"`
	Domain              string            `json:"domain" yaml:"domain"`
	BaseDnsZone         string            `json:"baseDnsZone" yaml:"baseDnsZone"` // only necessary if differs from parent stack
	Env                 map[string]string `json:"env" yaml:"env"`
	Secrets             map[string]string `json:"secrets" yaml:"secrets"`
	Min                 int               `yaml:"min" json:"min"`
	Max                 int               `yaml:"max" json:"max"`
	Version             string            `json:"version" yaml:"version"` // only when need to forcefully redeploy (e.g. aws secrets)
	Timeout             *int              `json:"timeout" yaml:"timeout"`
	BasePath            string            `json:"basePath" yaml:"basePath"`                       // base path where API will listen on (e.g. for aws apigateway -> lambda integration)
	MaxMemory           *int              `json:"maxMemory" yaml:"maxMemory"`                     // max memory to use for container
	MaxEphemeralStorage *int              `json:"maxEphemeralStorage" yaml:"maxEphemeralStorage"` // max ephemeral storage in MB
	Uses                []string          `json:"uses" yaml:"uses"`
	StaticEgressIP      *bool             `json:"staticEgressIP" yaml:"staticEgressIP"` // when need to provision NAT with fixed egress IP address (e.g. AWS Lambda with static IP)
	CloudExtras         *any              `json:"cloudExtras" yaml:"cloudExtras"`       // when need to specify additional extra config for the specific cloud (e.g. AWS extra roles)
}

type StackConfigStatic

type StackConfigStatic struct {
	BundleDir  string           `json:"bundleDir" yaml:"bundleDir"`
	Site       StaticSiteConfig `json:",inline" yaml:",inline"`
	BucketName string           `json:"bucketName" yaml:"bucketName"` // if necessary to override bucket name, only applicable in some clouds (e.g. gcp)
	Location   string           `json:"location" yaml:"location"`
}

type StackDescriptor

type StackDescriptor struct {
	Type        string `json:"type" yaml:"type"`
	ParentStack string `json:"parentStack" yaml:"parentStack"`
	Config      `json:",inline" yaml:",inline"`
	Inherit     `json:",inline" yaml:",inline"`
}

func DetectTemplateType

func DetectTemplateType(tpl StackDescriptor) (*StackDescriptor, error)

func PrepareClientConfigForDeploy

func PrepareClientConfigForDeploy(ctx context.Context, stackDir, stackName string, tpl StackDescriptor, clientDesc StackClientDescriptor) (*StackDescriptor, error)

func PrepareCloudComposeForDeploy

func PrepareCloudComposeForDeploy(ctx context.Context, stackDir, stackName string, tpl StackDescriptor, clientConfig *StackConfigCompose, parentStack string) (*StackDescriptor, error)

func PrepareCloudSingleImageForDeploy

func PrepareCloudSingleImageForDeploy(ctx context.Context, stackDir, stackName string, tpl StackDescriptor, clientConfig *StackConfigSingleImage, parentStack string) (*StackDescriptor, error)

func PrepareStaticForDeploy

func PrepareStaticForDeploy(ctx context.Context, stackDir, stackName string, tpl StackDescriptor, clientConfig *StackConfigStatic, parentStack string) (*StackDescriptor, error)

func (*StackDescriptor) Copy

func (s *StackDescriptor) Copy() StackDescriptor

type StackParams

type StackParams struct {
	StacksDir   string   `json:"stacksDir" yaml:"stacksDir"`
	StackDir    string   `json:"stackDir" yaml:"stackDir"`
	Profile     string   `json:"profile" yaml:"profile"`
	StackName   string   `json:"stack" yaml:"stack"`
	Environment string   `json:"environment" yaml:"environment"`
	ParentEnv   string   `json:"parentEnv" yaml:"parentEnv"`
	SkipRefresh bool     `json:"skipRefresh" yaml:"skipRefresh"`
	SkipPreview bool     `json:"skipPreview" yaml:"skipPreview"`
	Version     string   `json:"version" yaml:"version"`
	Timeouts    Timeouts `json:",inline" yaml:",inline"`
	Parent      bool     `json:"parent" yaml:"parent"`
}

func (*StackParams) CopyForParentEnv

func (p *StackParams) CopyForParentEnv(env string) *StackParams

func (*StackParams) ToProvisionParams

func (p *StackParams) ToProvisionParams() ProvisionParams

type StacksMap

type StacksMap map[string]Stack

func (*StacksMap) ReconcileForDeploy

func (m *StacksMap) ReconcileForDeploy(params StackParams) (*StacksMap, error)

func (*StacksMap) ResolveInheritance

func (m *StacksMap) ResolveInheritance() *StacksMap

type StateStorageConfig

type StateStorageConfig interface {
	AuthConfig
	StorageUrl() string
	IsProvisionEnabled() bool
}

type StaticSiteConfig

type StaticSiteConfig struct {
	Domain             string      `json:"domain" yaml:"domain"`
	BaseDnsZone        string      `json:"baseDnsZone" yaml:"baseDnsZone"` // only necessary if differs from parent stack
	IndexDocument      string      `json:"indexDocument" yaml:"indexDocument"`
	ErrorDocument      string      `json:"errorDocument" yaml:"errorDocument"`
	ProvisionWwwDomain bool        `json:"provisionWwwDomain" yaml:"provisionWwwDomain"`
	CorsConfig         *CorsConfig `json:"corsConfig,omitempty" yaml:"corsConfig,omitempty"`
}

type TelegramCfg

type TelegramCfg struct {
	ChatID string `json:"chatID" yaml:"chatID"`
	Token  string `json:"token" yaml:"token"`
}

type TextVolume

type TextVolume struct {
	Content   string `json:"content" yaml:"content"`
	Name      string `json:"name" yaml:"name"`
	MountPath string `json:"mountPath" yaml:"mountPath"`
}

type Timeouts

type Timeouts struct {
	ExecutionTimeout string `json:"executionTimeout" yaml:"executionTimeout"`
	PreviewTimeout   string `json:"previewTimeout" yaml:"previewTimeout"`
	DeployTimeout    string `json:"deployTimeout" yaml:"deployTimeout"`
}

type ToCloudComposeConvertFunc

type ToCloudComposeConvertFunc func(tpl any, composeCfg compose.Config, stackCfg *StackConfigCompose) (any, error)

type ToCloudSingleImageConvertFunc

type ToCloudSingleImageConvertFunc func(tpl any, stackCfg *StackConfigSingleImage) (any, error)

type ToCloudStaticSiteConvertFunc

type ToCloudStaticSiteConvertFunc func(tpl any, rootDir, stackName string, stackCfg *StackConfigStatic) (any, error)

type UpdateResult

type UpdateResult struct {
	StackName  string         `json:"stackName" yaml:"stackName"`
	Summary    string         `json:"summary" yaml:"summary"`
	Operations map[string]int `json:"operations" yaml:"operations"`
}

func (*UpdateResult) String

func (r *UpdateResult) String() string

type VariableDescriptor

type VariableDescriptor struct {
	Type  string `json:"type" yaml:"type"`
	Value string `json:"value" yaml:"value"`
}

func (*VariableDescriptor) Copy

type VariableValues

type VariableValues map[string]any

type WithCopy

type WithCopy[T any] interface {
	Copy() T
}

type WithDependencyProviders

type WithDependencyProviders interface {
	DependencyProviders() map[string]AuthDescriptor
}

WithDependencyProviders defines configurations where extra cloud providers are required

type WithDependsOnResources

type WithDependsOnResources interface {
	DependsOnResources() []StackConfigDependencyResource
}

type WithParentDependencies

type WithParentDependencies interface {
	DependsOnResources() []ParentResourceDependency
}

type WithProviderType

type WithProviderType interface {
	ProviderType() string
}

WithProviderType defines configuration with specific cloud provider type

Directories

Path Synopsis
git

Jump to

Keyboard shortcuts

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