deployer

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheManager

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

CacheManager handles build caching using Docker BuildKit

func NewCacheManager

func NewCacheManager(projectName, environment string, verbose bool) *CacheManager

NewCacheManager creates a new cache manager

func (*CacheManager) GenerateCacheKey

func (cm *CacheManager) GenerateCacheKey(serviceName string, service *config.ServiceConfig) (string, error)

GenerateCacheKey generates a cache key for a service based on its build context

func (*CacheManager) GetBuildCommand

func (cm *CacheManager) GetBuildCommand(imageName, buildContext string, service *config.ServiceConfig) string

GetBuildCommand returns the enhanced build command with caching

func (*CacheManager) GetBuildKitFlags

func (cm *CacheManager) GetBuildKitFlags(serviceName string, service *config.ServiceConfig) []string

GetBuildKitFlags returns Docker BuildKit flags for caching

func (*CacheManager) GetLocalCachePath

func (cm *CacheManager) GetLocalCachePath(serviceName string) string

GetLocalCachePath returns the local cache path for a service

func (*CacheManager) IsCached

func (cm *CacheManager) IsCached(serviceName string) bool

IsCached checks if a cached image exists locally

func (*CacheManager) OptimizeBuildContext

func (cm *CacheManager) OptimizeBuildContext(buildPath string) ([]string, error)

OptimizeBuildContext creates an optimized build context by excluding unnecessary files

func (*CacheManager) SaveImageToCache

func (cm *CacheManager) SaveImageToCache(imageName, serviceName string) error

SaveImageToCache saves a Docker image to local cache

type CacheStats

type CacheStats struct {
	TotalBuilds int
	CacheHits   int
	CacheMisses int
	TimesSaved  time.Duration
}

CacheStats tracks cache hit/miss statistics

func (*CacheStats) GetHitRate

func (cs *CacheStats) GetHitRate() float64

GetHitRate returns the cache hit rate as a percentage

func (*CacheStats) Report

func (cs *CacheStats) Report()

Report prints cache statistics

type Deployer

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

Deployer handles deployment operations

func NewDeployer

func NewDeployer(client *ssh.Client, cfg *config.Config, environment string, verbose bool) *Deployer

NewDeployer creates a new deployer

func NewDeployerWithPool

func NewDeployerWithPool(client *ssh.Client, cfg *config.Config, environment string, sshPool *ssh.Pool, verbose bool) *Deployer

NewDeployerWithPool creates a deployer with SSH pool for multi-server support

func (*Deployer) BuildImage

func (d *Deployer) BuildImage(serviceName string, service *config.ServiceConfig) (string, error)

BuildImage builds a Docker image for a service without deploying it This is used for Swarm mode where we need to build first, then deploy with docker service create

func (*Deployer) CheckPortAvailability

func (d *Deployer) CheckPortAvailability(port int) (*PortInfo, error)

CheckPortAvailability checks if a port is available on the server

func (*Deployer) DeployServiceSwarm

func (d *Deployer) DeployServiceSwarm(serviceName string, service *config.ServiceConfig, fullImageName string) error

DeployServiceSwarm deploys a service to Docker Swarm

func (*Deployer) ResolvePortConflict

func (d *Deployer) ResolvePortConflict(portInfo *PortInfo, serviceName string, autoKill bool) error

ResolvePortConflict attempts to resolve a port conflict

func (*Deployer) RollbackToState

func (d *Deployer) RollbackToState(serviceName string, serviceState *state.ServiceState) error

RollbackToState rolls back a Swarm service to a specific deployment state

func (*Deployer) SetupSwarmCluster

func (d *Deployer) SetupSwarmCluster() error

SetupSwarmCluster initializes the Docker Swarm cluster

func (*Deployer) VerifyNetworkSetup

func (d *Deployer) VerifyNetworkSetup() error

VerifyNetworkSetup verifies that Traefik is connected to all project networks

type EnhancedBuildResult

type EnhancedBuildResult struct {
	ServiceName string
	ImageName   string
	Duration    time.Duration
	CacheHit    bool
	Error       error
}

EnhancedBuildResult contains build result with cache information

func (*EnhancedBuildResult) String

func (r *EnhancedBuildResult) String() string

String returns a string representation of the result

type HealthChecker

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

HealthChecker handles container health verification

func NewHealthChecker

func NewHealthChecker(client *ssh.Client, verbose bool) *HealthChecker

NewHealthChecker creates a new health checker

func (*HealthChecker) VerifyDatabaseConnectivity

func (hc *HealthChecker) VerifyDatabaseConnectivity(containerName string, service *config.ServiceConfig) error

VerifyDatabaseConnectivity verifies that a service can reach its database

func (*HealthChecker) WaitForHealthy

func (hc *HealthChecker) WaitForHealthy(containerName string, retries int) error

WaitForHealthy waits for a container to become healthy

type IgnoreParser

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

IgnoreParser handles parsing of .gitignore and .dockerignore files

func NewIgnoreParser

func NewIgnoreParser() *IgnoreParser

NewIgnoreParser creates a new ignore parser

func (*IgnoreParser) AddDefaultExclusions

func (ip *IgnoreParser) AddDefaultExclusions()

AddDefaultExclusions adds commonly excluded patterns

func (*IgnoreParser) GetExcludedPatterns

func (ip *IgnoreParser) GetExcludedPatterns() []string

GetExcludedPatterns returns all exclusion patterns

func (*IgnoreParser) LoadIgnoreFile

func (ip *IgnoreParser) LoadIgnoreFile(filePath string) error

LoadIgnoreFile loads patterns from a .gitignore or .dockerignore file

func (*IgnoreParser) ShouldIgnore

func (ip *IgnoreParser) ShouldIgnore(relPath string) bool

ShouldIgnore checks if a file path should be ignored

type PortInfo

type PortInfo struct {
	Port        int
	ProcessName string
	PID         string
	IsDocker    bool
	ContainerID string
}

PortInfo contains information about a port in use

Jump to

Keyboard shortcuts

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