Documentation
¶
Overview ¶
Package project owns compose project persistence, lifecycle, discovery, and routes.
Index ¶
- Constants
- func IconCatalogForContext(ctx context.Context) string
- func ParseEnvText(raw *string) (map[string]string, error)
- func ParseExtraMountsText(raw *string) ([]lifecycletype.ExtraMount, error)
- func RegisterProjects(api huma.API, projectService *ProjectService, ...)
- type ArchiveProjectInput
- type ArchiveProjectOutput
- type BuildProjectInput
- type CreateProjectInput
- type CreateProjectOutput
- type DeployProjectInput
- type DeployProjectOutput
- type DestroyProjectInput
- type DestroyProjectOutput
- type DownProjectInput
- type DownProjectOutput
- type GetProjectInput
- type GetProjectOutput
- type GetProjectStatusCountsInput
- type GetProjectStatusCountsOutput
- type GetProjectWorkspaceFileInput
- type GetProjectWorkspaceFileOutput
- type GetProjectWorkspaceInput
- type GetProjectWorkspaceOutput
- type GitOpsSync
- type LifecycleService
- type ListProjectTagsInput
- type ListProjectTagsOutput
- type ListProjectsInput
- type ListProjectsOutput
- type Module
- type Project
- type ProjectBuildOptions
- type ProjectHandler
- func (h *ProjectHandler) ArchiveProject(ctx context.Context, input *ArchiveProjectInput) (*ArchiveProjectOutput, error)
- func (h *ProjectHandler) BuildProjectImages(ctx context.Context, input *BuildProjectInput) (*huma.StreamResponse, error)
- func (h *ProjectHandler) CreateProject(ctx context.Context, input *CreateProjectInput) (*CreateProjectOutput, error)
- func (h *ProjectHandler) DeployProject(ctx context.Context, input *DeployProjectInput) (*huma.StreamResponse, error)
- func (h *ProjectHandler) DestroyProject(ctx context.Context, input *DestroyProjectInput) (*DestroyProjectOutput, error)
- func (h *ProjectHandler) DownProject(ctx context.Context, input *DownProjectInput) (*DownProjectOutput, error)
- func (h *ProjectHandler) DownloadProjectWorkspaceFile(ctx context.Context, input *GetProjectWorkspaceFileInput) (*huma.StreamResponse, error)
- func (h *ProjectHandler) GetProject(ctx context.Context, input *GetProjectInput) (*GetProjectOutput, error)
- func (h *ProjectHandler) GetProjectCompose(ctx context.Context, input *GetProjectInput) (*GetProjectOutput, error)
- func (h *ProjectHandler) GetProjectRuntime(ctx context.Context, input *GetProjectInput) (*GetProjectOutput, error)
- func (h *ProjectHandler) GetProjectStatusCounts(ctx context.Context, input *GetProjectStatusCountsInput) (*GetProjectStatusCountsOutput, error)
- func (h *ProjectHandler) GetProjectUpdates(ctx context.Context, input *GetProjectInput) (*GetProjectOutput, error)
- func (h *ProjectHandler) GetProjectWorkspace(ctx context.Context, input *GetProjectWorkspaceInput) (*GetProjectWorkspaceOutput, error)
- func (h *ProjectHandler) GetProjectWorkspaceFile(ctx context.Context, input *GetProjectWorkspaceFileInput) (*GetProjectWorkspaceFileOutput, error)
- func (h *ProjectHandler) ListProjectTags(ctx context.Context, _ *ListProjectTagsInput) (*ListProjectTagsOutput, error)
- func (h *ProjectHandler) ListProjects(ctx context.Context, input *ListProjectsInput) (*ListProjectsOutput, error)
- func (h *ProjectHandler) PullProjectImages(ctx context.Context, input *PullProjectImagesInput) (*huma.StreamResponse, error)
- func (h *ProjectHandler) RedeployProject(ctx context.Context, input *RedeployProjectInput) (*huma.StreamResponse, error)
- func (h *ProjectHandler) RestartProject(ctx context.Context, input *RestartProjectInput) (*RestartProjectOutput, error)
- func (h *ProjectHandler) UnarchiveProject(ctx context.Context, input *UnarchiveProjectInput) (*UnarchiveProjectOutput, error)
- func (h *ProjectHandler) UpdateProject(ctx context.Context, input *UpdateProjectInput) (*UpdateProjectOutput, error)
- func (h *ProjectHandler) UpdateProjectServices(ctx context.Context, input *UpdateProjectServicesInput) (*UpdateProjectServicesOutput, error)
- func (h *ProjectHandler) UpdateProjectTag(ctx context.Context, input *UpdateProjectTagInput) (*UpdateProjectTagOutput, error)
- func (h *ProjectHandler) UpdateProjectWorkspace(ctx context.Context, input *UpdateProjectWorkspaceInput) (*UpdateProjectWorkspaceOutput, error)
- type ProjectService
- func (s *ProjectService) ApplyGitSyncEnvToDirectory(ctx context.Context, projectPath, projectsDirectory string, ...) (before, after string, err error)
- func (s *ProjectService) ApplyGitSyncProjectFiles(ctx context.Context, projectID string, composeContent string, ...) (*Project, error)
- func (s *ProjectService) ArchiveProject(ctx context.Context, projectID string, user common.User) error
- func (s *ProjectService) BackfillProjectImageRefs(ctx context.Context) (int, error)
- func (s *ProjectService) BuildProjectServices(ctx context.Context, projectID string, options ProjectBuildOptions, ...) error
- func (s *ProjectService) CountProjectsWithPendingUpdates(ctx context.Context, allContainers []container.Summary) (int, error)
- func (s *ProjectService) CountServicesFromCompose(ctx context.Context, p Project) (int, error)
- func (s *ProjectService) CreateGitOpsManagedProject(ctx context.Context, sync *GitOpsSync, project *Project, actor common.User, ...) error
- func (s *ProjectService) CreateProject(ctx context.Context, name, composeContent string, envContent *string, ...) (*Project, error)
- func (s *ProjectService) DeployProject(ctx context.Context, projectID string, user common.User, ...) error
- func (s *ProjectService) DestroyProject(ctx context.Context, projectID string, removeFiles bool, removeVolumes bool, ...) error
- func (s *ProjectService) DownProject(ctx context.Context, projectID string, user common.User) error
- func (s *ProjectService) DownloadProjectWorkspaceFile(ctx context.Context, projectID, relativePath string) (io.ReadCloser, int64, string, error)
- func (s *ProjectService) EnsureGitOpsProjectLinked(ctx context.Context, sync *GitOpsSync, project *Project) error
- func (s *ProjectService) EnsureProjectImagesPresent(ctx context.Context, projectID string, progressWriter io.Writer, ...) error
- func (s *ProjectService) EnsureProjectPathUnderRoot(ctx context.Context, proj *Project, persist bool) error
- func (s *ProjectService) GetProjectByComposeName(ctx context.Context, name string) (*Project, error)
- func (s *ProjectService) GetProjectContent(ctx context.Context, projectID string) (composeContent, envContent, overrideContent string, err error)
- func (s *ProjectService) GetProjectDetails(ctx context.Context, projectID string, opts project.DetailsOptions) (project.Details, error)
- func (s *ProjectService) GetProjectFromDatabaseByID(ctx context.Context, id string) (*Project, error)
- func (s *ProjectService) GetProjectRelativePath(ctx context.Context, projectPath string) string
- func (s *ProjectService) GetProjectServices(ctx context.Context, projectID string) ([]ProjectServiceInfo, error)
- func (s *ProjectService) GetProjectStatusCounts(ctx context.Context) (...)
- func (s *ProjectService) GetProjectTags(ctx context.Context, projectID string) ([]projecttypes.Tag, error)
- func (s *ProjectService) GetProjectWorkspace(ctx context.Context, projectID string) (*workspacetypes.Workspace, error)
- func (s *ProjectService) GetProjectWorkspaceFile(ctx context.Context, projectID, relativePath string) (*workspacetypes.FileContent, error)
- func (s *ProjectService) GetProjectsDirectory(ctx context.Context) (string, error)
- func (s *ProjectService) HandleProjectFilesChanged(ctx context.Context, paths []string)
- func (s *ProjectService) ListAllProjects(ctx context.Context) ([]Project, error)
- func (s *ProjectService) ListProjectTagOptions(ctx context.Context) ([]projecttypes.TagOption, error)
- func (s *ProjectService) ListProjects(ctx context.Context, params pagination.QueryParams) ([]project.Details, pagination.Response, error)
- func (s *ProjectService) ProjectMetadata(ctx context.Context, p Project, env *projectMetadataEnvInternal) projects.ArcaneComposeMetadata
- func (s *ProjectService) PullProjectImages(ctx context.Context, projectID string, progressWriter io.Writer, ...) error
- func (s *ProjectService) RecoverProjectRenameJournals(ctx context.Context) error
- func (s *ProjectService) RedeployProject(ctx context.Context, projectID string, user common.User, ...) error
- func (s *ProjectService) ResolveProjectComposeFile(ctx context.Context, proj *Project) (string, error)
- func (s *ProjectService) ResolveRegistryCredentials(ctx context.Context) ([]containerregistry.Credential, error)
- func (s *ProjectService) RestartProject(ctx context.Context, projectID string, services []string, user common.User) error
- func (s *ProjectService) StreamProjectLogs(ctx context.Context, projectID string, logsChan chan<- string, follow bool, ...) error
- func (s *ProjectService) SyncProjectsFromFileSystem(ctx context.Context) error
- func (s *ProjectService) UnarchiveProject(ctx context.Context, projectID string, user common.User) error
- func (s *ProjectService) UpdateProject(ctx context.Context, projectID string, name *string, ...) (*Project, error)
- func (s *ProjectService) UpdateProjectServices(ctx context.Context, projectID string, servicesToUpdate []string, ...) error
- func (s *ProjectService) UpdateProjectTag(ctx context.Context, projectID, name string, color projecttypes.TagColor, ...) ([]projecttypes.Tag, error)
- func (s *ProjectService) UpdateProjectWorkspace(ctx context.Context, projectID string, ...) (*workspacetypes.Workspace, error)
- func (s *ProjectService) ValidateComposeDirectory(ctx context.Context, projectName, projectPath, composeFileName string) (int, error)
- func (s *ProjectService) WithKVService(kvService *kv.KVService) *ProjectService
- func (s *ProjectService) WithRegistryCredentialsProvider(provider func(context.Context) ([]containerregistry.Credential, error)) *ProjectService
- type ProjectServiceInfo
- type ProjectStatus
- type ProjectTag
- type PullProjectImagesInput
- type RedeployProjectInput
- type RestartProjectInput
- type RestartProjectOutput
- type UnarchiveProjectInput
- type UnarchiveProjectOutput
- type UpdateProjectInput
- type UpdateProjectOutput
- type UpdateProjectServicesInput
- type UpdateProjectServicesOutput
- type UpdateProjectTagInput
- type UpdateProjectTagOutput
- type UpdateProjectWorkspaceInput
- type UpdateProjectWorkspaceOutput
Constants ¶
const ( // DefaultTimeoutSec is used when a sync has no per-sync timeout // configured. DefaultTimeoutSec = 60 // DefaultMaxTimeoutSec mirrors the settings default so callers // always have a sane upper bound even if settings can't be loaded. DefaultMaxTimeoutSec = 300 )
Lifecycle hook configuration limits and conventions.
Variables ¶
This section is empty.
Functions ¶
func IconCatalogForContext ¶
IconCatalogForContext resolves the icon catalog of the requesting user. On agent-proxied calls the caller is a synthetic user whose preference is populated from the X-Arcane-Icon-Catalog header the manager forwards. Background jobs have no user attached and fall back to the default catalog.
func ParseEnvText ¶ added in v2.8.1
ParseEnvText reads admin-configured env config as the same KEY=VALUE text format used by .env files: one entry per line, blank and "#"-prefixed lines ignored, keys must match POSIX identifier syntax. Reuses the strict parser also used for stdout-capture.
func ParseExtraMountsText ¶ added in v2.8.1
func ParseExtraMountsText(raw *string) ([]lifecycletype.ExtraMount, error)
ParseExtraMountsText reads admin-configured bind mounts in docker-CLI "src:tgt[:ro|:rw]" form, one per line. Blank and "#"-prefixed lines are ignored. Both source and target must be absolute paths; mode defaults to read-write.
func RegisterProjects ¶
func RegisterProjects(api huma.API, projectService *ProjectService, activityService *activity.ActivityService, appCtx handlerutil.ActivityAppContext)
RegisterProjects registers project management routes using Huma. WebSocket and streaming endpoints live in api/ws.
Types ¶
type ArchiveProjectInput ¶
type ArchiveProjectOutput ¶
type ArchiveProjectOutput struct {
Body base.ApiResponse[base.MessageResponse]
}
type BuildProjectInput ¶
type BuildProjectInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
ProjectID string `path:"projectId" doc:"Project ID"`
Body *struct {
Services []string `json:"services,omitempty" doc:"Service names to build"`
Provider string `json:"provider,omitempty" doc:"Build provider override"`
Push *bool `json:"push,omitempty" doc:"Push images"`
Load *bool `json:"load,omitempty" doc:"Load images into Docker"`
}
}
type CreateProjectInput ¶
type CreateProjectOutput ¶
type CreateProjectOutput struct {
Body base.ApiResponse[project.CreateReponse]
}
type DeployProjectInput ¶
type DeployProjectInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
ProjectID string `path:"projectId" doc:"Project ID"`
Body *project.DeployOptions
}
type DeployProjectOutput ¶
type DeployProjectOutput struct {
Body base.ApiResponse[base.MessageResponse]
}
type DestroyProjectInput ¶
type DestroyProjectOutput ¶
type DestroyProjectOutput struct {
Body base.ApiResponse[base.MessageResponse]
}
type DownProjectInput ¶
type DownProjectOutput ¶
type DownProjectOutput struct {
Body base.ApiResponse[base.MessageResponse]
}
type GetProjectInput ¶
type GetProjectOutput ¶
type GetProjectOutput struct {
Body base.ApiResponse[project.Details]
}
type GetProjectStatusCountsInput ¶
type GetProjectStatusCountsInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
}
type GetProjectStatusCountsOutput ¶
type GetProjectStatusCountsOutput struct {
Body base.ApiResponse[project.StatusCounts]
}
type GetProjectWorkspaceFileOutput ¶
type GetProjectWorkspaceFileOutput struct {
Body base.ApiResponse[workspacetypes.FileContent]
}
type GetProjectWorkspaceOutput ¶
type GetProjectWorkspaceOutput struct {
Body base.ApiResponse[workspacetypes.Workspace]
}
type GitOpsSync ¶ added in v2.8.1
type GitOpsSync struct {
database.BaseModel
Environment *environment.Environment `json:"environment,omitempty" gorm:"foreignKey:EnvironmentID"`
Repository *gitrepo.GitRepository `json:"repository,omitempty" gorm:"foreignKey:RepositoryID"`
ProjectID *string `json:"projectId,omitempty" sortable:"true"` // Set after project is created
Project *Project `json:"project,omitempty" gorm:"foreignKey:ProjectID"`
SyncedFiles *string `json:"syncedFiles,omitempty" gorm:"column:synced_files"` // JSON array of synced file paths
LastSyncAt *time.Time `json:"lastSyncAt,omitempty" sortable:"true"`
LastSyncStatus *string `json:"lastSyncStatus,omitempty" search:"status,success,failed,pending,error"`
LastSyncError *string `json:"lastSyncError,omitempty"`
LastSyncCommit *string `json:"lastSyncCommit,omitempty" search:"commit,hash,sha,revision"`
// Pre-deploy lifecycle hook (configuration)
// When PreDeployScriptPath is set, the named script is executed in a
// throwaway container before each deploy of the linked project. The script,
// runner image, and execution context together act as repo-trusted code —
// any push to the repo that changes the script will run unreviewed on the
// next deploy. See docs for details.
PreDeployScriptPath *string `json:"preDeployScriptPath,omitempty" gorm:"column:pre_deploy_script_path" search:"lifecycle,hook,pre-deploy,script,path"`
PreDeployRunnerImage *string `json:"preDeployRunnerImage,omitempty" gorm:"column:pre_deploy_runner_image"`
PreDeployEnv *string `json:"preDeployEnv,omitempty" gorm:"column:pre_deploy_env"` // KEY=VALUE lines, one per line; same format as .env files
PreDeployExtraMounts *string `json:"preDeployExtraMounts,omitempty" gorm:"column:pre_deploy_extra_mounts"` // docker -v style "src:tgt[:ro|:rw]" entries, one per line
// Pre-deploy lifecycle hook (last-run state)
PreDeployLastRunAt *time.Time `json:"preDeployLastRunAt,omitempty" gorm:"column:pre_deploy_last_run_at" sortable:"true"`
PreDeployLastRunStatus *string `json:"preDeployLastRunStatus,omitempty" gorm:"column:pre_deploy_last_run_status" sortable:"true"` // "success" | "failed" | "timeout"
PreDeployLastRunOutput *string `json:"preDeployLastRunOutput,omitempty" gorm:"column:pre_deploy_last_run_output"` // truncated stdout+stderr
Name string `json:"name" sortable:"true" search:"sync,gitops,automation,deploy,deployment,continuous"`
EnvironmentID string `json:"environmentId" sortable:"true"`
RepositoryID string `json:"repositoryId" sortable:"true"`
Branch string `json:"branch" sortable:"true" search:"branch,main,master,develop,feature,release"`
ComposePath string `json:"composePath" sortable:"true" search:"compose,docker-compose,path,file,yaml,yml"`
TargetType string `json:"targetType" gorm:"column:target_type;default:'project'"` // "project" or "swarm_stack"
ProjectName string `json:"projectName" sortable:"true" search:"project,name,stack,application,service"` // Name of project to create/update
PreDeployNetworkMode string `json:"preDeployNetworkMode" gorm:"column:pre_deploy_network_mode;default:'none'"` // Docker network mode passed to the runner container. Default "none" denies network access; set to "bridge", "host", or a named network when the script needs it.
SyncInterval int `json:"syncInterval" sortable:"true" search:"interval,frequency,schedule,cron,minutes"` // in minutes
MaxSyncFiles int `json:"maxSyncFiles" gorm:"column:max_sync_files;default:500"` // 0 = unlimited; env var overrides take precedence
MaxSyncTotalSize int64 `json:"maxSyncTotalSize" gorm:"column:max_sync_total_size;default:52428800"` // bytes; 0 = unlimited; env var overrides take precedence
MaxSyncBinarySize int64 `json:"maxSyncBinarySize" gorm:"column:max_sync_binary_size;default:10485760"` // bytes; 0 = unlimited; env var overrides take precedence
PreDeployTimeoutSec int `json:"preDeployTimeoutSec" gorm:"column:pre_deploy_timeout_sec;default:60"`
AutoSync bool `json:"autoSync" sortable:"true" search:"auto,automatic,sync,continuous,scheduled"`
SyncDirectory bool `json:"syncDirectory" gorm:"column:sync_directory"` // Sync entire directory containing compose file
}
func (GitOpsSync) TableName ¶ added in v2.8.1
func (GitOpsSync) TableName() string
type LifecycleService ¶ added in v2.8.1
type LifecycleService struct {
// contains filtered or unexported fields
}
LifecycleService runs pre-deploy lifecycle hooks declared on a project's GitOps sync. A hook is a script in the synced repo executed in a throwaway container immediately before the project is deployed, with optional capture of stdout as environment variables merged into the compose env.
Trust model: the script is repo-trusted code, equivalent to compose.yaml in the same repo. Anyone who can push to that repo can change what the script does on the next deploy. The trust event is configuring a script path on the GitOps sync, not each individual deploy.
func NewLifecycleService ¶ added in v2.8.1
func NewLifecycleService(db *database.DB, settingsService *settings.SettingsService, eventService *event.EventService, dockerService *docker.DockerClientService) *LifecycleService
NewLifecycleService constructs a LifecycleService wired against shared infrastructure. The Docker client is obtained lazily on each hook run via dockerService.GetClient so reconnects are transparent.
func (*LifecycleService) RunPreDeploy ¶ added in v2.8.1
func (s *LifecycleService) RunPreDeploy(ctx context.Context, project *Project, actor common.User) error
RunPreDeploy executes the pre-deploy lifecycle hook for a project, if one is configured on its GitOps sync.
Callers should invoke this unconditionally before deploying — when no hook is configured, when lifecycle hooks are disabled globally, or when the project is not GitOps-managed, this is a no-op and returns nil.
A non-zero exit code, a script timeout, or any infrastructure failure returns an error that aborts the deploy. The last-run state on the GitOpsSync row is updated on every invocation that reaches the run step, regardless of outcome.
type ListProjectTagsInput ¶
type ListProjectTagsInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
}
ListProjectTagsInput identifies the environment whose tag catalog is requested.
type ListProjectTagsOutput ¶
type ListProjectTagsOutput struct {
Body base.ApiResponse[[]project.TagOption]
}
ListProjectTagsOutput contains the environment's distinct project tag options.
type ListProjectsInput ¶
type ListProjectsInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
Search string `query:"search" doc:"Search query"`
Sort string `query:"sort" doc:"Column to sort by"`
Order string `query:"order" default:"asc" doc:"Sort direction (asc or desc)"`
Start int `query:"start" default:"0" doc:"Start index for pagination"`
Limit int `query:"limit" default:"20" doc:"Number of items per page"`
Status string `query:"status" doc:"Filter by status (comma-separated: running,stopped,partially running)"`
Updates string `query:"updates" doc:"Filter by update status (has_update, up_to_date, error, unknown)"`
Archived string `query:"archived" doc:"Archived filter: 'true' (only archived), 'all' (include archived). Default excludes archived."`
Tags string `query:"tags" doc:"Filter by tag names (comma-separated, OR semantics)"`
}
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
func New ¶
func New(service *ProjectService, activityService *activity.ActivityService) *Module
func (*Module) RegisterRoutes ¶
func (m *Module) RegisterRoutes(api huma.API, appCtx handlerutil.ActivityAppContext)
func (*Module) Service ¶
func (m *Module) Service() *ProjectService
type Project ¶ added in v2.8.1
type Project struct {
database.BaseModel
Name string `json:"name" sortable:"true" gorm:"index:idx_projects_name"`
DirName *string `json:"dir_name"`
Path string `json:"path" sortable:"true" gorm:"uniqueIndex"`
Status ProjectStatus `json:"status" sortable:"true"`
StatusReason *string `json:"status_reason"`
ServiceCount int `json:"service_count" sortable:"true"`
RunningCount int `json:"running_count" sortable:"true"`
GitOpsManagedBy *string `json:"gitops_managed_by,omitempty" gorm:"column:gitops_managed_by"`
ComposeProjectName *string `json:"compose_project_name,omitempty" gorm:"column:compose_project_name"`
ImageRefsJSON string `json:"image_refs_json,omitempty" gorm:"column:image_refs_json"`
BuildImageRefsJSON *string `json:"-" gorm:"column:build_image_refs_json"`
IsArchived bool `json:"is_archived" gorm:"column:is_archived;default:false;index"`
ArchivedAt *time.Time `json:"archived_at,omitempty" gorm:"column:archived_at"`
}
type ProjectBuildOptions ¶
type ProjectHandler ¶
type ProjectHandler struct {
// contains filtered or unexported fields
}
ProjectHandler provides Huma-based project management endpoints.
func (*ProjectHandler) ArchiveProject ¶
func (h *ProjectHandler) ArchiveProject(ctx context.Context, input *ArchiveProjectInput) (*ArchiveProjectOutput, error)
func (*ProjectHandler) BuildProjectImages ¶
func (h *ProjectHandler) BuildProjectImages(ctx context.Context, input *BuildProjectInput) (*huma.StreamResponse, error)
BuildProjectImages builds compose services with build directives.
func (*ProjectHandler) CreateProject ¶
func (h *ProjectHandler) CreateProject(ctx context.Context, input *CreateProjectInput) (*CreateProjectOutput, error)
CreateProject creates a new Docker Compose project.
func (*ProjectHandler) DeployProject ¶
func (h *ProjectHandler) DeployProject(ctx context.Context, input *DeployProjectInput) (*huma.StreamResponse, error)
func (*ProjectHandler) DestroyProject ¶
func (h *ProjectHandler) DestroyProject(ctx context.Context, input *DestroyProjectInput) (*DestroyProjectOutput, error)
DestroyProject destroys a Docker Compose project.
func (*ProjectHandler) DownProject ¶
func (h *ProjectHandler) DownProject(ctx context.Context, input *DownProjectInput) (*DownProjectOutput, error)
DownProject brings down a Docker Compose project.
func (*ProjectHandler) DownloadProjectWorkspaceFile ¶
func (h *ProjectHandler) DownloadProjectWorkspaceFile(ctx context.Context, input *GetProjectWorkspaceFileInput) (*huma.StreamResponse, error)
func (*ProjectHandler) GetProject ¶
func (h *ProjectHandler) GetProject(ctx context.Context, input *GetProjectInput) (*GetProjectOutput, error)
GetProject returns a project by ID.
func (*ProjectHandler) GetProjectCompose ¶
func (h *ProjectHandler) GetProjectCompose(ctx context.Context, input *GetProjectInput) (*GetProjectOutput, error)
func (*ProjectHandler) GetProjectRuntime ¶
func (h *ProjectHandler) GetProjectRuntime(ctx context.Context, input *GetProjectInput) (*GetProjectOutput, error)
func (*ProjectHandler) GetProjectStatusCounts ¶
func (h *ProjectHandler) GetProjectStatusCounts(ctx context.Context, input *GetProjectStatusCountsInput) (*GetProjectStatusCountsOutput, error)
GetProjectStatusCounts returns counts of projects by status.
func (*ProjectHandler) GetProjectUpdates ¶
func (h *ProjectHandler) GetProjectUpdates(ctx context.Context, input *GetProjectInput) (*GetProjectOutput, error)
func (*ProjectHandler) GetProjectWorkspace ¶
func (h *ProjectHandler) GetProjectWorkspace(ctx context.Context, input *GetProjectWorkspaceInput) (*GetProjectWorkspaceOutput, error)
func (*ProjectHandler) GetProjectWorkspaceFile ¶
func (h *ProjectHandler) GetProjectWorkspaceFile(ctx context.Context, input *GetProjectWorkspaceFileInput) (*GetProjectWorkspaceFileOutput, error)
func (*ProjectHandler) ListProjectTags ¶
func (h *ProjectHandler) ListProjectTags(ctx context.Context, _ *ListProjectTagsInput) (*ListProjectTagsOutput, error)
ListProjectTags returns the reusable project tag catalog for an environment.
func (*ProjectHandler) ListProjects ¶
func (h *ProjectHandler) ListProjects(ctx context.Context, input *ListProjectsInput) (*ListProjectsOutput, error)
ListProjects returns a paginated list of projects.
func (*ProjectHandler) PullProjectImages ¶
func (h *ProjectHandler) PullProjectImages(ctx context.Context, input *PullProjectImagesInput) (*huma.StreamResponse, error)
PullProjectImages pulls all images for a project with streaming progress.
func (*ProjectHandler) RedeployProject ¶
func (h *ProjectHandler) RedeployProject(ctx context.Context, input *RedeployProjectInput) (*huma.StreamResponse, error)
RedeployProject redeploys a Docker Compose project. RedeployProject pulls project images and re-deploys, streaming the raw docker CLI output as NDJSON like DeployProject.
func (*ProjectHandler) RestartProject ¶
func (h *ProjectHandler) RestartProject(ctx context.Context, input *RestartProjectInput) (*RestartProjectOutput, error)
RestartProject restarts the given services in a project (all services when none are specified).
func (*ProjectHandler) UnarchiveProject ¶
func (h *ProjectHandler) UnarchiveProject(ctx context.Context, input *UnarchiveProjectInput) (*UnarchiveProjectOutput, error)
func (*ProjectHandler) UpdateProject ¶
func (h *ProjectHandler) UpdateProject(ctx context.Context, input *UpdateProjectInput) (*UpdateProjectOutput, error)
UpdateProject updates a Docker Compose project.
func (*ProjectHandler) UpdateProjectServices ¶
func (h *ProjectHandler) UpdateProjectServices(ctx context.Context, input *UpdateProjectServicesInput) (*UpdateProjectServicesOutput, error)
UpdateProjectServices pulls the latest images for the given services and recreates them.
func (*ProjectHandler) UpdateProjectTag ¶
func (h *ProjectHandler) UpdateProjectTag(ctx context.Context, input *UpdateProjectTagInput) (*UpdateProjectTagOutput, error)
UpdateProjectTag applies one UI-managed project tag association change.
func (*ProjectHandler) UpdateProjectWorkspace ¶
func (h *ProjectHandler) UpdateProjectWorkspace(ctx context.Context, input *UpdateProjectWorkspaceInput) (*UpdateProjectWorkspaceOutput, error)
type ProjectService ¶
type ProjectService struct {
// contains filtered or unexported fields
}
func NewProjectService ¶
func NewProjectService(db *database.DB, settingsService *settings.SettingsService, eventService *event.EventService, imageService *image.ImageService, dockerService *docker.DockerClientService, buildService buildServiceInternal, lifecycleService *LifecycleService, containerRegistryService *registry.ContainerRegistryService, cfg *config.Config) *ProjectService
func (*ProjectService) ApplyGitSyncEnvToDirectory ¶
func (s *ProjectService) ApplyGitSyncEnvToDirectory(ctx context.Context, projectPath, projectsDirectory string, gitEnvContent *string) (before, after string, err error)
ApplyGitSyncEnvToDirectory applies the same managed three-file environment merge used by single-file project syncs and returns the effective content before and after the update.
func (*ProjectService) ApplyGitSyncProjectFiles ¶
func (*ProjectService) ArchiveProject ¶
func (*ProjectService) BackfillProjectImageRefs ¶
func (s *ProjectService) BackfillProjectImageRefs(ctx context.Context) (int, error)
func (*ProjectService) BuildProjectServices ¶
func (s *ProjectService) BuildProjectServices(ctx context.Context, projectID string, options ProjectBuildOptions, progressWriter io.Writer, user *common.User) error
func (*ProjectService) CountProjectsWithPendingUpdates ¶
func (s *ProjectService) CountProjectsWithPendingUpdates(ctx context.Context, allContainers []container.Summary) (int, error)
CountProjectsWithPendingUpdates counts non-archived projects with at least one image update pending, plus compose projects running on the daemon that Arcane does not track. It deliberately avoids the project-list pipeline: that path builds full project DTOs (live status, icons, URLs, GitOps lookups) and then throws all of them away for a single number, costing several full container lists and a compose parse per project on every dashboard load.
allContainers is the caller's already-fetched container list; pass nil to have it fetched here.
func (*ProjectService) CountServicesFromCompose ¶
func (*ProjectService) CreateGitOpsManagedProject ¶
func (s *ProjectService) CreateGitOpsManagedProject(ctx context.Context, sync *GitOpsSync, project *Project, actor common.User, logEventOptions ...bool) error
CreateGitOpsManagedProject persists a promoted GitOps project, links both records, updates the compose-name cache, and records the creation event.
func (*ProjectService) CreateProject ¶
func (s *ProjectService) CreateProject(ctx context.Context, name, composeContent string, envContent *string, manifest project.CreateProjectWorkspaceManifest, uploads map[int][]byte, uiTags []string, uiTagColors map[string]project.TagColor, user common.User, allowNameSuffixOptions ...bool) (*Project, error)
CreateProject creates a project's directory, files, and DB row. When allowNameSuffix is true a directory-name collision is resolved by appending "-N" (the interactive default). When false a collision returns projects.ErrProjectDirExists (wrapped) so GitOps creates fail loudly instead of minting runaway "-N" duplicate projects on a broken binding.
func (*ProjectService) DeployProject ¶
func (s *ProjectService) DeployProject(ctx context.Context, projectID string, user common.User, options *project.DeployOptions) error
func (*ProjectService) DestroyProject ¶
func (*ProjectService) DownProject ¶
func (*ProjectService) DownloadProjectWorkspaceFile ¶
func (s *ProjectService) DownloadProjectWorkspaceFile(ctx context.Context, projectID, relativePath string) (io.ReadCloser, int64, string, error)
func (*ProjectService) EnsureGitOpsProjectLinked ¶
func (s *ProjectService) EnsureGitOpsProjectLinked(ctx context.Context, sync *GitOpsSync, project *Project) error
EnsureGitOpsProjectLinked persists the bidirectional GitOps/project binding and refreshes the compose-name cache as one domain operation.
func (*ProjectService) EnsureProjectImagesPresent ¶
func (s *ProjectService) EnsureProjectImagesPresent(ctx context.Context, projectID string, progressWriter io.Writer, user common.User, 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) EnsureProjectPathUnderRoot ¶
func (s *ProjectService) EnsureProjectPathUnderRoot(ctx context.Context, proj *Project, persist bool) error
EnsureProjectPathUnderRoot validates that the project's path is a safe subdirectory of the configured projects root. If not, it normalizes the path to `<projectsRoot>/<dirName or sanitized project name>`. When persist=true, it saves the updated project path to the database.
func (*ProjectService) GetProjectByComposeName ¶
func (*ProjectService) GetProjectContent ¶
func (*ProjectService) GetProjectDetails ¶
func (s *ProjectService) GetProjectDetails(ctx context.Context, projectID string, opts project.DetailsOptions) (project.Details, error)
func (*ProjectService) GetProjectFromDatabaseByID ¶
func (*ProjectService) GetProjectRelativePath ¶
func (s *ProjectService) GetProjectRelativePath(ctx context.Context, projectPath string) string
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, archivedProjects int, err error)
func (*ProjectService) GetProjectTags ¶
func (s *ProjectService) GetProjectTags(ctx context.Context, projectID string) ([]projecttypes.Tag, error)
GetProjectTags returns the effective UI and Compose tag associations for a project.
func (*ProjectService) GetProjectWorkspace ¶
func (s *ProjectService) GetProjectWorkspace(ctx context.Context, projectID string) (*workspacetypes.Workspace, error)
func (*ProjectService) GetProjectWorkspaceFile ¶
func (s *ProjectService) GetProjectWorkspaceFile(ctx context.Context, projectID, relativePath string) (*workspacetypes.FileContent, error)
func (*ProjectService) GetProjectsDirectory ¶
func (s *ProjectService) GetProjectsDirectory(ctx context.Context) (string, error)
func (*ProjectService) HandleProjectFilesChanged ¶
func (s *ProjectService) HandleProjectFilesChanged(ctx context.Context, paths []string)
func (*ProjectService) ListAllProjects ¶
func (s *ProjectService) ListAllProjects(ctx context.Context) ([]Project, error)
func (*ProjectService) ListProjectTagOptions ¶
func (s *ProjectService) ListProjectTagOptions(ctx context.Context) ([]projecttypes.TagOption, error)
ListProjectTagOptions returns the distinct tag names and colors available in the current environment.
func (*ProjectService) ListProjects ¶
func (s *ProjectService) ListProjects(ctx context.Context, params pagination.QueryParams) ([]project.Details, pagination.Response, error)
func (*ProjectService) ProjectMetadata ¶
func (s *ProjectService) ProjectMetadata(ctx context.Context, p Project, env *projectMetadataEnvInternal) projects.ArcaneComposeMetadata
ProjectMetadata resolves a project's icon sets and service URLs. Results are cached for projectMetadataTTL because deriving them is expensive (compose load with interpolation and .env reads, plus a gitops_syncs query for GitOps-managed projects) and every project row on the list page needs it.
env may be nil, in which case the projects directory and autoInjectEnv setting are resolved here; callers iterating over many projects should resolve them once and pass them in.
func (*ProjectService) PullProjectImages ¶
func (s *ProjectService) PullProjectImages(ctx context.Context, projectID string, progressWriter io.Writer, user common.User, credentials []containerregistry.Credential) error
func (*ProjectService) RecoverProjectRenameJournals ¶
func (s *ProjectService) RecoverProjectRenameJournals(ctx context.Context) error
func (*ProjectService) RedeployProject ¶
func (s *ProjectService) RedeployProject(ctx context.Context, projectID string, user common.User, options *project.DeployOptions) error
func (*ProjectService) ResolveProjectComposeFile ¶
func (*ProjectService) ResolveRegistryCredentials ¶
func (s *ProjectService) ResolveRegistryCredentials(ctx context.Context) ([]containerregistry.Credential, error)
func (*ProjectService) RestartProject ¶
func (*ProjectService) StreamProjectLogs ¶
func (*ProjectService) SyncProjectsFromFileSystem ¶
func (s *ProjectService) SyncProjectsFromFileSystem(ctx context.Context) error
func (*ProjectService) UnarchiveProject ¶
func (*ProjectService) UpdateProject ¶
func (*ProjectService) UpdateProjectServices ¶
func (*ProjectService) UpdateProjectTag ¶
func (s *ProjectService) UpdateProjectTag(ctx context.Context, projectID, name string, color projecttypes.TagColor, attached bool, user common.User) ([]projecttypes.Tag, error)
UpdateProjectTag attaches or detaches a UI-managed tag and rejects Compose-owned names.
func (*ProjectService) UpdateProjectWorkspace ¶
func (s *ProjectService) UpdateProjectWorkspace(ctx context.Context, projectID string, manifest projecttypes.WorkspaceUpdateManifest, uploads map[int][]byte, user common.User) (*workspacetypes.Workspace, error)
func (*ProjectService) ValidateComposeDirectory ¶
func (s *ProjectService) ValidateComposeDirectory(ctx context.Context, projectName, projectPath, composeFileName string) (int, error)
ValidateComposeDirectory loads a staged compose tree with the same settings, Docker path mapping, and validation rules used by managed projects.
func (*ProjectService) WithKVService ¶
func (s *ProjectService) WithKVService(kvService *kv.KVService) *ProjectService
func (*ProjectService) WithRegistryCredentialsProvider ¶
func (s *ProjectService) WithRegistryCredentialsProvider(provider func(context.Context) ([]containerregistry.Credential, error)) *ProjectService
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"`
IconLightURL string `json:"icon_light_url,omitempty"`
IconDarkURL string `json:"icon_dark_url,omitempty"`
ServiceConfig *composetypes.ServiceConfig `json:"service_config,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
RedeployDisabled bool `json:"redeploy_disabled,omitempty"`
}
type ProjectStatus ¶ added in v2.8.1
type ProjectStatus string
const ( ProjectStatusRunning ProjectStatus = "running" ProjectStatusStopped ProjectStatus = "stopped" ProjectStatusPartiallyRunning ProjectStatus = "partially running" ProjectStatusUnknown ProjectStatus = "unknown" ProjectStatusDeploying ProjectStatus = "deploying" ProjectStatusStopping ProjectStatus = "stopping" ProjectStatusRestarting ProjectStatus = "restarting" )
type ProjectTag ¶ added in v2.8.1
type ProjectTag struct {
ProjectID string `json:"projectId" gorm:"column:project_id;primaryKey"`
Name string `json:"name" gorm:"column:name;primaryKey"`
Source string `json:"source" gorm:"column:source;primaryKey"`
Color string `json:"color" gorm:"column:color;not null;default:gray"`
}
ProjectTag stores one normalized tag association and its management source.
func (ProjectTag) TableName ¶ added in v2.8.1
func (ProjectTag) TableName() string
TableName returns the database table used for project tag associations.
type PullProjectImagesInput ¶
type RedeployProjectInput ¶
type RedeployProjectInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
ProjectID string `path:"projectId" doc:"Project ID"`
Body *project.DeployOptions
}
type RestartProjectInput ¶
type RestartProjectOutput ¶
type RestartProjectOutput struct {
Body base.ApiResponse[base.MessageResponse]
}
type UnarchiveProjectInput ¶
type UnarchiveProjectOutput ¶
type UnarchiveProjectOutput struct {
Body base.ApiResponse[base.MessageResponse]
}
type UpdateProjectInput ¶
type UpdateProjectInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
ProjectID string `path:"projectId" doc:"Project ID"`
Body project.UpdateProject
}
type UpdateProjectOutput ¶
type UpdateProjectOutput struct {
Body base.ApiResponse[project.Details]
}
type UpdateProjectServicesOutput ¶
type UpdateProjectServicesOutput struct {
Body base.ApiResponse[base.MessageResponse]
}
type UpdateProjectTagInput ¶
type UpdateProjectTagInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
ProjectID string `path:"projectId" doc:"Project ID"`
Body project.UpdateTag
}
UpdateProjectTagInput identifies a project and the UI tag mutation to apply.
type UpdateProjectTagOutput ¶
type UpdateProjectTagOutput struct {
Body base.ApiResponse[project.UpdateTagResponse]
}
UpdateProjectTagOutput contains the project's effective tags after mutation.
type UpdateProjectWorkspaceOutput ¶
type UpdateProjectWorkspaceOutput struct {
Body base.ApiResponse[workspacetypes.Workspace]
}