services

package
v1.15.3 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: BSD-3-Clause Imports: 123 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTrivyImage = "ghcr.io/aquasecurity/trivy:latest"
)

Variables

View Source
var (
	ErrApiKeyNotFound = errors.New("API key not found")
	ErrApiKeyExpired  = errors.New("API key has expired")
	ErrApiKeyInvalid  = errors.New("invalid API key")
)
View Source
var (
	ErrInvalidCredentials   = errors.New("invalid credentials")
	ErrUserNotFound         = errors.New("user not found")
	ErrInvalidToken         = errors.New("invalid token")
	ErrExpiredToken         = errors.New("token expired")
	ErrTokenVersionMismatch = errors.New("token version mismatch")
	ErrLocalAuthDisabled    = errors.New("local authentication is disabled")
	ErrOidcAuthDisabled     = errors.New("OIDC authentication is disabled")
)
View Source
var (
	ErrNotRunningInDocker = errors.New("arcane is not running in a Docker container")
	ErrContainerNotFound  = errors.New("could not find Arcane container")
	ErrUpgradeInProgress  = errors.New("an upgrade is already in progress")
	ErrDockerSocketAccess = errors.New("docker socket is not accessible")
	ArcaneUpgraderImage   = "ghcr.io/getarcaneapp/arcane:latest"
)
View Source
var ErrTemplateNotFound = errors.New("template not found")

Functions

This section is empty.

Types

type ApiKeyService

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

func NewApiKeyService

func NewApiKeyService(db *database.DB, userService *UserService) *ApiKeyService

func (*ApiKeyService) CreateApiKey

func (s *ApiKeyService) CreateApiKey(ctx context.Context, userID string, req apikey.CreateApiKey) (*apikey.ApiKeyCreatedDto, error)

func (*ApiKeyService) CreateEnvironmentApiKey

func (s *ApiKeyService) CreateEnvironmentApiKey(ctx context.Context, environmentID string, userID string) (*apikey.ApiKeyCreatedDto, error)

func (*ApiKeyService) DeleteApiKey

func (s *ApiKeyService) DeleteApiKey(ctx context.Context, id string) error

func (*ApiKeyService) GetApiKey

func (s *ApiKeyService) GetApiKey(ctx context.Context, id string) (*apikey.ApiKey, error)

func (*ApiKeyService) GetEnvironmentByApiKey

func (s *ApiKeyService) GetEnvironmentByApiKey(ctx context.Context, rawKey string) (*string, error)

func (*ApiKeyService) ListApiKeys

func (*ApiKeyService) UpdateApiKey

func (s *ApiKeyService) UpdateApiKey(ctx context.Context, id string, req apikey.UpdateApiKey) (*apikey.ApiKey, error)

func (*ApiKeyService) ValidateApiKey

func (s *ApiKeyService) ValidateApiKey(ctx context.Context, rawKey string) (*models.User, error)

type ApplicationImagesService

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

func NewApplicationImagesService

func NewApplicationImagesService(embeddedFS embed.FS, settingsService *SettingsService) *ApplicationImagesService

func (*ApplicationImagesService) GetImageWithColor

func (s *ApplicationImagesService) GetImageWithColor(name string, colorOverride string) ([]byte, string, error)

type AppriseNotificationPayload

type AppriseNotificationPayload struct {
	Body   string   `json:"body"`
	Title  string   `json:"title,omitempty"`
	Type   string   `json:"type,omitempty"`
	Tag    []string `json:"tag,omitempty"`
	Format string   `json:"format,omitempty"`
}

type AppriseService deprecated

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

AppriseService handles sending notifications through Apprise API

Deprecated: Built-in providers (e.g., SMTP via Shoutrrr) are preferred.

func NewAppriseService

func NewAppriseService(db *database.DB, cfg *config.Config) *AppriseService

func (*AppriseService) CreateOrUpdateSettings

func (s *AppriseService) CreateOrUpdateSettings(ctx context.Context, apiURL string, enabled bool, imageUpdateTag, containerUpdateTag string) (*models.AppriseSettings, error)

func (*AppriseService) GetSettings

func (s *AppriseService) GetSettings(ctx context.Context) (*models.AppriseSettings, error)

func (*AppriseService) SendBatchImageUpdateNotification

func (s *AppriseService) SendBatchImageUpdateNotification(ctx context.Context, updates map[string]*imageupdate.Response) error

func (*AppriseService) SendContainerUpdateNotification

func (s *AppriseService) SendContainerUpdateNotification(ctx context.Context, containerName, imageRef, oldDigest, newDigest string) error

func (*AppriseService) SendImageUpdateNotification

func (s *AppriseService) SendImageUpdateNotification(ctx context.Context, imageRef string, updateInfo *imageupdate.Response) error

func (*AppriseService) SendNotification

func (s *AppriseService) SendNotification(ctx context.Context, title, body, format string, notificationType models.NotificationEventType) error

func (*AppriseService) TestNotification

func (s *AppriseService) TestNotification(ctx context.Context, testType string) error

type Argon2Params

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

func DefaultArgon2Params

func DefaultArgon2Params() *Argon2Params

type AuthService

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

func NewAuthService

func NewAuthService(userService *UserService, settingsService *SettingsService, eventService *EventService, jwtSecret string, cfg *config.Config) *AuthService

func (*AuthService) ChangePassword

func (s *AuthService) ChangePassword(ctx context.Context, userID, currentPassword, newPassword string) error

func (*AuthService) GetAutoLoginConfig

func (s *AuthService) GetAutoLoginConfig(ctx context.Context) (*auth.AutoLoginConfig, error)

GetAutoLoginConfig returns the auto-login configuration for the frontend. The password is never returned. Auto-login is disabled if local auth is disabled.

func (*AuthService) GetAutoLoginPassword

func (s *AuthService) GetAutoLoginPassword() string

GetAutoLoginPassword returns the auto-login password for internal use only. This should only be called by the login handler to validate auto-login credentials. WARNING: Never expose this value through any API response!

func (*AuthService) GetOidcConfig

func (s *AuthService) GetOidcConfig(ctx context.Context) (*models.OidcConfig, error)

func (*AuthService) GetOidcConfigurationStatus

func (s *AuthService) GetOidcConfigurationStatus(ctx context.Context) (*auth.OidcStatusInfo, error)

func (*AuthService) GetSessionTimeout

func (s *AuthService) GetSessionTimeout(ctx context.Context) (int, error)

func (*AuthService) IsLocalAuthEnabled

func (s *AuthService) IsLocalAuthEnabled(ctx context.Context) (bool, error)

func (*AuthService) IsOidcEnabled

func (s *AuthService) IsOidcEnabled(ctx context.Context) (bool, error)

func (*AuthService) Login

func (s *AuthService) Login(ctx context.Context, username, password string) (*models.User, *TokenPair, error)

func (*AuthService) OidcLogin

func (s *AuthService) OidcLogin(ctx context.Context, userInfo auth.OidcUserInfo, tokenResp *auth.OidcTokenResponse) (*models.User, *TokenPair, error)

func (*AuthService) RefreshToken

func (s *AuthService) RefreshToken(ctx context.Context, refreshToken string) (*TokenPair, error)

func (*AuthService) VerifyToken

func (s *AuthService) VerifyToken(ctx context.Context, accessToken string) (*models.User, error)

type AuthSettings

type AuthSettings struct {
	LocalAuthEnabled bool               `json:"localAuthEnabled"`
	OidcEnabled      bool               `json:"oidcEnabled"`
	SessionTimeout   int                `json:"sessionTimeout"`
	Oidc             *models.OidcConfig `json:"oidc,omitempty"`
}

type ContainerRegistryService

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

func NewContainerRegistryService

func NewContainerRegistryService(db *database.DB) *ContainerRegistryService

func (*ContainerRegistryService) CreateRegistry

func (*ContainerRegistryService) DeleteRegistry

func (s *ContainerRegistryService) DeleteRegistry(ctx context.Context, id string) error

func (*ContainerRegistryService) GetAllRegistries

