system

package
v1.3.1-0...-3e602c1 Latest Latest
Warning

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

Go to latest
Published: May 27, 2023 License: GPL-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Context = ContextStruct{}
View Source
var ContextActionProjectDeploy = "project.deploy"
View Source
var ContextActionProjectDestroy = "project.destroy"
View Source
var ContextActionServerSetup = "server.setup"

Functions

func ApplyResourceOperation

func ApplyResourceOperation(resource Resource) (bool, error)

func ContextAddDnsModule

func ContextAddDnsModule(module Module)

func ContextAddPluginModule

func ContextAddPluginModule(module Module)

func ContextSetContainerModule

func ContextSetContainerModule(module Module)

func ContextSetProxyModule

func ContextSetProxyModule(module Module)

func GenerateSSHKeyPair

func GenerateSSHKeyPair() (*rsa.PrivateKey, error)

func GetModuleSettings

func GetModuleSettings(moduleName string) interface{}

func InitializeContext

func InitializeContext(host string, action string, projectDefinition *project.Project)

InitializeContext will set the context object for the current host, action and project

host = IP address string
action = any of ContextAction* constants
projectDefinition = project definition object

func InstallPackage

func InstallPackage(packages []Package) error

func RemoteRun

func RemoteRun(cmd string, opts RemoteRunOpts) (bytes.Buffer, bytes.Buffer, error)

func RenderModuleTemplate

func RenderModuleTemplate(templateFolder embed.FS, fileName string, additionalData map[string]any, additionalFuncs template.FuncMap) (string, error)

func RenderModuleTemplateText

func RenderModuleTemplateText(templateName string, fileContents string, additionalData map[string]any, additionalFuncs template.FuncMap) (string, error)

func ResolveRemoteGroupIntoGid

func ResolveRemoteGroupIntoGid(groupname string) (int, error)

func ResolveRemoteUserIntoUid

func ResolveRemoteUserIntoUid(username string) (int, error)

func RollbackResourceOperation

func RollbackResourceOperation(resource Resource) (bool, error)

func SimpleRemoteRun

func SimpleRemoteRun(cmd string, opts RemoteRunOpts) (string, error)

func UnpackModuleSettings

func UnpackModuleSettings[T interface{}](_modulesSettings interface{}) (*T, error)

func UpdatePackageList

func UpdatePackageList(vendors ...PackageVendor) error

func ValidateVersion

func ValidateVersion() (bool, string, error)

func WriteVersion

func WriteVersion() error

Types

type ApplyResourceFuncType

type ApplyResourceFuncType func() error

type ContextAuthenticationStruct

type ContextAuthenticationStruct struct {
	LocalAuthenticationDir string
}

func (ContextAuthenticationStruct) GetPrivateKeyPath

func (c ContextAuthenticationStruct) GetPrivateKeyPath() string

func (ContextAuthenticationStruct) GetPublicKeyPath

func (c ContextAuthenticationStruct) GetPublicKeyPath() string

type ContextStruct

type ContextStruct struct {
	TargetHost     net.IP
	CurrentAction  string
	Project        *project.Project
	IsCI           bool
	Authentication ContextAuthenticationStruct
	Resources      []ResourceGroup

	ProxyModule     Module
	ContainerModule Module
	DNSModules      []Module
	PluginModules   []Module
}

func (ContextStruct) GetModulesInOrder

func (c ContextStruct) GetModulesInOrder() []Module

type DebugLogger

type DebugLogger struct {
}

func (DebugLogger) Debug

func (DebugLogger) Debug(obj interface{})

func (DebugLogger) Error

func (DebugLogger) Error(obj interface{})

type DeployedProject

type DeployedProject struct {
	Path    string
	Project project.Project
}

func GetDeployedProjects

func GetDeployedProjects() ([]DeployedProject, error)

type Module

type Module interface {
	Install(moduleSettings interface{}) error
	Deploy(moduleSettings interface{}) error
	Destroy(moduleSettings interface{}) error
	Init(moduleSettings interface{})
	GetConfig() ModuleConfig
	GetTemplates() *embed.FS
}

type ModuleConfig

type ModuleConfig struct {
	Name string
	Type string
}

type ModuleTemplateData

type ModuleTemplateData struct {
	Project *project.Project
}

type Operation

type Operation string
const (
	OperationCreate Operation = "create"
)

type Package

type Package struct {
	Name   string
	Vendor PackageVendor
}

type PackageVendor

type PackageVendor string
var PackageVendorApk PackageVendor = "apk"
var PackageVendorApt PackageVendor = "apt"

type PluginModule

type PluginModule interface {
	Init(moduleSettings interface{})
	GetConfig() ModuleConfig
	GetTemplates() *embed.FS
}

type RemoteRunOpts

type RemoteRunOpts struct {
	Args         []string
	WorkingDir   string
	Confidential bool
	Sudo         bool
	AllowFail    bool
	User         string
}

type Resource

type Resource struct {
	Type      Type
	Operation Operation

	// name of the resource (e.g. file name, container name)
	Name string

	// contents of resource, if any
	Content string

	// name of the associated service
	ServiceName string

	// for container resources
	Ports     []string
	ImageName string
}

func (Resource) GetOperationLabel

func (r Resource) GetOperationLabel(invertOperation bool) string

func (Resource) ToString

func (r Resource) ToString(invertOperation bool) string

type ResourceGroup

type ResourceGroup struct {
	Name      string
	Resources []Resource

	ApplyResourceFunc    ApplyResourceFuncType
	RollbackResourceFunc RollbackResourceFuncType
}

type RollbackResourceFuncType

type RollbackResourceFuncType func() error

type Type

type Type string
const (
	TypeFile      Type = "file"
	TypeContainer Type = "container"
)

Jump to

Keyboard shortcuts

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