A self-hosted orchestration system crafted for power users. composia.xyz
Something went wrong. Try again.
Go
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136package task
import "time"
type Type string
const ( TypeDeploy Type = "deploy" TypeStop Type = "stop" TypeRestart Type = "restart" TypeUpdate Type = "update" TypeBackup Type = "backup" TypeRestore Type = "restore" TypeMigrate Type = "migrate" TypeDNSUpdate Type = "dns_update" TypeCloudflareTunnelSync Type = "cloudflare_tunnel_sync" TypeCaddySync Type = "caddy_sync" TypeCaddyReload Type = "caddy_reload" TypeImageCheck Type = "image_check" TypePrune Type = "prune" TypeRusticInit Type = "rustic_init" TypeRusticForget Type = "rustic_forget" TypeRusticPrune Type = "rustic_prune" TypeDockerStart Type = "docker_start" TypeDockerStop Type = "docker_stop" TypeDockerRestart Type = "docker_restart" TypeDockerRemoveContainer Type = "docker_remove_container" TypeDockerRemoveNetwork Type = "docker_remove_network" TypeDockerRemoveVolume Type = "docker_remove_volume" TypeDockerRemoveImage Type = "docker_remove_image" TypeMigrateRollback Type = "migrate_rollback")
type Status string
const ( StatusPending Status = "pending" StatusRunning Status = "running" StatusAwaitingConfirmation Status = "awaiting_confirmation" StatusSucceeded Status = "succeeded" StatusFailed Status = "failed" StatusCancelled Status = "cancelled")
type Source string
const ( SourceWeb Source = "web" SourceCLI Source = "cli" SourceOthers Source = "others" SourceSchedule Source = "schedule" SourceSystem Source = "system" SourceAutoDeploy Source = "auto_deploy")
type ExecutionState string
const ( ExecutionOffered ExecutionState = "offered" ExecutionAccepted ExecutionState = "accepted" ExecutionLeaseLost ExecutionState = "lease_lost" ExecutionCompleted ExecutionState = "completed")
type Record struct { TaskID string Type Type Source Source TriggeredBy string ServiceName string NodeID string Status Status ParamsJSON string LogPath string RepoRevision string ResultRevision string AttemptOfTaskID string CreatedAt time.Time StartedAt *time.Time FinishedAt *time.Time ErrorSummary string ExecutionID string ExecutionState ExecutionState LeaseExpiresAt *time.Time ExecutionAcceptedAt *time.Time ExecutionHeartbeatAt *time.Time DedupeKey string}
type StepName string
const ( StepRender StepName = "render" StepPull StepName = "pull" StepBackup StepName = "backup" StepComposeDown StepName = "compose_down" StepComposeUp StepName = "compose_up" StepTransfer StepName = "transfer" StepRestore StepName = "restore" StepDNSUpdate StepName = "dns_update" StepCloudflareTunnelSync StepName = "cloudflare_tunnel_sync" StepCaddySync StepName = "caddy_sync" StepCaddyReload StepName = "caddy_reload" StepImageCheck StepName = "image_check" StepInit StepName = "init" StepPrune StepName = "prune" StepAwaitingConfirmation StepName = "awaiting_confirmation" StepPersistRepo StepName = "persist_repo" StepFinalize StepName = "finalize" StepDockerStart StepName = "docker_start" StepDockerStop StepName = "docker_stop" StepDockerRestart StepName = "docker_restart" StepDockerRemove StepName = "docker_remove")
type StepRecord struct { TaskID string StepName StepName Status Status StartedAt *time.Time FinishedAt *time.Time}
func IsControllerOwnedType(taskType Type) bool { switch taskType { case TypeDNSUpdate, TypeCloudflareTunnelSync, TypeMigrate, TypeMigrateRollback: return true default: return false }}
func RequiresOnlineNode(taskType Type) bool { return !IsControllerOwnedType(taskType)}