func (s *ContainerRegistryService) GetAllRegistries(ctx context.Context) ([]models.ContainerRegistry, error)

func (*ContainerRegistryService) GetDecryptedToken

func (s *ContainerRegistryService) GetDecryptedToken(ctx context.Context, id string) (string, error)

GetDecryptedToken returns the decrypted token for a registry

func (*ContainerRegistryService) GetEnabledRegistries

func (s *ContainerRegistryService) GetEnabledRegistries(ctx context.Context) ([]models.ContainerRegistry, error)

GetEnabledRegistries returns all enabled registries

func (*ContainerRegistryService) GetImageDigest

func (s *ContainerRegistryService) GetImageDigest(ctx context.Context, imageRef string) (string, error)

GetImageDigest fetches the current digest for an image:tag from the registry This is used for digest-based update detection for non-semver tags

func (*ContainerRegistryService) GetRegistriesPaginated

func (*ContainerRegistryService) GetRegistryByID

func (*ContainerRegistryService) SyncRegistries

func (s *ContainerRegistryService) SyncRegistries(ctx context.Context, syncItems []containerregistry.Sync) error

SyncRegistries syncs registries from a manager to this agent instance It creates, updates, or deletes registries to match the provided list

func (*ContainerRegistryService) UpdateRegistry

type ContainerService

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

func NewContainerService

func NewContainerService(db *database.DB, eventService *EventService, dockerService *DockerClientService, imageService *ImageService, settingsService *SettingsService) *ContainerService

func (*ContainerService) AttachExec

func (s *ContainerService) AttachExec(ctx context.Context, containerID, execID string) (*ExecSession, error)

AttachExec attaches to an exec instance and returns an ExecSession for lifecycle management.

func (*ContainerService) CreateContainer

func (s *ContainerService) CreateContainer(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string, user models.User, credentials []containerregistry.Credential) (*container.InspectResponse, error)

func (*ContainerService) CreateExec

func (s *ContainerService) CreateExec(ctx context.Context, containerID string, cmd []string) (string, error)

CreateExec creates an exec instance in the container

func (*ContainerService) DeleteContainer

func (s *ContainerService) DeleteContainer(ctx context.Context, containerID string, force bool, removeVolumes bool, user models.User) error

func (*ContainerService) GetContainerByID

func (s *ContainerService) GetContainerByID(ctx context.Context, id string) (*container.InspectResponse, error)

func (*ContainerService) ListContainersPaginated

func (s *ContainerService) ListContainersPaginated(ctx context.Context, params pagination.QueryParams, includeAll bool, includeInternal bool) ([]containertypes.Summary, pagination.Response, containertypes.StatusCounts, error)

func (*ContainerService) RestartContainer

func (s *ContainerService) RestartContainer(ctx context.Context, containerID string, user models.User) error

func (*ContainerService) StartContainer

func (s *ContainerService) StartContainer(ctx context.Context, containerID string, user models.User) error

func (*ContainerService) StopContainer

func (s *ContainerService) StopContainer(ctx context.Context, containerID string, user models.User) error

func (*ContainerService) StreamLogs

func (s *ContainerService) StreamLogs(ctx context.Context, containerID string, logsChan chan<- string, follow bool, tail, since string, timestamps bool) error

func (*ContainerService) StreamStats

func (s *ContainerService) StreamStats(ctx context.Context, containerID string, statsChan chan<- any) error

type CreateEventRequest

type CreateEventRequest struct {
	Type          models.EventType     `json:"type"`
	Severity      models.EventSeverity `json:"severity,omitempty"`
	Title         string               `json:"title"`
	Description   string               `json:"description,omitempty"`
	ResourceType  *string              `json:"resourceType,omitempty"`
	ResourceID    *string              `json:"resourceId,omitempty"`
	ResourceName  *string              `json:"resourceName,omitempty"`
	UserID        *string              `json:"userId,omitempty"`
	Username      *string              `json:"username,omitempty"`
	EnvironmentID *string              `json:"environmentId,omitempty"`
	Metadata      models.JSON          `json:"metadata,omitempty"`
}

type CustomizeSearchService

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

func NewCustomizeSearchService

func NewCustomizeSearchService() *CustomizeSearchService

func (*CustomizeSearchService) GetCustomizeCategories

func (s *CustomizeSearchService) GetCustomizeCategories() []category.Category

GetCustomizeCategories returns all available customization categories with their metadata

func (*CustomizeSearchService) Search

func (s *CustomizeSearchService) Search(query string) search.Response

Search performs a relevance-scored search across all customization categories and items

type DeploymentSnippets

type DeploymentSnippets struct {
	DockerRun     string
	DockerCompose string
}

DeploymentSnippets contains deployment configuration snippets for an environment.

type DockerClientService

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

func NewDockerClientService

func NewDockerClientService(db *database.DB, cfg *config.Config, settingsService *SettingsService) *DockerClientService

func (*DockerClientService) GetAllContainers

func (s *DockerClientService) GetAllContainers(ctx context.Context) ([]container.Summary, int, int, int, error)

func (*DockerClientService) GetAllImages

func (s *DockerClientService) GetAllImages(ctx context.Context) ([]image.Summary, int, int, int, error)

func (*DockerClientService) GetAllNetworks

func (s *DockerClientService) GetAllNetworks(ctx context.Context) (_ []network.Summary, inuseNetworks int, unusedNetworks int, totalNetworks int, error error)

func (*DockerClientService) GetAllVolumes

func (s *DockerClientService) GetAllVolumes(ctx context.Context) ([]*volume.Volume, int, int, int, error)

func (*DockerClientService) GetClient

func (s *DockerClientService) GetClient() (*client.Client, error)

GetClient returns a singleton Docker client instance. It initializes the client on the first call.

type EnvironmentService

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

func NewEnvironmentService

func NewEnvironmentService(db *database.DB, httpClient *http.Client, dockerService *DockerClientService, eventService *EventService, settingsService *SettingsService) *EnvironmentService

func (*EnvironmentService) CreateEnvironment

func (s *EnvironmentService) CreateEnvironment(ctx context.Context, environment *models.Environment, userID, username *string) (*models.Environment, error)

func (*EnvironmentService) DeleteEnvironment

func (s *EnvironmentService) DeleteEnvironment(ctx context.Context, id string, userID, username *string) error

func (*EnvironmentService) EnsureLocalEnvironment

func (s *EnvironmentService) EnsureLocalEnvironment(ctx context.Context, appUrl string) error

func (*EnvironmentService) GenerateDeploymentSnippets

func (s *EnvironmentService) GenerateDeploymentSnippets(ctx context.Context, envID string, envAddress string, apiKey string) (*DeploymentSnippets, error)

GenerateDeploymentSnippets generates Docker deployment snippets for an environment.

func (*EnvironmentService) GenerateEdgeDeploymentSnippets

func (s *EnvironmentService) GenerateEdgeDeploymentSnippets(ctx context.Context, envID string, managerURL string, apiKey string) (*DeploymentSnippets, error)

GenerateEdgeDeploymentSnippets generates Docker deployment snippets for an edge agent. Edge agents connect outbound to the manager and don't require exposed ports.

func (*EnvironmentService) GetDB

func (s *EnvironmentService) GetDB() *database.DB

func (*EnvironmentService) GetEnabledRegistryCredentials

func (s *EnvironmentService) GetEnabledRegistryCredentials(ctx context.Context) ([]containerregistry.Credential, error)

func (*EnvironmentService) GetEnvironmentByID

func (s *EnvironmentService) GetEnvironmentByID(ctx context.Context, id string) (*models.Environment, error)

func (*EnvironmentService) ListEnvironmentsPaginated

func (s *EnvironmentService) ListEnvironmentsPaginated(ctx context.Context, params pagination.QueryParams) ([]environment.Environment, pagination.Response, error)

func (*EnvironmentService) ListRemoteEnvironments

func (s *EnvironmentService) ListRemoteEnvironments(ctx context.Context) ([]models.Environment, error)

ListRemoteEnvironments returns all non-local, enabled environments for syncing purposes.

