Documentation
¶
Overview ¶
internal/docker/client.go
internal/docker/compose.go
internal/docker/container.go
internal/docker/container_manager_ext.go
internal/docker/image.go
internal/docker/manager.go
internal/docker/network.go
internal/docker/service_info.go
internal/docker/service_manager.go
internal/docker/service_starters.go
internal/docker/types.go
internal/docker/utils.go
internal/docker/volume.go
Index ¶
- func GetDockerInstallInstructions() string
- func PrintServiceStartupInfo(serviceName string, port int)
- type AIServiceStarter
- type CacheServiceStarter
- type Client
- func (c *Client) CheckDockerVersion() error
- func (c *Client) Close() error
- func (c *Client) ContainerWait(ctx context.Context, containerID string, condition container.WaitCondition) (<-chan container.WaitResponse, <-chan error)
- func (c *Client) GetDockerClient() *client.Client
- func (c *Client) GetDockerInfo() (types.Info, error)
- func (c *Client) IsDockerRunning() bool
- func (c *Client) NewContainerManager() ContainerManager
- func (c *Client) NewImageManager() ImageManager
- func (c *Client) NewNetworkManager() NetworkManager
- func (c *Client) NewVolumeManager() VolumeManager
- func (c *Client) StreamLogs(containerID string, follow bool, since string, tail string, writer io.Writer) error
- type ComposeDeploy
- type ComposeFile
- type ComposeGenerator
- type ComposeHealthCheck
- type ComposeNetwork
- type ComposeResourceLimits
- type ComposeResources
- type ComposeService
- type ComposeVolume
- type ContainerConfig
- type ContainerInfo
- type ContainerManager
- type ContainerStats
- type DatabaseServiceStarter
- type HealthCheckConfig
- type ImageInfo
- type ImageManager
- type Manager
- func (m *Manager) CleanupProject() error
- func (m *Manager) Close() error
- func (m *Manager) CreateAndStartContainer(config ContainerConfig) (string, error)
- func (m *Manager) ExecInContainer(containerID string, cmd []string) (string, error)
- func (m *Manager) GetClient() *Client
- func (m *Manager) GetConfig() *config.Config
- func (m *Manager) GetContainerLogs(containerID string, follow bool, tail string) ([]byte, error)
- func (m *Manager) GetContainerStatus(containerID string) (*ContainerInfo, error)
- func (m *Manager) GetServicesStatus() ([]ServiceStatus, error)
- func (m *Manager) InitializeProject() error
- func (m *Manager) ListContainersByLabel(labels map[string]string) ([]ContainerInfo, error)
- func (m *Manager) StartSelectedServices(services []string, progress chan<- ServiceProgress) error
- func (m *Manager) StartServices(progress chan<- ServiceProgress) error
- func (m *Manager) StartServicesByComponents(components []string, progress chan<- ServiceProgress) error
- func (m *Manager) StopContainer(containerID string, timeout int) error
- func (m *Manager) StopServices(progress chan<- ServiceProgress) error
- func (m *Manager) WaitForContainerHealth(containerID string, timeout time.Duration) error
- type MinIOServiceInfo
- type NetworkInfo
- type NetworkManager
- type OllamaServiceInfo
- type PortBinding
- type PostgresServiceInfo
- type ProgressDetail
- type PullProgress
- type QueueServiceStarter
- type RedisServiceInfo
- type ServiceInfoProvider
- type ServiceManager
- func (sm *ServiceManager) GetStatus() ([]ServiceStatus, error)
- func (sm *ServiceManager) StartAll(progress chan<- ServiceProgress) error
- func (sm *ServiceManager) StartSelectedServices(services []string, progress chan<- ServiceProgress) error
- func (sm *ServiceManager) StartServicesByComponents(components []string, progress chan<- ServiceProgress) error
- func (sm *ServiceManager) StopAll(progress chan<- ServiceProgress) error
- func (sm *ServiceManager) WaitForService(service string, timeout time.Duration) error
- type ServiceProgress
- type ServiceStarter
- type ServiceStatus
- type StorageServiceStarter
- type VolumeInfo
- type VolumeManager
- type VolumeMount
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDockerInstallInstructions ¶
func GetDockerInstallInstructions() string
GetDockerInstallInstructions returns platform-specific Docker installation instructions
func PrintServiceStartupInfo ¶
PrintServiceStartupInfo displays detailed service information after startup
Types ¶
type AIServiceStarter ¶
type AIServiceStarter struct {
// contains filtered or unexported fields
}
AIServiceStarter handles AI service startup
func (*AIServiceStarter) PrintServiceInfo ¶
func (s *AIServiceStarter) PrintServiceInfo()
PrintServiceInfo prints service information including embedding support
func (*AIServiceStarter) Start ¶
func (s *AIServiceStarter) Start() error
Start starts the AI service with proper volume mounting
type CacheServiceStarter ¶
type CacheServiceStarter struct {
// contains filtered or unexported fields
}
CacheServiceStarter handles cache service startup
func (*CacheServiceStarter) Start ¶
func (s *CacheServiceStarter) Start() error
Start starts the cache service
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the Docker client with LocalCloud-specific functionality
func (*Client) CheckDockerVersion ¶
CheckDockerVersion ensures Docker version is compatible
func (*Client) ContainerWait ¶
func (c *Client) ContainerWait(ctx context.Context, containerID string, condition container.WaitCondition) (<-chan container.WaitResponse, <-chan error)
ContainerWait waits for a container to reach a certain condition
func (*Client) GetDockerClient ¶
func (*Client) GetDockerInfo ¶
GetDockerInfo returns Docker system information
func (*Client) IsDockerRunning ¶
IsDockerRunning checks if Docker daemon is accessible
func (*Client) NewContainerManager ¶
func (c *Client) NewContainerManager() ContainerManager
NewContainerManager creates a new container manager
func (*Client) NewImageManager ¶
func (c *Client) NewImageManager() ImageManager
NewImageManager creates a new image manager
func (*Client) NewNetworkManager ¶
func (c *Client) NewNetworkManager() NetworkManager
NewNetworkManager creates a new network manager
func (*Client) NewVolumeManager ¶
func (c *Client) NewVolumeManager() VolumeManager
NewVolumeManager creates a new volume manager
type ComposeDeploy ¶
type ComposeDeploy struct {
Resources ComposeResources `yaml:"resources"`
}
ComposeDeploy represents deployment configuration
type ComposeFile ¶
type ComposeFile struct {
Version string `yaml:"version"`
Services map[string]ComposeService `yaml:"services"`
Networks map[string]ComposeNetwork `yaml:"networks,omitempty"`
Volumes map[string]ComposeVolume `yaml:"volumes,omitempty"`
}
ComposeFile represents a Docker Compose file structure
type ComposeGenerator ¶
type ComposeGenerator struct {
// contains filtered or unexported fields
}
ComposeGenerator generates Docker Compose files from LocalCloud config
func NewComposeGenerator ¶
func NewComposeGenerator(cfg *config.Config) *ComposeGenerator
NewComposeGenerator creates a new compose generator
func (*ComposeGenerator) Generate ¶
func (g *ComposeGenerator) Generate() (*ComposeFile, error)
Generate generates a Docker Compose file
func (*ComposeGenerator) GenerateOverride ¶
func (g *ComposeGenerator) GenerateOverride() (*ComposeFile, error)
GenerateOverride generates a docker-compose.override.yml for development
func (*ComposeGenerator) WriteToFile ¶
func (g *ComposeGenerator) WriteToFile(compose *ComposeFile, path string) error
WriteToFile writes the compose file to disk
type ComposeHealthCheck ¶
type ComposeHealthCheck struct {
Test []string `yaml:"test"`
Interval string `yaml:"interval"`
Timeout string `yaml:"timeout"`
Retries int `yaml:"retries"`
StartPeriod string `yaml:"start_period,omitempty"`
}
ComposeHealthCheck represents health check configuration
type ComposeNetwork ¶
type ComposeNetwork struct {
Driver string `yaml:"driver,omitempty"`
}
ComposeNetwork represents a network in Docker Compose
type ComposeResourceLimits ¶
type ComposeResourceLimits struct {
Memory string `yaml:"memory,omitempty"`
CPUs string `yaml:"cpus,omitempty"`
}
ComposeResourceLimits represents specific resource limits
type ComposeResources ¶
type ComposeResources struct {
Limits ComposeResourceLimits `yaml:"limits"`
}
ComposeResources represents resource limits
type ComposeService ¶
type ComposeService struct {
Image string `yaml:"image"`
ContainerName string `yaml:"container_name"`
Environment map[string]string `yaml:"environment,omitempty"`
Ports []string `yaml:"ports,omitempty"`
Volumes []string `yaml:"volumes,omitempty"`
Networks []string `yaml:"networks,omitempty"`
Restart string `yaml:"restart,omitempty"`
DependsOn []string `yaml:"depends_on,omitempty"`
Command []string `yaml:"command,omitempty"`
HealthCheck *ComposeHealthCheck `yaml:"healthcheck,omitempty"`
Deploy *ComposeDeploy `yaml:"deploy,omitempty"`
}
ComposeService represents a service in Docker Compose
type ComposeVolume ¶
type ComposeVolume struct {
Driver string `yaml:"driver,omitempty"`
}
ComposeVolume represents a volume in Docker Compose
type ContainerConfig ¶
type ContainerConfig struct {
Name string
Image string
Env map[string]string
Ports []PortBinding
Volumes []VolumeMount
Networks []string
RestartPolicy string
Memory int64 // Memory limit in bytes
CPUQuota int64 // CPU quota (100000 = 1 CPU)
HealthCheck *HealthCheckConfig
Labels map[string]string
Command []string
}
ContainerConfig represents container configuration
type ContainerInfo ¶
type ContainerInfo struct {
ID string
Name string
Image string
Status string
State string
Health string
Ports map[string]string
Created int64
StartedAt int64
Memory int64
CPUPercent float64
}
ContainerInfo represents container information
type ContainerManager ¶
type ContainerManager interface {
Create(config ContainerConfig) (string, error)
Start(containerID string) error
Stop(containerID string, timeout int) error
Remove(containerID string) error
Logs(containerID string, follow bool) (io.ReadCloser, error)
Inspect(containerID string) (ContainerInfo, error)
List(filters map[string]string) ([]ContainerInfo, error)
Exists(name string) (bool, string, error)
WaitHealthy(containerID string, timeout time.Duration) error
Stats(containerID string) (ContainerStats, error)
}
ContainerManager manages Docker containers
type ContainerStats ¶
type ContainerStats struct {
CPUPercent float64
MemoryUsage uint64
MemoryLimit uint64
MemoryPercent float64
NetworkRx uint64
NetworkTx uint64
BlockRead uint64
BlockWrite uint64
}
ContainerStats represents container resource usage statistics
type DatabaseServiceStarter ¶
type DatabaseServiceStarter struct {
// contains filtered or unexported fields
}
DatabaseServiceStarter handles database service startup
func (*DatabaseServiceStarter) Start ¶
func (s *DatabaseServiceStarter) Start() error
Start starts the database service
type HealthCheckConfig ¶
type HealthCheckConfig struct {
Test []string
Interval int // seconds
Timeout int // seconds
Retries int
StartPeriod int // seconds
}
HealthCheckConfig represents health check configuration
type ImageManager ¶
type ImageManager interface {
Pull(image string, progress chan<- PullProgress) error
Exists(image string) (bool, error)
Remove(image string) error
List() ([]ImageInfo, error)
GetSize(image string) (int64, error)
}
ImageManager manages Docker images
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager provides a high-level interface for Docker operations
func NewManager ¶
NewManager creates a new Docker manager
func (*Manager) CleanupProject ¶
CleanupProject removes all project resources
func (*Manager) CreateAndStartContainer ¶
func (m *Manager) CreateAndStartContainer(config ContainerConfig) (string, error)
CreateAndStartContainer creates and starts a new container using existing managers
func (*Manager) ExecInContainer ¶
ExecInContainer executes a command in a running container
func (*Manager) GetContainerLogs ¶
GetContainerLogs retrieves logs from a container
func (*Manager) GetContainerStatus ¶
func (m *Manager) GetContainerStatus(containerID string) (*ContainerInfo, error)
GetContainerStatus gets the status of a container
func (*Manager) GetServicesStatus ¶
func (m *Manager) GetServicesStatus() ([]ServiceStatus, error)
GetServicesStatus delegates to service manager
func (*Manager) InitializeProject ¶
InitializeProject initializes Docker resources for a project
func (*Manager) ListContainersByLabel ¶
func (m *Manager) ListContainersByLabel(labels map[string]string) ([]ContainerInfo, error)
ListContainersByLabel lists containers with specific labels
func (*Manager) StartSelectedServices ¶
func (m *Manager) StartSelectedServices(services []string, progress chan<- ServiceProgress) error
StartSelectedServices starts only the specified services
func (*Manager) StartServices ¶
func (m *Manager) StartServices(progress chan<- ServiceProgress) error
StartServices delegates to service manager
func (*Manager) StartServicesByComponents ¶
func (m *Manager) StartServicesByComponents(components []string, progress chan<- ServiceProgress) error
func (*Manager) StopContainer ¶
StopContainer stops a running container
func (*Manager) StopServices ¶
func (m *Manager) StopServices(progress chan<- ServiceProgress) error
StopServices delegates to service manager
type MinIOServiceInfo ¶
MinIOServiceInfo provides MinIO-specific information
func (*MinIOServiceInfo) PrintInfo ¶
func (m *MinIOServiceInfo) PrintInfo()
PrintInfo displays MinIO service information
type NetworkInfo ¶
NetworkInfo represents network information
type NetworkManager ¶
type NetworkManager interface {
Create(name string) (string, error)
Remove(networkID string) error
Exists(name string) (bool, string, error)
List() ([]NetworkInfo, error)
}
NetworkManager manages Docker networks
type OllamaServiceInfo ¶
OllamaServiceInfo provides Ollama-specific information
func (*OllamaServiceInfo) PrintInfo ¶
func (o *OllamaServiceInfo) PrintInfo()
PrintInfo displays Ollama service information
type PortBinding ¶
PortBinding represents a port binding configuration
type PostgresServiceInfo ¶
PostgresServiceInfo provides PostgreSQL-specific information
func (*PostgresServiceInfo) PrintInfo ¶
func (p *PostgresServiceInfo) PrintInfo()
PrintInfo displays PostgreSQL service information
type ProgressDetail ¶
ProgressDetail represents detailed progress information
type PullProgress ¶
type PullProgress struct {
Status string
Progress string
ProgressDetail ProgressDetail
Error string
}
PullProgress represents image pull progress
type QueueServiceStarter ¶
type QueueServiceStarter struct {
// contains filtered or unexported fields
}
QueueServiceStarter handles queue service startup
func (*QueueServiceStarter) Start ¶
func (s *QueueServiceStarter) Start() error
Start starts the queue service
type RedisServiceInfo ¶
type RedisServiceInfo struct {
Port int
}
RedisServiceInfo provides Redis-specific information and examples
func (*RedisServiceInfo) PrintInfo ¶
func (r *RedisServiceInfo) PrintInfo()
PrintInfo displays Redis service information with queue examples
type ServiceInfoProvider ¶
type ServiceInfoProvider interface {
PrintInfo()
}
ServiceInfoProvider provides detailed service information and examples
func GetServiceInfoProvider ¶
func GetServiceInfoProvider(serviceName string, config interface{}) ServiceInfoProvider
GetServiceInfoProvider returns the appropriate service info provider
type ServiceManager ¶
type ServiceManager struct {
// contains filtered or unexported fields
}
ServiceManager handles service-specific operations
func NewServiceManager ¶
func NewServiceManager(m *Manager) *ServiceManager
NewServiceManager creates a new service manager
func (*ServiceManager) GetStatus ¶
func (sm *ServiceManager) GetStatus() ([]ServiceStatus, error)
func (*ServiceManager) StartAll ¶
func (sm *ServiceManager) StartAll(progress chan<- ServiceProgress) error
StartAll starts all configured services
func (*ServiceManager) StartSelectedServices ¶
func (sm *ServiceManager) StartSelectedServices(services []string, progress chan<- ServiceProgress) error
StartSelectedServices starts only the specified services
func (*ServiceManager) StartServicesByComponents ¶
func (sm *ServiceManager) StartServicesByComponents(components []string, progress chan<- ServiceProgress) error
func (*ServiceManager) StopAll ¶
func (sm *ServiceManager) StopAll(progress chan<- ServiceProgress) error
StopAll stops all services
func (*ServiceManager) WaitForService ¶
func (sm *ServiceManager) WaitForService(service string, timeout time.Duration) error
WaitForService waits for a specific service to be ready
type ServiceProgress ¶
ServiceProgress represents service operation progress
type ServiceStarter ¶
type ServiceStarter interface {
Start() error
}
ServiceStarter interface for starting individual services
func NewAIServiceStarter ¶
func NewAIServiceStarter(m *Manager) ServiceStarter
NewAIServiceStarter creates a new AI service starter
func NewCacheServiceStarter ¶
func NewCacheServiceStarter(m *Manager) ServiceStarter
NewCacheServiceStarter creates a new cache service starter
func NewDatabaseServiceStarter ¶
func NewDatabaseServiceStarter(m *Manager) ServiceStarter
NewDatabaseServiceStarter creates a new database service starter
func NewQueueServiceStarter ¶
func NewQueueServiceStarter(m *Manager) ServiceStarter
NewQueueServiceStarter creates a new queue service starter
func NewStorageServiceStarter ¶
func NewStorageServiceStarter(m *Manager) ServiceStarter
NewStorageServiceStarter creates a new storage service starter
type ServiceStatus ¶
type ServiceStatus struct {
Name string
Status string
Health string
Port string
CPUPercent float64
MemoryUsage uint64
MemoryLimit uint64
}
ServiceStatus represents the status of a service
type StorageServiceStarter ¶
type StorageServiceStarter struct {
// contains filtered or unexported fields
}
StorageServiceStarter handles storage service startup
func (*StorageServiceStarter) Start ¶
func (s *StorageServiceStarter) Start() error
Start starts the storage service
type VolumeInfo ¶
type VolumeInfo struct {
Name string
Driver string
Mountpoint string
Created time.Time
Labels map[string]string
Scope string
Size int64
}
VolumeInfo represents volume information
type VolumeManager ¶
type VolumeManager interface {
Create(name string, labels map[string]string) error
Remove(name string) error
Exists(name string) (bool, error)
List(filter map[string]string) ([]VolumeInfo, error)
Backup(volumeName string, targetPath string) error
Restore(volumeName string, sourcePath string) error
}
VolumeManager manages Docker volumes