provisioner

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ShouldSetupNFS added in v0.1.2

func ShouldSetupNFS(cfg *config.Config, serverCount int) (bool, string)

ShouldSetupNFS determines if NFS should be set up based on configuration and server count

func ValidateIPAddress added in v0.1.2

func ValidateIPAddress(ip string) error

ValidateIPAddress checks if a string is a valid IP address

func ValidateNFSExportPath added in v0.1.2

func ValidateNFSExportPath(path string) error

ValidateNFSExportPath checks if a path is safe to use as an NFS export

Types

type ApkManager

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

ApkManager manages packages using apk

func (*ApkManager) Install

func (ap *ApkManager) Install(packages ...string) error

func (*ApkManager) Remove

func (ap *ApkManager) Remove(packages ...string) error

func (*ApkManager) Search

func (ap *ApkManager) Search(packageName string) (bool, error)

func (*ApkManager) Update

func (ap *ApkManager) Update() error

type AptManager

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

AptManager manages packages using apt/apt-get

func (*AptManager) Install

func (a *AptManager) Install(packages ...string) error

func (*AptManager) Remove

func (a *AptManager) Remove(packages ...string) error

func (*AptManager) Search

func (a *AptManager) Search(packageName string) (bool, error)

func (*AptManager) Update

func (a *AptManager) Update() error

type DnfManager

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

DnfManager manages packages using dnf

func (*DnfManager) Install

func (d *DnfManager) Install(packages ...string) error

func (*DnfManager) Remove

func (d *DnfManager) Remove(packages ...string) error

func (*DnfManager) Search

func (d *DnfManager) Search(packageName string) (bool, error)

func (*DnfManager) Update

func (d *DnfManager) Update() error

type NFSExportInfo added in v0.1.2

type NFSExportInfo struct {
	Name       string
	Path       string
	MountPoint string // Client mount point
}

NFSExportInfo contains information about a single NFS export

type NFSMountStatus added in v0.1.2

type NFSMountStatus struct {
	Source     string
	MountPoint string
	Mounted    bool
	Error      string
}

NFSMountStatus represents the status of a single NFS mount

type NFSProvisioner added in v0.1.2

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

NFSProvisioner handles NFS server and client provisioning

func NewNFSProvisioner added in v0.1.2

func NewNFSProvisioner(projectName, environment string, verbose bool) *NFSProvisioner

NewNFSProvisioner creates a new NFS provisioner

func (*NFSProvisioner) CleanupNFSClient added in v0.1.2

func (n *NFSProvisioner) CleanupNFSClient(client *ssh.Client, exports []NFSExportInfo) error

CleanupNFSClient removes NFS client mounts and configuration

func (*NFSProvisioner) CleanupNFSServer added in v0.1.2

func (n *NFSProvisioner) CleanupNFSServer(client *ssh.Client, exports []NFSExportInfo) error

CleanupNFSServer removes NFS server configuration and exports

func (*NFSProvisioner) CreateDockerVolume added in v0.1.2

func (n *NFSProvisioner) CreateDockerVolume(client *ssh.Client, exportName string, volumeName string) error

CreateDockerVolume creates a Docker volume backed by an NFS mount

func (*NFSProvisioner) DetectExistingNFS added in v0.1.2

func (n *NFSProvisioner) DetectExistingNFS(client *ssh.Client) (*NFSStatus, error)

DetectExistingNFS checks if NFS is already set up for this project

func (*NFSProvisioner) GetNFSMountPoint added in v0.1.2

func (n *NFSProvisioner) GetNFSMountPoint(exportName string) string

GetNFSMountPoint returns the mount point path for an NFS export

func (*NFSProvisioner) GetNFSStatus added in v0.1.2

func (n *NFSProvisioner) GetNFSStatus(client *ssh.Client, isServer bool) (*NFSStatus, error)

GetNFSStatus checks the status of NFS on a server/client

func (*NFSProvisioner) MigrateNFSServer added in v0.1.2

func (n *NFSProvisioner) MigrateNFSServer(
	oldServerClient *ssh.Client,
	newServerClient *ssh.Client,
	exports []NFSExportInfo,
	allowedIPs []string,
	nfsConfig *config.NFSConfig,
) error

MigrateNFSServer handles migration when NFS server changes This cleans up the old server and sets up on the new one

func (*NFSProvisioner) RemountNFS added in v0.1.2

func (n *NFSProvisioner) RemountNFS(client *ssh.Client, exports []NFSExportInfo) error

RemountNFS remounts all NFS exports on a client

func (*NFSProvisioner) RemoveDockerVolume added in v0.1.2

func (n *NFSProvisioner) RemoveDockerVolume(client *ssh.Client, volumeName string) error