func (*EnvironmentService) PairAgentWithBootstrap

func (s *EnvironmentService) PairAgentWithBootstrap(ctx context.Context, apiUrl, bootstrapToken string) (string, error)

Deprecated - Use the Api Key flow

func (*EnvironmentService) PairAndPersistAgentToken

func (s *EnvironmentService) PairAndPersistAgentToken(ctx context.Context, environmentID, apiUrl, bootstrapToken string) (string, error)

func (*EnvironmentService) ProxyRequest

func (s *EnvironmentService) ProxyRequest(ctx context.Context, envID string, method string, path string, body []byte) ([]byte, int, error)

ProxyRequest sends a request to a remote environment's API.

func (*EnvironmentService) RegenerateEnvironmentApiKey

func (s *EnvironmentService) RegenerateEnvironmentApiKey(ctx context.Context, envID string, newApiKeyID string, encryptedKey string, userID, username string, envName string) error

func (*EnvironmentService) SyncRegistriesToEnvironment

func (s *EnvironmentService) SyncRegistriesToEnvironment(ctx context.Context, environmentID string) error

SyncRegistriesToEnvironment syncs all registries from this manager to a remote environment

func (*EnvironmentService) SyncRegistriesToRemoteEnvironments

func (s *EnvironmentService) SyncRegistriesToRemoteEnvironments(ctx context.Context) error

SyncRegistriesToRemoteEnvironments syncs container registries to all eligible remote environments. Eligibility requires a non-local, enabled environment with a configured access token.

func (*EnvironmentService) SyncRepositoriesToEnvironment

func (s *EnvironmentService) SyncRepositoriesToEnvironment(ctx context.Context, environmentID string) error

SyncRepositoriesToEnvironment syncs all git repositories from this manager to a remote environment

func (*EnvironmentService) TestConnection

func (s *EnvironmentService) TestConnection(ctx context.Context, id string, customApiUrl *string) (string, error)

func (*EnvironmentService) UpdateEnvironment

func (s *EnvironmentService) UpdateEnvironment(ctx context.Context, id string, updates map[string]any, userID, username *string) (*models.Environment, error)

func (*EnvironmentService) UpdateEnvironmentHeartbeat

func (s *EnvironmentService) UpdateEnvironmentHeartbeat(ctx context.Context, id string) error

type EventService

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

func NewEventService

func NewEventService(db *database.DB) *EventService

func (*EventService) CreateEvent

func (s *EventService) CreateEvent(ctx context.Context, req CreateEventRequest) (*models.Event, error)

func (*EventService) CreateEventFromDto

func (s *EventService) CreateEventFromDto(ctx context.Context, req event.CreateEvent) (*event.Event, error)

func (*EventService) DeleteEvent

func (s *EventService) DeleteEvent(ctx context.Context, eventID string) error

func (*EventService) DeleteOldEvents

func (s *EventService) DeleteOldEvents(ctx context.Context, olderThan time.Duration) error

func (*EventService) GetEventsByEnvironmentPaginated

func (s *EventService) GetEventsByEnvironmentPaginated(ctx context.Context, environmentID string, params pagination.QueryParams) ([]event.Event, pagination.Response, error)

func (*EventService) ListEventsPaginated

func (s *EventService) ListEventsPaginated(ctx context.Context, params pagination.QueryParams) ([]event.Event, pagination.Response, error)

func (*EventService) LogContainerEvent

func (s *EventService) LogContainerEvent(ctx context.Context, eventType models.EventType, containerID, containerName, userID, username, environmentID string, metadata models.JSON) error

func (*EventService) LogErrorEvent

func (s *EventService) LogErrorEvent(ctx context.Context, eventType models.EventType, resourceType, resourceID, resourceName, userID, username, environmentID string, err error, metadata models.JSON)

func (*EventService) LogImageEvent

func (s *EventService) LogImageEvent(ctx context.Context, eventType models.EventType, imageID, imageName, userID, username, environmentID string, metadata models.JSON) error

func (*EventService) LogNetworkEvent

func (s *EventService) LogNetworkEvent(ctx context.Context, eventType models.EventType, networkID, networkName, userID, username, environmentID string, metadata models.JSON) error

func (*EventService) LogProjectEvent

func (s *EventService) LogProjectEvent(ctx context.Context, eventType models.EventType, projectID, projectName, userID, username, environmentID string, metadata models.JSON) error

func (*EventService) LogUserEvent

func (s *EventService) LogUserEvent(ctx context.Context, eventType models.EventType, userID, username string, metadata models.JSON) error

func (*EventService) LogVolumeEvent

func (s *EventService) LogVolumeEvent(ctx context.Context, eventType models.EventType, volumeID, volumeName, userID, username, environmentID string, metadata models.JSON) error

type ExecSession

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

ExecSession manages the lifecycle of a Docker exec session.

func (*ExecSession) Close

func (e *ExecSession) Close(ctx context.Context) error

Close terminates the exec session and kills the process if still running.

func (*ExecSession) Stdin

func (e *ExecSession) Stdin() io.WriteCloser

func (*ExecSession) Stdout

func (e *ExecSession) Stdout() io.Reader

type FontService

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

func NewFontService

func NewFontService(embeddedFS embed.FS) *FontService

func (*FontService) GetFont

func (s *FontService) GetFont(fontPath string) ([]byte, string, error)

func (*FontService) GetMonoFont

func (s *FontService) GetMonoFont() ([]byte, string, error)

func (*FontService) GetSansFont

func (s *FontService) GetSansFont() ([]byte, string, error)

func (*FontService) GetSerifFont

func (s *FontService) GetSerifFont() ([]byte, string, error)

type GitOpsSyncService

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

func NewGitOpsSyncService

func NewGitOpsSyncService(db *database.DB, repoService *GitRepositoryService, projectService *ProjectService, eventService *EventService) *GitOpsSyncService

func (*GitOpsSyncService) BrowseFiles

func (s *GitOpsSyncService) BrowseFiles(ctx context.Context, environmentID, id string, path string) (*gitops.BrowseResponse, error)

func (*GitOpsSyncService) CreateSync

func (s *GitOpsSyncService) CreateSync(ctx context.Context, environmentID string, req gitops.CreateSyncRequest) (*models.GitOpsSync, error)

func (*GitOpsSyncService) DeleteSync

func (s *GitOpsSyncService) DeleteSync(ctx context.Context, environmentID, id string) error

func (*GitOpsSyncService) GetSyncByID

func (s *GitOpsSyncService) GetSyncByID(ctx context.Context, environmentID, id string) (*models.GitOpsSync, error)

func (*GitOpsSyncService) GetSyncStatus

func (s *GitOpsSyncService) GetSyncStatus(ctx context.Context, environmentID, id string) (*gitops.SyncStatus, error)

func (*GitOpsSyncService) GetSyncsPaginated

func (s *GitOpsSyncService) GetSyncsPaginated(ctx context.Context, environmentID string, params pagination.QueryParams) ([]gitops.GitOpsSync, pagination.Response, gitops.SyncCounts, error)

func (*GitOpsSyncService) ImportSyncs

func (*GitOpsSyncService) ListSyncIntervalsRaw

func (s *GitOpsSyncService) ListSyncIntervalsRaw(ctx context.Context) ([]bootstraputils.IntervalMigrationItem, error)

func (*GitOpsSyncService) PerformSync

func (s *GitOpsSyncService) PerformSync(ctx context.Context, environmentID, id string) (*gitops.SyncResult, error)

func (*GitOpsSyncService) SyncAllEnabled

func (s *GitOpsSyncService) SyncAllEnabled(ctx context.Context) error

func (*GitOpsSyncService) UpdateSync

func (s *GitOpsSyncService) UpdateSync(ctx context.Context, environmentID, id string, req gitops.UpdateSyncRequest) (*models.GitOpsSync, error)

func (*GitOpsSyncService) UpdateSyncIntervalMinutes

func (s *GitOpsSyncService) UpdateSyncIntervalMinutes(ctx context.Context, id string, minutes int) error

