Documentation
¶
Index ¶
- Variables
- type CatalogService
- type CertificatesConfig
- type Config
- type ConfigOption
- type ConnectionInfo
- type ContainerInfo
- type ContainerSpec
- type DependencySpec
- type DiscoveryConfig
- type DockerConfig
- type EnvVar
- type HealthCheck
- type Healthcheck
- type InitContainer
- type Instance
- func (i *Instance) ContainerCount() int
- func (i *Instance) GetAllContainerIDs() []string
- func (i *Instance) GetContainerByName(name string) *ContainerInfo
- func (i *Instance) GetMainContainerID() string
- func (i *Instance) GetMainContainerName() string
- func (i *Instance) GetPrimaryContainer() *ContainerInfo
- func (i *Instance) HasDependencies() bool
- type MonitoringConfig
- type NetworkConfig
- type NetworkGlobalConfig
- type PortConfig
- type PreferencesConfig
- type Project
- type ResourceConfig
- type ResourceRequirements
- type Service
- type ServiceCatalog
- type ServiceConfiguration
- type ServiceLinks
- type ServiceSpec
- func (s *ServiceSpec) GetContainerByName(name string) *ContainerSpec
- func (s *ServiceSpec) GetDependencyNames() []string
- func (s *ServiceSpec) GetPrimaryContainer() *ContainerSpec
- func (s *ServiceSpec) HasDependencies() bool
- func (s *ServiceSpec) IsMultiContainer() bool
- func (s *ServiceSpec) Validate() error
- type ServiceStatus
- type TraefikConfig
- type TraefikGlobalConfig
- type TraefikInstanceConfig
- type ValidationError
- type VersionConfig
- type VolumeConfig
Constants ¶
This section is empty.
Variables ¶
var ( // Service errors ErrServiceNotFound = errors.New("service not found") ErrServiceNotRunning = errors.New("service is not running") ErrAlreadyRunning = errors.New("service is already running") ErrAlreadyStopped = errors.New("service is already stopped") ErrInvalidService = errors.New("invalid service configuration") // Configuration errors ErrNotInitialized = errors.New("doku is not initialized") ErrConfigNotFound = errors.New("configuration not found") ErrInvalidConfig = errors.New("invalid configuration") // Catalog errors ErrCatalogNotFound = errors.New("catalog not found") ErrVersionNotFound = errors.New("version not found") ErrInvalidCatalog = errors.New("invalid catalog format") // Project errors ErrProjectNotFound = errors.New("project not found") ErrInvalidProject = errors.New("invalid project configuration") ErrProjectExists = errors.New("project already exists") // Container errors ErrContainerNotFound = errors.New("container not found") ErrContainerFailed = errors.New("container failed") // Network errors ErrNetworkNotFound = errors.New("network not found") ErrNetworkFailed = errors.New("network operation failed") // Volume errors ErrVolumeNotFound = errors.New("volume not found") ErrVolumeFailed = errors.New("volume operation failed") )
Common sentinel errors for better error handling throughout the application
Functions ¶
This section is empty.
Types ¶
type CatalogService ¶
type CatalogService struct {
Name string `toml:"name"`
Description string `toml:"description"`
Category string `toml:"category"` // database, cache, queue, monitoring, etc.
Icon string `toml:"icon"` // emoji or icon reference
Versions map[string]*ServiceSpec `toml:"versions"`
Tags []string `toml:"tags"`
Links *ServiceLinks `toml:"links"`
}
CatalogService represents a service definition in the catalog
type CertificatesConfig ¶
CertificatesConfig holds SSL certificate configuration
type Config ¶
type Config struct {
Preferences PreferencesConfig
Network NetworkGlobalConfig
Traefik TraefikGlobalConfig
Certificates CertificatesConfig
Monitoring MonitoringConfig
Instances map[string]*Instance
Projects map[string]*Project
}
Config represents the main Doku configuration
type ConfigOption ¶
type ConfigOption struct {
Name string `toml:"name"` // Option name
Description string `toml:"description"` // Option description
Type string `toml:"type"` // string, int, bool, select
Default string `toml:"default"` // Default value
Required bool `toml:"required"` // Whether required
EnvVar string `toml:"env_var"` // Environment variable name
Options []string `toml:"options,omitempty"` // For select type
Validation string `toml:"validation,omitempty"` // Validation regex
}
ConfigOption represents a single configuration option
type ConnectionInfo ¶
type ConnectionInfo struct {
Host string `json:"host"`
Port int `json:"port"`
URL string `json:"url"`
Protocol string `json:"protocol"`
Env map[string]string `json:"env"` // Environment variables for connection
}
ConnectionInfo represents service connection information
type ContainerInfo ¶
type ContainerInfo struct {
Name string `yaml:"name"` // Container name (e.g., "frontend", "query-service")
ContainerID string `yaml:"id"` // Docker container ID
FullName string `yaml:"full_name"` // Full container name (e.g., "doku-signoz-frontend")
Primary bool `yaml:"primary"` // Is this the primary/main container?
Status string `yaml:"status"` // Container status (running, stopped, etc.)
Ports []string `yaml:"ports"` // Port mappings
Image string `yaml:"image"` // Docker image used
}
ContainerInfo holds information about a container in a multi-container service
type ContainerSpec ¶
type ContainerSpec struct {
Name string `toml:"name" yaml:"name"` // Container name (e.g., "frontend", "query-service")
Image string `toml:"image" yaml:"image"` // Docker image with tag
Primary bool `toml:"primary" yaml:"primary"` // Is this the primary/main container (default: first)
Ports []string `toml:"ports" yaml:"ports"` // Port mappings (e.g., "3301:3301")
Environment map[string]string `toml:"environment" yaml:"environment"` // Container-specific environment variables
Volumes []string `toml:"volumes" yaml:"volumes"` // Volume mount paths
DependsOn []string `toml:"depends_on" yaml:"depends_on"` // Internal (same service) or external dependencies
Healthcheck *Healthcheck `toml:"healthcheck" yaml:"healthcheck"` // Container health check
Resources *ResourceRequirements `toml:"resources" yaml:"resources"` // Container resource limits
Command []string `toml:"command" yaml:"command"` // Custom command override
Entrypoint []string `toml:"entrypoint" yaml:"entrypoint"` // Custom entrypoint override
}
ContainerSpec defines a single container within a multi-container service
type DependencySpec ¶
type DependencySpec struct {
Name string `toml:"name" yaml:"name"` // Service name (e.g., "clickhouse")
Version string `toml:"version" yaml:"version"` // Version constraint (default: "latest")
Required bool `toml:"required" yaml:"required"` // Is this dependency required (default: true)
Environment map[string]string `toml:"environment" yaml:"environment"` // Override environment variables for dependency
}
DependencySpec defines a service dependency with configuration
type DiscoveryConfig ¶
type DiscoveryConfig struct {
Type string
Protocol string
DefaultPort int
ConnectionTemplate string
EnvVars map[string]string
CompatibleWith []string
}
DiscoveryConfig holds service discovery metadata
type DockerConfig ¶
type DockerConfig struct {
Image string
DefaultTag string
Ports []PortConfig
Environment []EnvVar
Volumes []VolumeConfig
HealthCheck *HealthCheck
}
DockerConfig holds Docker-specific configuration
type HealthCheck ¶
HealthCheck defines container health check
type Healthcheck ¶
type Healthcheck struct {
Test []string `toml:"test"` // Health check command
Interval string `toml:"interval"` // Check interval (e.g., "30s")
Timeout string `toml:"timeout"` // Check timeout
Retries int `toml:"retries"` // Number of retries
Start string `toml:"start_period"` // Start period before checks begin
}
Healthcheck defines health check configuration
type InitContainer ¶ added in v0.1.1
type InitContainer struct {
Name string `toml:"name" yaml:"name"` // Init container name (e.g., "migrator-sync")
Image string `toml:"image" yaml:"image"` // Docker image with tag
Command []string `toml:"command" yaml:"command"` // Command to run
Environment map[string]string `toml:"environment" yaml:"environment"` // Environment variables
DependsOn []string `toml:"depends_on" yaml:"depends_on"` // Dependencies (must complete before this runs)
}
InitContainer defines a container that runs once before the service starts Useful for migrations, setup scripts, etc.
type Instance ¶
type Instance struct {
Name string
ServiceType string
Version string
Status ServiceStatus
HealthStatus string // Health check status: healthy, unhealthy, starting, none, unknown
// Single-container fields (backward compatible)
ContainerName string
ContainerID string // Docker container ID
// Multi-container support (new)
IsMultiContainer bool `yaml:"is_multi_container"` // Whether this is a multi-container service
Containers []ContainerInfo `yaml:"containers"` // Container information for multi-container services
// Dependencies
Dependencies []string `yaml:"dependencies"` // List of service dependencies
URL string
ConnectionString string
CreatedAt time.Time
UpdatedAt time.Time
Network NetworkConfig
Resources ResourceConfig
Traefik TraefikInstanceConfig
Volumes map[string]string
Environment map[string]string
}
Instance represents an installed service instance
func (*Instance) ContainerCount ¶
ContainerCount returns the number of containers for this instance
func (*Instance) GetAllContainerIDs ¶
GetAllContainerIDs returns all container IDs for this instance
func (*Instance) GetContainerByName ¶
func (i *Instance) GetContainerByName(name string) *ContainerInfo
GetContainerByName finds a container by name in multi-container instances
func (*Instance) GetMainContainerID ¶
GetMainContainerID returns the container ID for single-container or primary container for multi-container
func (*Instance) GetMainContainerName ¶
GetMainContainerName returns the container name for single-container or primary container for multi-container
func (*Instance) GetPrimaryContainer ¶
func (i *Instance) GetPrimaryContainer() *ContainerInfo
GetPrimaryContainer returns the primary container for multi-container instances
func (*Instance) HasDependencies ¶
HasDependencies returns true if this instance has dependencies
type MonitoringConfig ¶
type MonitoringConfig struct {
Tool string `json:"tool" yaml:"tool"` // "signoz", "sentry", "none"
Enabled bool `json:"enabled" yaml:"enabled"` // Whether monitoring is enabled
URL string `json:"url" yaml:"url"` // Dashboard URL
DSN string `json:"dsn" yaml:"dsn"` // Endpoint (OTLP for SignOz, DSN for Sentry)
APIKey string `json:"api_key" yaml:"api_key"` // API key if needed
InstallTime time.Time `json:"install_time" yaml:"install_time"` // When monitoring was installed
}
MonitoringConfig holds monitoring configuration
type NetworkConfig ¶
type NetworkConfig struct {
Name string
InternalPort int
HostPort int // Deprecated: use PortMappings for multiple ports
PortMappings map[string]string // Container port -> Host port mappings (as strings for TOML compatibility)
}
NetworkConfig holds network configuration for an instance
type NetworkGlobalConfig ¶
NetworkGlobalConfig holds global network configuration
type PortConfig ¶
PortConfig defines a port mapping
type PreferencesConfig ¶
type PreferencesConfig struct {
Protocol string
Domain string
CatalogVersion string
LastUpdate time.Time
DNSSetup string
}
PreferencesConfig holds user preferences
type Project ¶
type Project struct {
Name string
Path string
Dockerfile string
Status ServiceStatus
ContainerName string
ContainerID string
URL string
Port int
CreatedAt time.Time
Dependencies []string
Environment map[string]string
}
Project represents a local user project
type ResourceConfig ¶
type ResourceConfig struct {
MemoryLimit string
MemoryUsage string
CPULimit string
CPUUsage string
}
ResourceConfig holds resource limits and usage
type ResourceRequirements ¶
type ResourceRequirements struct {
MemoryMin string `toml:"memory_min"` // Minimum memory (e.g., "256m")
MemoryMax string `toml:"memory_max"` // Maximum memory (e.g., "1g")
CPUMin string `toml:"cpu_min"` // Minimum CPU (e.g., "0.25")
CPUMax string `toml:"cpu_max"` // Maximum CPU (e.g., "1.0")
}
ResourceRequirements defines default resource requirements
type Service ¶
type Service struct {
Name string
DisplayName string
Description string
Category string
Icon string
Tags []string
OfficialDocs string
Versions VersionConfig
Docker DockerConfig
Traefik TraefikConfig
Discovery DiscoveryConfig
}
Service represents a service from the catalog
type ServiceCatalog ¶
type ServiceCatalog struct {
Version string `toml:"version"`
Services map[string]*CatalogService `toml:"services"`
}
ServiceCatalog represents the complete catalog structure
type ServiceConfiguration ¶
type ServiceConfiguration struct {
Options []ConfigOption `toml:"options"` // Configuration options
}
ServiceConfiguration defines configurable options
type ServiceLinks ¶
type ServiceLinks struct {
Homepage string `toml:"homepage"`
Documentation string `toml:"documentation"`
Repository string `toml:"repository"`
}
ServiceLinks contains useful links for a service
type ServiceSpec ¶
type ServiceSpec struct {
// Single-container fields (backward compatible)
Image string `toml:"image" yaml:"image"` // Docker image with tag
Description string `toml:"description" yaml:"description"` // Version-specific description
Port int `toml:"port" yaml:"port"` // Main service port (exposed via Traefik)
AdminPort int `toml:"admin_port" yaml:"admin_port"` // Optional admin/management port
Protocol string `toml:"protocol" yaml:"protocol"` // http, tcp, grpc, etc.
Ports []string `toml:"ports" yaml:"ports"` // Additional port mappings (e.g., "9000:9000")
Environment map[string]string `toml:"environment" yaml:"environment"` // Default environment variables
Volumes []string `toml:"volumes" yaml:"volumes"` // Volume mount paths
Command []string `toml:"command" yaml:"command"` // Custom command
Healthcheck *Healthcheck `toml:"healthcheck" yaml:"healthcheck"` // Health check configuration
Resources *ResourceRequirements `toml:"resources" yaml:"resources"` // CPU/memory requirements
Configuration *ServiceConfiguration `toml:"configuration" yaml:"configuration"` // Configuration options
// Multi-container support (new)
Containers []ContainerSpec `toml:"containers" yaml:"containers"` // Multiple containers for this service
InitContainers []InitContainer `toml:"init_containers" yaml:"init_containers"` // Init containers that run once before service starts
// Dependency management (enhanced)
Dependencies []DependencySpec `toml:"dependencies" yaml:"dependencies"` // Service dependencies with configuration
}
ServiceSpec represents a specific version of a service
func (*ServiceSpec) GetContainerByName ¶
func (s *ServiceSpec) GetContainerByName(name string) *ContainerSpec
GetContainerByName finds a container by name in a multi-container service
func (*ServiceSpec) GetDependencyNames ¶
func (s *ServiceSpec) GetDependencyNames() []string
GetDependencyNames returns a list of dependency service names
func (*ServiceSpec) GetPrimaryContainer ¶
func (s *ServiceSpec) GetPrimaryContainer() *ContainerSpec
GetPrimaryContainer returns the primary container spec for multi-container services Returns nil if this is a single-container service or no primary is set
func (*ServiceSpec) HasDependencies ¶
func (s *ServiceSpec) HasDependencies() bool
HasDependencies returns true if this service has dependencies
func (*ServiceSpec) IsMultiContainer ¶
func (s *ServiceSpec) IsMultiContainer() bool
IsMultiContainer returns true if this service has multiple containers
func (*ServiceSpec) Validate ¶
func (s *ServiceSpec) Validate() error
Validate checks if the ServiceSpec is valid
type ServiceStatus ¶
type ServiceStatus string
ServiceStatus represents the status of a service instance
const ( StatusRunning ServiceStatus = "running" StatusStopped ServiceStatus = "stopped" StatusFailed ServiceStatus = "failed" StatusUnknown ServiceStatus = "unknown" )
type TraefikConfig ¶
type TraefikConfig struct {
Enabled bool
Port int
HasWebInterface bool
WebPort int
CustomRules []string
}
TraefikConfig holds Traefik routing configuration
type TraefikGlobalConfig ¶
type TraefikGlobalConfig struct {
ContainerName string
Status ServiceStatus
DashboardEnabled bool
HTTPPort int
HTTPSPort int
DashboardURL string
}
TraefikGlobalConfig holds Traefik global configuration
type TraefikInstanceConfig ¶
TraefikInstanceConfig holds Traefik configuration for an instance
type ValidationError ¶
ValidationError represents a validation error
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
type VersionConfig ¶
VersionConfig holds version information