RemoveDockerVolume removes a Docker volume

func (*NFSProvisioner) SetupNFSClient added in v0.1.2

func (n *NFSProvisioner) SetupNFSClient(client *ssh.Client, nfsServerHost string, exports []NFSExportInfo) error

SetupNFSClient sets up NFS client and mounts on a worker node

func (*NFSProvisioner) SetupNFSServer added in v0.1.2

func (n *NFSProvisioner) SetupNFSServer(client *ssh.Client, nfsConfig *config.NFSConfig, allowedIPs []string) (*NFSServerInfo, error)

SetupNFSServer sets up the NFS server on the specified host

type NFSServerInfo added in v0.1.2

type NFSServerInfo struct {
	ServerName string
	Host       string
	Exports    []NFSExportInfo
}

NFSServerInfo contains information about the NFS server setup

type NFSStatus added in v0.1.2

type NFSStatus struct {
	IsServer      bool
	ServiceActive bool
	ExportsRaw    string
	ClientCount   int
	Mounts        []NFSMountStatus
}

NFSStatus represents the status of NFS on a node

type OSFamily

type OSFamily string

OSFamily represents different Linux distribution families

const (
	OSFamilyDebian  OSFamily = "debian"
	OSFamilyRHEL    OSFamily = "rhel"
	OSFamilySUSE    OSFamily = "suse"
	OSFamilyAlpine  OSFamily = "alpine"
	OSFamilyUnknown OSFamily = "unknown"
)

type OSInfo

type OSInfo struct {
	Family         OSFamily
	Name           string
	Version        string
	PackageManager string
}

OSInfo contains detected operating system information

func DetectOS

func DetectOS(client *ssh.Client) (*OSInfo, error)

DetectOS detects the operating system of the remote server

func (*OSInfo) IsSupported

func (info *OSInfo) IsSupported() bool

IsSupported returns true if the OS is supported

func (*OSInfo) String

func (info *OSInfo) String() string

String returns a human-readable representation of the OS

type PackageManager

type PackageManager interface {
	Update() error
	Install(packages ...string) error
	Remove(packages ...string) error
	Search(packageName string) (bool, error)
}

PackageManager defines interface for OS package management

func NewPackageManager

func NewPackageManager(client *ssh.Client, osInfo *OSInfo, verbose bool) (PackageManager, error)

NewPackageManager creates a package manager for the detected OS

type Provisioner

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

Provisioner handles server provisioning

func NewProvisioner

func NewProvisioner(client *ssh.Client, verbose bool) *Provisioner

NewProvisioner creates a new provisioner

func (*Provisioner) CheckRequirements

func (p *Provisioner) CheckRequirements() error

CheckRequirements checks if the server meets basic requirements

func (*Provisioner) ConfigureFirewall

func (p *Provisioner) ConfigureFirewall() error

ConfigureFirewall configures UFW firewall

func (*Provisioner) HardenSecurity

func (p *Provisioner) HardenSecurity() error

HardenSecurity applies comprehensive security hardening

func (*Provisioner) InstallDocker

func (p *Provisioner) InstallDocker() error

InstallDocker installs Docker and Docker Compose

func (*Provisioner) InstallMonitoringAgent

func (p *Provisioner) InstallMonitoringAgent() error

InstallMonitoringAgent installs the lightweight monitoring agent

func (*Provisioner) SetupDeployUser

func (p *Provisioner) SetupDeployUser(username string) error

SetupDeployUser ensures deploy user exists and has proper permissions

func (*Provisioner) UpdateSystem

func (p *Provisioner) UpdateSystem() error

UpdateSystem updates system packages

func (*Provisioner) VerifyAutoRecovery

func (p *Provisioner) VerifyAutoRecovery() error

VerifyAutoRecovery verifies that critical services are enabled for auto-recovery

type YumManager

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

YumManager manages packages using yum

func (*YumManager) Install

func (y *YumManager) Install(packages ...string) error

func (*YumManager) Remove

func (y *YumManager) Remove(packages ...string) error

func (*YumManager) Search

func (y *YumManager) Search(packageName string) (bool, error)

func (*YumManager) Update

func (y *YumManager) Update() error

type ZypperManager

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

ZypperManager manages packages using zypper

func (*ZypperManager) Install

func (z *ZypperManager) Install(packages ...string) error

func (*ZypperManager) Remove

func (z *ZypperManager) Remove(packages ...string) error

func (*ZypperManager) Search

func (z *ZypperManager) Search(packageName string) (bool, error)

func (*ZypperManager) Update

func (z *ZypperManager) Update() error

Jump to

Keyboard shortcuts

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