type GitRepositoryService

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

func NewGitRepositoryService

func NewGitRepositoryService(db *database.DB, workDir string, eventService *EventService, settingsService *SettingsService) *GitRepositoryService

func (*GitRepositoryService) BrowseFiles

func (s *GitRepositoryService) BrowseFiles(ctx context.Context, id, branch, path string) (*gitops.BrowseResponse, error)

func (*GitRepositoryService) CreateRepository

func (*GitRepositoryService) DeleteRepository

func (s *GitRepositoryService) DeleteRepository(ctx context.Context, id string) error

func (*GitRepositoryService) GetAuthConfig

func (s *GitRepositoryService) GetAuthConfig(ctx context.Context, repository *models.GitRepository) (git.AuthConfig, error)

func (*GitRepositoryService) GetRepositoriesPaginated

func (s *GitRepositoryService) GetRepositoriesPaginated(ctx context.Context, params pagination.QueryParams) ([]gitops.GitRepository, pagination.Response, error)

func (*GitRepositoryService) GetRepositoryByID

func (s *GitRepositoryService) GetRepositoryByID(ctx context.Context, id string) (*models.GitRepository, error)

func (*GitRepositoryService) GetRepositoryByName

func (s *GitRepositoryService) GetRepositoryByName(ctx context.Context, name string) (*models.GitRepository, error)

func (*GitRepositoryService) ListBranches

func (s *GitRepositoryService) ListBranches(ctx context.Context, id string) ([]gitops.BranchInfo, error)

func (*GitRepositoryService) SyncRepositories

func (s *GitRepositoryService) SyncRepositories(ctx context.Context, syncItems []gitops.RepositorySync) error

SyncRepositories syncs repositories from a manager to this agent instance. It creates, updates, or deletes repositories to match the provided list.

func (*GitRepositoryService) TestConnection

func (s *GitRepositoryService) TestConnection(ctx context.Context, id string, branch string) error

func (*GitRepositoryService) UpdateRepository

type ImageParts

type ImageParts struct {
	Registry   string
	Repository string
	Tag        string
}

type ImageService

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

func NewImageService

func NewImageService(db *database.DB, dockerService *DockerClientService, registryService *ContainerRegistryService, imageUpdateService *ImageUpdateService, vulnerabilityService *VulnerabilityService, eventService *EventService) *ImageService

func (*ImageService) GetImageDetail

func (s *ImageService) GetImageDetail(ctx context.Context, id string) (*imagetypes.DetailSummary, error)

GetImageDetail returns a DetailSummary for the given image ID. It fetches ImageInspect and ImageList concurrently so the size field reflects the same metric shown in the image table (docker image ls / docker system df).

func (*ImageService) GetTotalImageSize

func (s *ImageService) GetTotalImageSize(ctx context.Context) (int64, error)

func (*ImageService) GetUpdateInfoByImageIDs

func (s *ImageService) GetUpdateInfoByImageIDs(ctx context.Context, imageIDs []string) (map[string]*imagetypes.UpdateInfo, error)

GetUpdateInfoByImageIDs returns a map of image ID to UpdateInfo for the given image IDs. This is used by the container service to populate update info for containers.

func (*ImageService) ImageExistsLocally

func (s *ImageService) ImageExistsLocally(ctx context.Context, imageName string) (bool, error)

func (*ImageService) ListImagesPaginated

func (s *ImageService) ListImagesPaginated(ctx context.Context, params pagination.QueryParams) ([]imagetypes.Summary, pagination.Response, error)

func (*ImageService) LoadImageFromReader

func (s *ImageService) LoadImageFromReader(ctx context.Context, reader io.Reader, fileName string, user models.User, maxSizeBytes int64) (*imagetypes.LoadResult, error)

func (*ImageService) PruneImages

func (s *ImageService) PruneImages(ctx context.Context, dangling bool) (*image.PruneReport, error)

func (*ImageService) PullImage

func (s *ImageService) PullImage(ctx context.Context, imageName string, progressWriter io.Writer, user models.User, externalCreds []containerregistry.Credential) error

func (*ImageService) RemoveImage

func (s *ImageService) RemoveImage(ctx context.Context, id string, force bool, user models.User) error

type ImageUpdateService

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

func NewImageUpdateService

func NewImageUpdateService(db *database.DB, settingsService *SettingsService, registryService *ContainerRegistryService, dockerService *DockerClientService, eventService *EventService, notificationService *NotificationService) *ImageUpdateService

func (*ImageUpdateService) CheckAllImages

func (s *ImageUpdateService) CheckAllImages(ctx context.Context, limit int, externalCreds []containerregistry.Credential) (map[string]*imageupdate.Response, error)

func (*ImageUpdateService) CheckImageUpdate

func (s *ImageUpdateService) CheckImageUpdate(ctx context.Context, imageRef string) (*imageupdate.Response, error)

func (*ImageUpdateService) CheckImageUpdateByID

func (s *ImageUpdateService) CheckImageUpdateByID(ctx context.Context, imageID string) (*imageupdate.Response, error)

func (*ImageUpdateService) CheckMultipleImages

func (s *ImageUpdateService) CheckMultipleImages(ctx context.Context, imageRefs []string, externalCreds []containerregistry.Credential) (map[string]*imageupdate.Response, error)

func (*ImageUpdateService) CleanupOrphanedRecords

func (s *ImageUpdateService) CleanupOrphanedRecords(ctx context.Context) error

func (*ImageUpdateService) GetUnnotifiedUpdates

func (s *ImageUpdateService) GetUnnotifiedUpdates(ctx context.Context) (map[string]*models.ImageUpdateRecord, error)

GetUnnotifiedUpdates returns a map of image IDs that have updates but haven't been notified yet

func (*ImageUpdateService) GetUpdateSummary

func (s *ImageUpdateService) GetUpdateSummary(ctx context.Context) (*imageupdate.Summary, error)

func (*ImageUpdateService) MarkUpdatesAsNotified

func (s *ImageUpdateService) MarkUpdatesAsNotified(ctx context.Context, imageIDs []string) error

MarkUpdatesAsNotified marks the given image IDs as having been notified

type JobRunner

type JobRunner interface {
	GetJob(jobID string) (schedulertypes.Job, bool)
}

type JobService

type JobService struct {
	OnJobSchedulesChanged func(ctx context.Context, changedKeys []string)
	// contains filtered or unexported fields
}

JobService manages configuration for background job schedules.

Intervals are persisted in the existing settings table as individual keys. After updates, the SettingsService cache is reloaded and a callback can be triggered so the running scheduler can reschedule active jobs.

NOTE: This is intentionally separate from SettingsService to keep the API surface job-focused and to centralize schedule validation/rescheduling.

func NewJobService

func NewJobService(db *database.DB, settings *SettingsService, cfg *config.Config) *JobService

func (*JobService) GetJobSchedules

func (s *JobService) GetJobSchedules(ctx context.Context) jobschedule.Config

func (*JobService) ListJobs

func (*JobService) RunJobNowInline

func (s *JobService) RunJobNowInline(ctx context.Context, jobID string) error

func (*JobService) SetScheduler

func (s *JobService) SetScheduler(scheduler JobRunner)

func (*JobService) UpdateJobSchedules

func (s *JobService) UpdateJobSchedules(ctx context.Context, updates jobschedule.Update) (jobschedule.Config, error)

type NetworkService

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

func NewNetworkService

func NewNetworkService(db *database.DB, dockerService *DockerClientService, eventService *EventService) *NetworkService

func (*NetworkService) CreateNetwork

func (s *NetworkService) CreateNetwork(ctx context.Context, name string, options network.CreateOptions, user models.User) (*network.CreateResponse, error)

func (*NetworkService) GetNetworkByID

func (s *NetworkService) GetNetworkByID(ctx context.Context, id string) (*network.Inspect, error)

func (*NetworkService) PruneNetworks

func (s *NetworkService) PruneNetworks(ctx context.Context) (*network.PruneReport, error)

func (*NetworkService) RemoveNetwork

func (s *NetworkService) RemoveNetwork(ctx context.Context, id string, user models.User) error

type NotificationService

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

func NewNotificationService

func NewNotificationService(db *database.DB, cfg *config.Config) *NotificationService

func (*NotificationService) CreateOrUpdateSettings

func (s *NotificationService) CreateOrUpdateSettings(ctx context.Context, provider models.NotificationProvider, enabled bool, config models.JSON) (*models.NotificationSettings, error)

func (*NotificationService) DeleteSettings

func (s *NotificationService) DeleteSettings(ctx context.Context, provider models.NotificationProvider) error

func (*NotificationService) GetAllSettings

func (*NotificationService) GetSettingsByProvider

func (s *NotificationService) GetSettingsByProvider(ctx context.Context, provider models.NotificationProvider) (*models.NotificationSettings, error)

func (*NotificationService) MigrateDiscordWebhookUrlToFields

func (s *NotificationService) MigrateDiscordWebhookUrlToFields(ctx context.Context) error

MigrateDiscordWebhookUrlToFields migrates legacy Discord webhookUrl to separate webhookId and token fields. This should be called during bootstrap to ensure existing Discord configurations are preserved.

func (*NotificationService) SendBatchImageUpdateNotification

func (s *NotificationService) SendBatchImageUpdateNotification(ctx context.Context, updates map[string]*imageupdate.Response) error

func (*NotificationService) SendContainerUpdateNotification

func (s *NotificationService) SendContainerUpdateNotification(ctx context.Context, containerName, imageRef, oldDigest, newDigest string) error

func (*NotificationService) SendImageUpdateNotification

func (s *NotificationService) SendImageUpdateNotification(ctx context.Context, imageRef string, updateInfo *imageupdate.Response, eventType models.NotificationEventType) error

func (*NotificationService) SendPruneReportNotification

func (s *NotificationService) SendPruneReportNotification(ctx context.Context, result *system.PruneAllResult) error

func (*NotificationService) SendVulnerabilityNotification

func (s *NotificationService) SendVulnerabilityNotification(ctx context.Context, payload VulnerabilityNotificationPayload) error

SendVulnerabilityNotification notifies all enabled providers that have vulnerability_found event enabled. Only daily summary payloads are sent; legacy per-CVE payloads are ignored.

func (*NotificationService) TestNotification

func (s *NotificationService) TestNotification(ctx context.Context, provider models.NotificationProvider, testType string) error

type OidcService

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

func NewOidcService

func NewOidcService(authService *AuthService, cfg *config.Config, httpClient *http.Client) *OidcService

func (*OidcService) ExchangeDeviceToken

func (s *OidcService) ExchangeDeviceToken(ctx context.Context, deviceCode string) (*auth.OidcUserInfo, *auth.OidcTokenResponse, error)

ExchangeDeviceToken exchanges a device code for tokens.

func (*OidcService) GenerateAuthURL

func (s *OidcService) GenerateAuthURL(ctx context.Context, redirectTo string, origin string) (string, string, error)

func (*OidcService) GetOidcRedirectURL

func (s *OidcService) GetOidcRedirectURL(origin string) string

func (*OidcService) HandleCallback

func (s *OidcService) HandleCallback(ctx context.Context, code, state, storedState, origin string) (*auth.OidcUserInfo, *auth.OidcTokenResponse, error)

func (*OidcService) InitiateDeviceAuth

func (s *OidcService) InitiateDeviceAuth(ctx context.Context) (*auth.OidcDeviceAuthResponse, error)

InitiateDeviceAuth initiates the OIDC device authorization flow.

type OidcState

type OidcState struct {
	State        string    `json:"state"`
	Nonce        string    `json:"nonce"`
	CodeVerifier string    `json:"code_verifier"`
	RedirectTo   string    `json:"redirect_to"`
	CreatedAt    time.Time `json:"created_at"`
}

type ProjectService

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

func NewProjectService

func NewProjectService(db *database.DB, settingsService *SettingsService, eventService *EventService, imageService *ImageService, dockerService *DockerClientService) *ProjectService

func (*ProjectService) CreateProject

func (s *ProjectService) CreateProject(ctx context.Context, name, composeContent string, envContent *string, user models.User) (*models.Project, error)

func (*ProjectService) DeployProject

func (s *ProjectService) DeployProject(ctx context.Context, projectID string, user models.User) error

func (*ProjectService) DestroyProject

func (s *ProjectService) DestroyProject(ctx context.Context, projectID string, removeFiles, removeVolumes bool, user models.User) error

func (*ProjectService) DownProject

func (s *ProjectService) DownProject(ctx context.Context, projectID string, user models.User) error

func (*ProjectService) EnsureProjectImagesPresent

func (s *ProjectService) EnsureProjectImagesPresent(ctx context.Context, projectID string, progressWriter io.Writer, credentials []containerregistry.Credential) error

EnsureProjectImagesPresent checks all compose service images for the project and pulls based on service pull policy: - always/refresh: always pull - missing/if_not_present/default: pull only if local image is missing - never: never pull (fails early if image is missing locally)

func (*ProjectService) GetProjectContent

func (s *ProjectService) GetProjectContent(ctx context.Context, projectID string) (composeContent, envContent string, err error)

func (*ProjectService) GetProjectDetails

func (s *ProjectService) GetProjectDetails(ctx context.Context, projectID string) (project.Details, error)

func (*ProjectService) GetProjectFromDatabaseByID

func (s *ProjectService) GetProjectFromDatabaseByID(ctx context.Context, id string) (*models.Project, error)

func (*ProjectService) GetProjectServices

func (s *ProjectService) GetProjectServices(ctx context.Context, projectID string) ([]ProjectServiceInfo, error)

func (*ProjectService) GetProjectStatusCounts

func (s *ProjectService) GetProjectStatusCounts(ctx context.Context) (folderCount, runningProjects, stoppedProjects, totalProjects int, err error)

func (*ProjectService) ListAllProjects

func (s *ProjectService) ListAllProjects(ctx context.Context) ([]models.Project, error)

func (*ProjectService) ListProjects

func (*ProjectService) PullProjectImages

func (s *ProjectService) PullProjectImages(ctx context.Context, projectID string, progressWriter io.Writer, credentials []containerregistry.Credential) error

func (*ProjectService) RedeployProject

func (s *ProjectService) RedeployProject(ctx context.Context, projectID string, user models.User) error

func (*ProjectService) RestartProject

func (s *ProjectService) RestartProject(ctx context.Context, projectID string, user models.User) error

func (*ProjectService) StreamProjectLogs

func (s *ProjectService) StreamProjectLogs(ctx context.Context, projectID string, logsChan chan<- string, follow bool, tail, since string, timestamps bool) error

func (*ProjectService) SyncProjectsFromFileSystem

func (s *ProjectService) SyncProjectsFromFileSystem(ctx context.Context) error

func (*ProjectService) UpdateProject

func (s *ProjectService) UpdateProject(ctx context.Context, projectID string, name *string, composeContent, envContent *string) (*models.Project, error)

func (*ProjectService) UpdateProjectIncludeFile

func (s *ProjectService) UpdateProjectIncludeFile(ctx context.Context, projectID, relativePath, content string) error

type ProjectServiceInfo

type ProjectServiceInfo struct {
	Name          string                      `json:"name"`
	Image         string                      `json:"image"`
	Status        string                      `json:"status"`
	ContainerID   string                      `json:"container_id"`
	ContainerName string                      `json:"container_name"`
	Ports         []string                    `json:"ports"`
	Health        *string                     `json:"health,omitempty"`
	IconURL       string                      `json:"icon_url,omitempty"`
	ServiceConfig *composetypes.ServiceConfig `json:"service_config,omitempty"`
}

type SettingsSearchService

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

func NewSettingsSearchService

func NewSettingsSearchService() *SettingsSearchService

func (*SettingsSearchService) GetSettingsCategories

func (s *SettingsSearchService) GetSettingsCategories() []category.Category

GetSettingsCategories returns all available settings categories with their metadata

func (*SettingsSearchService) Search

func (s *SettingsSearchService) Search(query string) search.Response

Search performs a relevance-scored search across settings categories and individual settings

type SettingsService

type SettingsService struct {
	OnImagePollingSettingsChanged      func(ctx context.Context)
	OnAutoUpdateSettingsChanged        func(ctx context.Context)
	OnProjectsDirectoryChanged         func(ctx context.Context)
	OnScheduledPruneSettingsChanged    func(ctx context.Context)
	OnVulnerabilityScanSettingsChanged func(ctx context.Context)
	OnTimeoutSettingsChanged           func(ctx context.Context, timeoutSettings map[string]string)
	// contains filtered or unexported fields
}

func NewSettingsService

func NewSettingsService(ctx context.Context, db *database.DB) (*SettingsService, error)

func (*SettingsService) EnsureDefaultSettings

func (s *SettingsService) EnsureDefaultSettings(ctx context.Context) error

func (*SettingsService) EnsureEncryptionKey

func (s *SettingsService) EnsureEncryptionKey(ctx context.Context) (string, error)

func (*SettingsService) GetBoolSetting

func (s *SettingsService) GetBoolSetting(ctx context.Context, key string, defaultValue bool) bool

func (*SettingsService) GetIntSetting

func (s *SettingsService) GetIntSetting(ctx context.Context, key string, defaultValue int) int

func (*SettingsService) GetSettingType

func (s *SettingsService) GetSettingType(key string) string

GetSettingType returns the type from the setting metadata

func (*SettingsService) GetSettings

func (s *SettingsService) GetSettings(ctx context.Context) (*models.Settings, error)

func (*SettingsService) GetSettingsConfig

func (s *SettingsService) GetSettingsConfig() *models.Settings

func (*SettingsService) GetStringSetting

func (s *SettingsService) GetStringSetting(ctx context.Context, key, defaultValue string) string

func (*SettingsService) ListSettings

func (s *SettingsService) ListSettings(all bool) []models.SettingVariable

func (*SettingsService) LoadDatabaseSettings

func (s *SettingsService) LoadDatabaseSettings(ctx context.Context) (err error)

func (*SettingsService) MigrateOidcConfigToFields

func (s *SettingsService) MigrateOidcConfigToFields(ctx context.Context) error

MigrateOidcConfigToFields migrates the legacy JSON authOidcConfig to individual fields, and renames legacy auth* keys to their new oidc* names. This should be called during bootstrap to ensure existing configurations are preserved.

func (*SettingsService) NormalizeProjectsDirectory

func (s *SettingsService) NormalizeProjectsDirectory(ctx context.Context, projectsDirEnv string) error

func (*SettingsService) PersistEnvSettingsIfMissing

func (s *SettingsService) PersistEnvSettingsIfMissing(ctx context.Context) error

func (*SettingsService) PruneUnknownSettings

func (s *SettingsService) PruneUnknownSettings(ctx context.Context) error

func (*SettingsService) SetBoolSetting

func (s *SettingsService) SetBoolSetting(ctx context.Context, key string, value bool) error

func (*SettingsService) SetIntSetting

func (s *SettingsService) SetIntSetting(ctx context.Context, key string, value int) error

func (*SettingsService) SetStringSetting

func (s *SettingsService) SetStringSetting(ctx context.Context, key, value string) error

func (*SettingsService) UpdateSetting

func (s *SettingsService) UpdateSetting(ctx context.Context, key, value string) error

func (*SettingsService) UpdateSettings

func (s *SettingsService) UpdateSettings(ctx context.Context, updates settings.Update) ([]models.SettingVariable, error)

type SystemService

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

func NewSystemService

func NewSystemService(
	db *database.DB,
	dockerService *DockerClientService,
	containerService *ContainerService,
	imageService *ImageService,
	volumeService *VolumeService,
	networkService *NetworkService,
	settingsService *SettingsService,
) *SystemService

func (*SystemService) ConvertToDockerCompose

func (s *SystemService) ConvertToDockerCompose(parsed *models.DockerRunCommand) (string, string, string, error)

func (*SystemService) GetDiskUsagePath

func (s *SystemService) GetDiskUsagePath(ctx context.Context) string

func (*SystemService) ParseDockerRunCommand

func (s *SystemService) ParseDockerRunCommand(command string) (*models.DockerRunCommand, error)

func (*SystemService) PruneAll

func (*SystemService) StartAllContainers

func (s *SystemService) StartAllContainers(ctx context.Context) (*containertypes.ActionResult, error)

func (*SystemService) StartAllStoppedContainers

func (s *SystemService) StartAllStoppedContainers(ctx context.Context) (*containertypes.ActionResult, error)

func (*SystemService) StopAllContainers

func (s *SystemService) StopAllContainers(ctx context.Context) (*containertypes.ActionResult, error)

type SystemUpgradeService

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

func NewSystemUpgradeService

func NewSystemUpgradeService(
	dockerService *DockerClientService,
	versionService *VersionService,
	eventService *EventService,
	settingsService *SettingsService,
) *SystemUpgradeService

func (*SystemUpgradeService) CanUpgrade

func (s *SystemUpgradeService) CanUpgrade(ctx context.Context) (bool, error)

CanUpgrade checks if self-upgrade is possible

func (*SystemUpgradeService) TriggerUpgradeViaCLI

func (s *SystemUpgradeService) TriggerUpgradeViaCLI(ctx context.Context, user models.User) error

TriggerUpgradeViaCLI spawns the upgrade CLI command in a separate container This avoids self-termination issues by running the upgrade from outside

type TemplateService

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

func NewTemplateService

func NewTemplateService(ctx context.Context, db *database.DB, httpClient *http.Client, settingsService *SettingsService) *TemplateService

func (*TemplateService) CreateRegistry

func (s *TemplateService) CreateRegistry(ctx context.Context, registry *models.TemplateRegistry) error

func (*TemplateService) CreateTemplate

func (s *TemplateService) CreateTemplate(ctx context.Context, template *models.ComposeTemplate) error

func (*TemplateService) DeleteRegistry

func (s *TemplateService) DeleteRegistry(ctx context.Context, id string) error

func (*TemplateService) DeleteTemplate

func (s *TemplateService) DeleteTemplate(ctx context.Context, id string) error

func (*TemplateService) DownloadTemplate

func (s *TemplateService) DownloadTemplate(ctx context.Context, remoteTemplate *models.ComposeTemplate) (*models.ComposeTemplate, error)

func (*TemplateService) FetchRaw

func (s *TemplateService) FetchRaw(ctx context.Context, url string) ([]byte, error)

func (*TemplateService) FetchTemplateContent

func (s *TemplateService) FetchTemplateContent(ctx context.Context, template *models.ComposeTemplate) (string, string, error)

func (*TemplateService) GetAllTemplates

func (s *TemplateService) GetAllTemplates(ctx context.Context) ([]models.ComposeTemplate, error)

func (*TemplateService) GetAllTemplatesPaginated

func (s *TemplateService) GetAllTemplatesPaginated(ctx context.Context, params pagination.QueryParams) ([]tmpl.Template, pagination.Response, error)

func (*TemplateService) GetComposeTemplate

func (s *TemplateService) GetComposeTemplate() string

func (*TemplateService) GetEnvTemplate

func (s *TemplateService) GetEnvTemplate() string

func (*TemplateService) GetGlobalVariables

func (s *TemplateService) GetGlobalVariables(ctx context.Context) ([]env.Variable, error)

func (*TemplateService) GetRegistries

func (s *TemplateService) GetRegistries(ctx context.Context) ([]models.TemplateRegistry, error)

func (*TemplateService) GetTemplate

func (s *TemplateService) GetTemplate(ctx context.Context, id string) (*models.ComposeTemplate, error)

func (*TemplateService) GetTemplateContentWithParsedData

func (s *TemplateService) GetTemplateContentWithParsedData(ctx context.Context, id string) (*tmpl.TemplateContent, error)

GetTemplateContentWithParsedData returns template content along with parsed metadata

func (*TemplateService) ParseComposeServices

func (s *TemplateService) ParseComposeServices(ctx context.Context, composeContent string) []string

ParseComposeServices extracts service names from a compose file content using compose-go

func (*TemplateService) SaveComposeTemplate

func (s *TemplateService) SaveComposeTemplate(content string) error

func (*TemplateService) SaveEnvTemplate

func (s *TemplateService) SaveEnvTemplate(content string) error

func (*TemplateService) SyncLocalTemplatesFromFilesystem

func (s *TemplateService) SyncLocalTemplatesFromFilesystem(ctx context.Context) error

func (*TemplateService) UpdateGlobalVariables

func (s *TemplateService) UpdateGlobalVariables(ctx context.Context, vars []env.Variable) error

func (*TemplateService) UpdateRegistry

func (s *TemplateService) UpdateRegistry(ctx context.Context, id string, updates *models.TemplateRegistry) error

func (*TemplateService) UpdateTemplate

func (s *TemplateService) UpdateTemplate(ctx context.Context, id string, updates *models.ComposeTemplate) error

type TokenPair

type TokenPair struct {
	AccessToken  string    `json:"accessToken"`
	RefreshToken string    `json:"refreshToken"` //nolint:gosec // API response contract requires refreshToken field
	ExpiresAt    time.Time `json:"expiresAt"`
}

type UpdaterService

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

func NewUpdaterService

func NewUpdaterService(
	db *database.DB,
	settings *SettingsService,
	docker *DockerClientService,
	projects *ProjectService,
	imageUpdates *ImageUpdateService,
	registries *ContainerRegistryService,
	events *EventService,
	imageSvc *ImageService,
	notifications *NotificationService,
	upgrade *SystemUpgradeService,
) *UpdaterService

func (*UpdaterService) ApplyPending

func (s *UpdaterService) ApplyPending(ctx context.Context, dryRun bool) (*updater.Result, error)

func (*UpdaterService) GetHistory

func (s *UpdaterService) GetHistory(ctx context.Context, limit int) ([]models.AutoUpdateRecord, error)

func (*UpdaterService) GetStatus

func (s *UpdaterService) GetStatus() updater.Status

func (*UpdaterService) UpdateSingleContainer

func (s *UpdaterService) UpdateSingleContainer(ctx context.Context, containerID string) (*updater.Result, error)

UpdateSingleContainer updates a single container by ID to the latest available image. It pulls the new image, stops the container, removes it, and recreates it with the new image.

type UserClaims

type UserClaims struct {
	jwt.RegisteredClaims
	UserID      string   `json:"user_id"`
	Username    string   `json:"username"`
	Email       string   `json:"email,omitempty"`
	DisplayName string   `json:"display_name,omitempty"`
	Roles       []string `json:"roles"`
	AppVersion  string   `json:"app_version,omitempty"`
}

type UserService

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

func NewUserService

func NewUserService(db *database.DB) *UserService

func (*UserService) AttachOidcSubjectTransactional

func (s *UserService) AttachOidcSubjectTransactional(ctx context.Context, userID string, subject string, updateFn func(u *models.User)) (*models.User, error)

AttachOidcSubjectTransactional safely links an OIDC subject to the given user inside a DB transaction. It uses a row lock (FOR UPDATE) to prevent concurrent merges from racing and validates that the user isn't already linked to a different subject. The provided updateFn can mutate the user (e.g., roles, display name, tokens, last login) before persisting.

Note: The clause.Locking{Strength: "UPDATE"} statement is used to acquire a row-level lock. This MUST be done inside a transaction to ensure the lock is held until the update is committed.

func (*UserService) CreateDefaultAdmin

func (s *UserService) CreateDefaultAdmin(ctx context.Context) error

func (*UserService) CreateUser

func (s *UserService) CreateUser(ctx context.Context, user *models.User) (*models.User, error)

func (*UserService) DeleteUser

func (s *UserService) DeleteUser(ctx context.Context, id string) error

func (*UserService) GetUser

func (s *UserService) GetUser(ctx context.Context, userID string) (*models.User, error)

func (*UserService) GetUserByEmail

func (s *UserService) GetUserByEmail(ctx context.Context, email string) (*models.User, error)

func (*UserService) GetUserByID

func (s *UserService) GetUserByID(ctx context.Context, id string) (*models.User, error)

func (*UserService) GetUserByOidcSubjectId

func (s *UserService) GetUserByOidcSubjectId(ctx context.Context, subjectId string) (*models.User, error)

func (*UserService) GetUserByUsername

func (s *UserService) GetUserByUsername(ctx context.Context, username string) (*models.User, error)

func (*UserService) HashPassword

func (s *UserService) HashPassword(password string) (string, error)

func (*UserService) ListUsersPaginated

func (s *UserService) ListUsersPaginated(ctx context.Context, params pagination.QueryParams) ([]user.User, pagination.Response, error)

func (*UserService) NeedsPasswordUpgrade

func (s *UserService) NeedsPasswordUpgrade(hash string) bool

func (*UserService) UpdateUser

func (s *UserService) UpdateUser(ctx context.Context, user *models.User) (*models.User, error)

func (*UserService) UpgradePasswordHash

func (s *UserService) UpgradePasswordHash(ctx context.Context, userID, password string) error

func (*UserService) ValidatePassword

func (s *UserService) ValidatePassword(encodedHash, password string) error

type VersionService

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

func NewVersionService

func NewVersionService(httpClient *http.Client, disabled bool, version string, revision string, containerRegistryService *ContainerRegistryService, dockerService *DockerClientService) *VersionService

func (*VersionService) GetAppVersionInfo

func (s *VersionService) GetAppVersionInfo(ctx context.Context) *version.Info

GetAppVersionInfo returns application version information including display version

func (*VersionService) GetLatestVersion

func (s *VersionService) GetLatestVersion(ctx context.Context) (string, error)

func (*VersionService) GetVersionInformation

func (s *VersionService) GetVersionInformation(ctx context.Context, currentVersion string) (*version.Check, error)

func (*VersionService) IsNewer

func (s *VersionService) IsNewer(latest, current string) bool

func (*VersionService) ReleaseURL

func (s *VersionService) ReleaseURL(version string) string

type VolumeService

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

func NewVolumeService

func NewVolumeService(db *database.DB, dockerService *DockerClientService, eventService *EventService, settingsService *SettingsService, containerService *ContainerService, imageService *ImageService, backupVolumeName string) *VolumeService

func (*VolumeService) BackupHasPath

func (s *VolumeService) BackupHasPath(ctx context.Context, backupID string, filePath string) (bool, error)

func (*VolumeService) BackupMountWarning

func (s *VolumeService) BackupMountWarning(ctx context.Context) string

func (*VolumeService) CleanupHelperContainers

func (s *VolumeService) CleanupHelperContainers(ctx context.Context)

func (*VolumeService) CleanupOrphanedVolumeHelpers

func (s *VolumeService) CleanupOrphanedVolumeHelpers(ctx context.Context) error

func (*VolumeService) CreateBackup

func (s *VolumeService) CreateBackup(ctx context.Context, volumeName string, user models.User) (*models.VolumeBackup, error)

func (*VolumeService) CreateDirectory

func (s *VolumeService) CreateDirectory(ctx context.Context, volumeName, dirPath string, user *models.User) error

func (*VolumeService) CreateVolume

func (s *VolumeService) CreateVolume(ctx context.Context, options volume.CreateOptions, user models.User) (*volumetypes.Volume, error)

func (*VolumeService) DeleteBackup

func (s *VolumeService) DeleteBackup(ctx context.Context, backupID string, user *models.User) error

func (*VolumeService) DeleteFile

func (s *VolumeService) DeleteFile(ctx context.Context, volumeName, filePath string, user *models.User) error

func (*VolumeService) DeleteVolume

func (s *VolumeService) DeleteVolume(ctx context.Context, name string, force bool, user models.User) error

func (*VolumeService) DownloadBackup

func (s *VolumeService) DownloadBackup(ctx context.Context, backupID string, user *models.User) (io.ReadCloser, int64, error)

func (*VolumeService) DownloadFile

func (s *VolumeService) DownloadFile(ctx context.Context, volumeName, filePath string) (io.ReadCloser, int64, error)

func (*VolumeService) GetFileContent

func (s *VolumeService) GetFileContent(ctx context.Context, volumeName, filePath string, maxBytes int64) ([]byte, string, error)

func (*VolumeService) GetVolumeByName

func (s *VolumeService) GetVolumeByName(ctx context.Context, name string) (*volumetypes.Volume, error)

func (*VolumeService) GetVolumeSizes

func (s *VolumeService) GetVolumeSizes(ctx context.Context) (map[string]VolumeSizeData, error)

GetVolumeSizes returns disk usage data for all volumes. This is a slow operation as it calls Docker's DiskUsage API.

func (*VolumeService) GetVolumeUsage

func (s *VolumeService) GetVolumeUsage(ctx context.Context, name string) (bool, []string, error)

func (*VolumeService) ListBackupFiles

func (s *VolumeService) ListBackupFiles(ctx context.Context, backupID string) ([]string, error)

func (*VolumeService) ListBackups

func (s *VolumeService) ListBackups(ctx context.Context, volumeName string) ([]models.VolumeBackup, error)

func (*VolumeService) ListBackupsPaginated

func (s *VolumeService) ListBackupsPaginated(ctx context.Context, volumeName string, params pagination.QueryParams) ([]models.VolumeBackup, pagination.Response, error)

func (*VolumeService) ListDirectory

func (s *VolumeService) ListDirectory(ctx context.Context, volumeName, dirPath string) ([]volumetypes.FileEntry, error)

func (*VolumeService) ListVolumesPaginated

func (s *VolumeService) ListVolumesPaginated(ctx context.Context, params pagination.QueryParams, includeInternal bool) ([]volumetypes.Volume, pagination.Response, volumetypes.UsageCounts, error)

func (*VolumeService) PruneVolumes

func (s *VolumeService) PruneVolumes(ctx context.Context) (*volumetypes.PruneReport, error)

func (*VolumeService) PruneVolumesWithOptions

func (s *VolumeService) PruneVolumesWithOptions(ctx context.Context, all bool) (*volumetypes.PruneReport, error)

func (*VolumeService) RestoreBackup

func (s *VolumeService) RestoreBackup(ctx context.Context, volumeName, backupID string, user models.User) error

func (*VolumeService) RestoreBackupFiles

func (s *VolumeService) RestoreBackupFiles(ctx context.Context, volumeName, backupID string, paths []string, user models.User) error

func (*VolumeService) UploadAndRestore

func (s *VolumeService) UploadAndRestore(ctx context.Context, volumeName string, archive io.Reader, filename string, user models.User) error

func (*VolumeService) UploadFile

func (s *VolumeService) UploadFile(ctx context.Context, volumeName, destPath string, content io.Reader, filename string, user *models.User) error

type VolumeSizeData

type VolumeSizeData struct {
	Size     int64
	RefCount int64
}

VolumeSizeData holds size information for a volume.

type VulnerabilityNotificationPayload

type VulnerabilityNotificationPayload struct {
	CVEID            string // e.g. CVE-2024-1234
	CVELink          string // e.g. https://nvd.nist.gov/vuln/detail/CVE-2024-1234
	Severity         string // CRITICAL, HIGH, MEDIUM, LOW, UNKNOWN
	ImageName        string // e.g. nginx:latest
	FixedVersion     string
	PkgName          string // optional
	InstalledVersion string // optional
}

VulnerabilityNotificationPayload is the data sent to all providers for vulnerability_found events. Only vulnerabilities with a fixed version should trigger this notification.

type VulnerabilityService

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

VulnerabilityService handles vulnerability scanning of container images

func NewVulnerabilityService

func NewVulnerabilityService(db *database.DB, dockerService *DockerClientService, eventService *EventService, settingsService *SettingsService, notificationService *NotificationService) *VulnerabilityService

NewVulnerabilityService creates a new VulnerabilityService instance

func (*VulnerabilityService) CleanupOrphanedScanRecords

func (s *VulnerabilityService) CleanupOrphanedScanRecords(ctx context.Context) (deleted int64, err error)

CleanupOrphanedScanRecords removes vulnerability scan records for images that no longer exist in Docker. This keeps "images scanned" counts in sync (e.g. avoids "5/3" when images were deleted after being scanned). Safe to call even when no images exist; returns the number of records deleted.

func (*VulnerabilityService) DeleteScanResult

func (s *VulnerabilityService) DeleteScanResult(ctx context.Context, imageID string) error

DeleteScanResult deletes the scan result for an image

func (*VulnerabilityService) DeleteScanResultsByImageIDs

func (s *VulnerabilityService) DeleteScanResultsByImageIDs(ctx context.Context, imageIDs []string) error

DeleteScanResultsByImageIDs deletes scan results for multiple images in one query.

func (*VulnerabilityService) GetEnvironmentSummary

GetEnvironmentSummary returns aggregated vulnerability counts across all images.

func (*VulnerabilityService) GetIgnoreRecordsForImage

func (s *VulnerabilityService) GetIgnoreRecordsForImage(ctx context.Context, envID string, imageID string) ([]models.VulnerabilityIgnore, error)

GetIgnoreRecordsForImage retrieves all ignore records for a specific image

func (*VulnerabilityService) GetScanResult

func (s *VulnerabilityService) GetScanResult(ctx context.Context, imageID string) (*vulnerability.ScanResult, error)

GetScanResult retrieves the most recent scan result for an image

func (*VulnerabilityService) GetScanSummariesByImageIDs

func (s *VulnerabilityService) GetScanSummariesByImageIDs(ctx context.Context, imageIDs []string) (map[string]*vulnerability.ScanSummary, error)

GetScanSummariesByImageIDs retrieves scan summaries for multiple images

func (*VulnerabilityService) GetScanSummary

func (s *VulnerabilityService) GetScanSummary(ctx context.Context, imageID string) (*vulnerability.ScanSummary, error)

GetScanSummary retrieves just the summary for an image (for list views)

func (*VulnerabilityService) GetTrivyVersion

func (s *VulnerabilityService) GetTrivyVersion(ctx context.Context) string

GetTrivyVersion returns the Trivy version from the Trivy container image

func (*VulnerabilityService) IgnoreVulnerability

func (s *VulnerabilityService) IgnoreVulnerability(ctx context.Context, envID string, payload *vulnerability.IgnorePayload) (*models.VulnerabilityIgnore, error)

IgnoreVulnerability creates a new ignore record for a vulnerability

func (*VulnerabilityService) ListAllVulnerabilities

ListAllVulnerabilities returns a paginated list of vulnerabilities across all scanned images.

func (*VulnerabilityService) ListIgnoredVulnerabilities

ListIgnoredVulnerabilities returns a list of ignored vulnerabilities for an environment

func (*VulnerabilityService) ListVulnerabilities

ListVulnerabilities returns a paginated, filtered list of vulnerabilities for an image.

func (*VulnerabilityService) ScanAllImages

func (s *VulnerabilityService) ScanAllImages(ctx context.Context, envID string, user models.User) (scanned, failed int, err error)

ScanAllImages scans all Docker images for vulnerabilities. It is intended for use by the scheduled vulnerability scan job. A single long-running Trivy container is created and reused for every image via docker exec, which avoids the overhead of creating/destroying a container per scan. The caller-supplied user is recorded in the event log.

func (*VulnerabilityService) ScanImage

func (s *VulnerabilityService) ScanImage(ctx context.Context, envID string, imageID string, user models.User) (*vulnerability.ScanResult, error)

ScanImage scans an image for vulnerabilities using Trivy

func (*VulnerabilityService) UnignoreVulnerability

func (s *VulnerabilityService) UnignoreVulnerability(ctx context.Context, envID string, ignoreID string) error

UnignoreVulnerability removes an ignore record

Jump to

Keyboard shortcuts

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