Documentation
¶
Overview ¶
Package control holds shed's operations on projects, services, deployments, variables, domains, volumes, backups, metrics, and updates: the rules every interface to shed shares. The HTTP API and the MCP server call a Plane instead of the store and the deployer directly, so that both validate the same way, serialize deployments under the same lock, and show the same state.
Plane returns plain views (for example ServiceView) rather than wire types, and reports failures callers branch on as an *Error with a message fit to show, or as the sentinel errors of the packages below it; Explain turns either into a kind and a message.
Index ¶
- Constants
- Variables
- type BackupList
- type BackupView
- type Backups
- type Config
- type Deployer
- type DeploymentView
- type Error
- type GitHub
- type Logs
- type Metrics
- type NewService
- type OnePassword
- type OnePasswordLink
- type Plane
- func (p *Plane) BackUpService(ctx context.Context, serviceID string) (BackupView, error)
- func (p *Plane) BackUpSystem(ctx context.Context) (BackupView, error)
- func (p *Plane) BackupIdentity(ctx context.Context) (string, error)
- func (p *Plane) BackupSettings(ctx context.Context) (backup.Settings, error)
- func (p *Plane) Branches(ctx context.Context, owner, repo string) ([]string, error)
- func (p *Plane) BuildLog(ctx context.Context, deploymentID string, n int) ([]string, error)
- func (p *Plane) CancelDeployment(ctx context.Context, deploymentID string) (DeploymentView, error)
- func (p *Plane) CheckUpdate(ctx context.Context) (update.Status, error)
- func (p *Plane) ClearRestoreFence(ctx context.Context, id string) error
- func (p *Plane) CreateDomain(ctx context.Context, serviceID, host string) (d store.Domain, routesPending bool, err error)
- func (p *Plane) CreateProject(ctx context.Context, name string) (ProjectView, error)
- func (p *Plane) CreateService(ctx context.Context, projectID string, req NewService) (ServiceView, error)
- func (p *Plane) CreateVolume(ctx context.Context, serviceID, mountPath string) (store.Volume, error)
- func (p *Plane) DeleteBackup(ctx context.Context, id string) error
- func (p *Plane) DeleteDomain(ctx context.Context, id string) (routesPending bool, err error)
- func (p *Plane) DeleteProject(ctx context.Context, id string) error
- func (p *Plane) DeleteService(ctx context.Context, id string) error
- func (p *Plane) DeleteVolume(ctx context.Context, id string) error
- func (p *Plane) Deploy(ctx context.Context, serviceID string) (DeploymentView, error)
- func (p *Plane) DeployPush(ctx context.Context, serviceID string)
- func (p *Plane) Deployment(ctx context.Context, id string) (DeploymentView, error)
- func (p *Plane) Deployments(ctx context.Context, serviceID string, limit int) ([]DeploymentView, error)
- func (p *Plane) DownloadUpdate(ctx context.Context) (update.Status, error)
- func (p *Plane) FollowBuildLog(ctx context.Context, deploymentID string, line func(string), ...) error
- func (p *Plane) FollowRuntimeLogs(ctx context.Context, serviceID string, tail int, w io.Writer) error
- func (p *Plane) FollowShedLog(ctx context.Context, emit func(line string))
- func (p *Plane) HostMetrics(ctx context.Context, rng string) (metrics.HostSeries, error)
- func (p *Plane) InstallUpdate(ctx context.Context) (update.Status, error)
- func (p *Plane) LinkOnePassword(ctx context.Context, serviceID, environment, token string) (ServiceView, error)
- func (p *Plane) ListProjects(ctx context.Context) ([]ProjectSummary, error)
- func (p *Plane) OnePasswordVariables(ctx context.Context, serviceID string) (map[string]string, error)
- func (p *Plane) OpenBackup(ctx context.Context, id string) (rc io.ReadCloser, fileName string, err error)
- func (p *Plane) Project(ctx context.Context, id string) (ProjectView, error)
- func (p *Plane) ProjectRecord(ctx context.Context, id string) (store.Project, error)
- func (p *Plane) ReceivePush(ctx context.Context, push store.PendingPush) error
- func (p *Plane) Redeploy(ctx context.Context, deploymentID string) (DeploymentView, error)
- func (p *Plane) RenameProject(ctx context.Context, id, name string) (ProjectView, error)
- func (p *Plane) ReplayPushes(ctx context.Context)
- func (p *Plane) Repos(ctx context.Context) ([]github.Repo, error)
- func (p *Plane) ResolvedVariables(ctx context.Context, serviceID string) (map[string]string, error)
- func (p *Plane) RestartService(ctx context.Context, id string) error
- func (p *Plane) RestoreBackup(ctx context.Context, id string) (store.Restore, error)
- func (p *Plane) RuntimeLogs(ctx context.Context, serviceID string, n int) ([]string, error)
- func (p *Plane) Service(ctx context.Context, id string) (ServiceView, error)
- func (p *Plane) ServiceBackups(ctx context.Context, serviceID string) (BackupList, error)
- func (p *Plane) ServiceMetrics(ctx context.Context, serviceID, rng string) (metrics.Series, error)
- func (p *Plane) ServiceRecord(ctx context.Context, id string) (store.Service, error)
- func (p *Plane) ServicesForPush(ctx context.Context, repo, branch string) ([]store.Service, error)
- func (p *Plane) SetAutoDownload(ctx context.Context, on bool) (update.Status, error)
- func (p *Plane) SetBackupSettings(ctx context.Context, in backup.SettingsInput) (backup.Settings, error)
- func (p *Plane) SetServiceBackupPolicy(ctx context.Context, serviceID string, in backup.PolicyInput) (backup.Policy, error)
- func (p *Plane) SetSystemBackupPolicy(ctx context.Context, in backup.PolicyInput) (backup.Policy, error)
- func (p *Plane) SetVariables(ctx context.Context, serviceID string, vars map[string]string) (map[string]string, error)
- func (p *Plane) ShedLog(ctx context.Context, n int) ([]string, error)
- func (p *Plane) StartService(ctx context.Context, id string) error
- func (p *Plane) StopService(ctx context.Context, id string) error
- func (p *Plane) SyncRoutes(ctx context.Context)
- func (p *Plane) SystemBackups(ctx context.Context) (BackupList, error)
- func (p *Plane) TestBackupS3(ctx context.Context, in backup.S3Input) error
- func (p *Plane) UnlinkOnePassword(ctx context.Context, serviceID string) (ServiceView, error)
- func (p *Plane) UpdateService(ctx context.Context, id string, patch ServicePatch) (ServiceView, error)
- func (p *Plane) UpdateStatus(ctx context.Context) (update.Status, error)
- func (p *Plane) VariableNames(ctx context.Context, serviceID string) (VariableNames, error)
- func (p *Plane) Variables(ctx context.Context, serviceID string) (map[string]string, error)
- type ProjectSummary
- type ProjectView
- type ServicePatch
- type ServiceSummary
- type ServiceView
- type Store
- type Updates
- type VariableName
- type VariableNames
Constants ¶
const MaxDeployments = 50
MaxDeployments is the most deployments Deployments returns.
const MaxLogLines = 2000
MaxLogLines is the most lines BuildLog, RuntimeLogs, and ShedLog return.
Variables ¶
var ( // ErrInvalid reports a request that breaks a rule, such as a service // name that is not a DNS label. ErrInvalid = errors.New("control: invalid") // ErrNotFound reports that a project, service, deployment, domain, // volume, or backup does not exist. It is store.ErrNotFound, so the // store's lookups match it as they are. ErrNotFound = store.ErrNotFound // ErrConflict reports a request that the current state does not allow, // such as a name already in use or a service that is busy. ErrConflict = errors.New("control: conflict") // ErrUpstream reports that GitHub or 1Password failed a request. ErrUpstream = errors.New("control: upstream") ErrUnavailable = errors.New("control: unavailable") )
The kinds of failure an *Error reports.
Functions ¶
This section is empty.
Types ¶
type BackupList ¶
type BackupList struct {
Policy backup.Policy
Backups []BackupView
// Restore is the service's latest restore, if any; always nil for
// shed.db.
Restore *store.Restore
}
BackupList is the backup policy and the newest backups of a service, or of shed.db.
type BackupView ¶
BackupView is a backup with the name its archive downloads as.
type Backups ¶
type Backups interface {
BackUp(ctx context.Context, serviceID string) (store.Backup, error)
Backups(ctx context.Context, serviceID string, limit int) ([]store.Backup, error)
Restore(ctx context.Context, backupID string) (store.Restore, error)
Delete(ctx context.Context, backupID string) error
Open(ctx context.Context, backupID string) (io.ReadCloser, error)
PauseService(ctx context.Context, serviceID string) (resume func(), err error)
ForgetService(ctx context.Context, serviceID string) error
Policy(ctx context.Context, serviceID string) (backup.Policy, error)
SetPolicy(ctx context.Context, serviceID string, in backup.PolicyInput) (backup.Policy, error)
Settings(ctx context.Context) (backup.Settings, error)
SetSettings(ctx context.Context, in backup.SettingsInput) (backup.Settings, error)
TestS3(ctx context.Context, in backup.S3Input) error
Identity(ctx context.Context) (string, error)
}
Backups runs backups and restores and holds the backup settings. *backup.Manager implements it.
type Config ¶
type Config struct {
Store Store
Deployer Deployer
Backups Backups
Metrics Metrics
Logs Logs
Updates Updates
// GitHub returns the GitHub client, or false until the GitHub App is
// configured.
GitHub func() (GitHub, bool)
OnePassword OnePassword
// BaseURL is the public dashboard URL. Its host cannot be a service
// domain.
BaseURL string
// BaseDomain is the parent of generated service domains; empty disables
// them.
BaseDomain string
Log *slog.Logger
}
Config configures a Plane.
type Deployer ¶
type Deployer interface {
Deploy(ctx context.Context, serviceID string, trigger store.Trigger, c deploy.Commit) (store.Deployment, error)
Redeploy(ctx context.Context, deploymentID string) (store.Deployment, error)
AvailableImages(ctx context.Context, serviceID string, images []string) (map[string]bool, error)
Cancel(ctx context.Context, deploymentID string) (store.Deployment, error)
ServiceStatuses(ctx context.Context, projectID string) (map[string]deploy.ServiceStatus, error)
ApplyRoutes(ctx context.Context) error
StopService(ctx context.Context, serviceID string) error
StartService(ctx context.Context, serviceID string) error
RestartService(ctx context.Context, serviceID string) error
ClearRestoreFence(ctx context.Context, serviceID string) error
DeleteService(ctx context.Context, serviceID string) error
DeleteProject(ctx context.Context, projectID string) error
DeleteVolume(ctx context.Context, volumeID string) error
FollowLog(ctx context.Context, deploymentID string, line func(string), status func(store.DeploymentStatus)) error
BuildLog(ctx context.Context, deploymentID string, n int) ([]string, error)
RuntimeLogs(ctx context.Context, serviceID string, tail int, follow bool, w io.Writer) error
ResolveVariables(ctx context.Context, serviceID string) (deploy.Resolved, error)
}
Deployer runs deployments and owns the Docker side of services. *deploy.Deployer implements it.
type DeploymentView ¶
type DeploymentView struct {
ID string
ServiceID string
Status store.DeploymentStatus
Trigger store.Trigger
CommitSHA string
CommitMessage string
CommitAuthor string
Image string
Error string
CreatedAt time.Time
StartedAt *time.Time
FinishedAt *time.Time
// ImageAvailable reports whether the deployment's image is still on the
// server, so that it can be redeployed. It is set only in deployment
// lists, for deployments with an image, when Docker could be asked.
ImageAvailable *bool
}
DeploymentView is a deployment without its runtime record, which holds the resolved variables its container was started with.
type Error ¶
Error is a failure with a message fit to show to the user. Kind is one of ErrInvalid, ErrNotFound, ErrConflict, ErrUpstream, or ErrUnavailable, and errors.Is matches it.
type GitHub ¶
type GitHub interface {
Commit(ctx context.Context, fullName, ref string) (github.Commit, error)
Repos(ctx context.Context) ([]github.Repo, error)
Branches(ctx context.Context, fullName string) ([]string, error)
}
GitHub reads repositories through the GitHub App. *github.Client implements it.
type Metrics ¶
type Metrics interface {
Query(ctx context.Context, serviceID string, r metrics.Range) (metrics.Series, error)
QueryHost(ctx context.Context, r metrics.Range) (metrics.HostSeries, error)
}
Metrics answers resource usage queries. *metrics.Collector implements it.
type NewService ¶
type NewService struct {
// Name is the service's DNS label, unique in its project.
Name string
// Kind is "app" or a database kind of the catalog, such as "postgres".
Kind string
// Repo and Branch are the source of a repo app; Image that of an image
// app.
Repo string
Branch string
Image string
}
NewService describes a service to create.
type OnePassword ¶ added in v0.2.4
type OnePassword interface {
Variables(ctx context.Context, token, environmentID string) (map[string]string, error)
}
OnePassword reads 1Password Environments with a service account token. *onepassword.Client implements it.
type OnePasswordLink ¶ added in v0.2.5
type OnePasswordLink struct {
Environment string
// HasToken is set while a service account token is saved for the link.
HasToken bool
}
OnePasswordLink is the 1Password Environment a service reads variables from. It never holds the token.
type Plane ¶
type Plane struct {
// contains filtered or unexported fields
}
Plane carries out operations on shed's state. It is safe for concurrent use.
func (*Plane) BackUpService ¶
BackUpService starts a backup of a service.
func (*Plane) BackUpSystem ¶
func (p *Plane) BackUpSystem(ctx context.Context) (BackupView, error)
BackUpSystem starts a backup of shed.db.
func (*Plane) BackupIdentity ¶
BackupIdentity returns the age identity that decrypts backups.
func (*Plane) BackupSettings ¶
BackupSettings returns the S3 destination and encryption settings.
func (*Plane) Branches ¶
Branches returns the branch names of a repository the GitHub App is installed on.
func (*Plane) BuildLog ¶
BuildLog returns the last n lines of a deployment's build log, n clamped to 1 through MaxLogLines, with variable values masked.
func (*Plane) CancelDeployment ¶
CancelDeployment cancels a deployment in progress.
func (*Plane) CheckUpdate ¶
CheckUpdate checks GitHub for a newer release now. A failed check is recorded in the status, like a failed background check, rather than returned.
func (*Plane) ClearRestoreFence ¶
ClearRestoreFence lifts the fence a failed restore left on a service, keeping its data as it is.
func (*Plane) CreateDomain ¶
func (p *Plane) CreateDomain(ctx context.Context, serviceID, host string) (d store.Domain, routesPending bool, err error)
CreateDomain routes a host name to a service. An empty host generates <service>-<project>.<base domain>. The domain is kept even if the proxy cannot be updated now; routesPending then reports that SyncRoutes is retrying.
func (*Plane) CreateProject ¶
CreateProject creates an empty project.
func (*Plane) CreateService ¶
func (p *Plane) CreateService(ctx context.Context, projectID string, req NewService) (ServiceView, error)
CreateService creates a service in a project and starts its first deployment. Database kinds get their template's image, port, volume, and variables; repo apps deploy the head of their branch.
func (*Plane) CreateVolume ¶
func (p *Plane) CreateVolume(ctx context.Context, serviceID, mountPath string) (store.Volume, error)
CreateVolume adds a volume to a service, mounted at mountPath from its next deployment.
func (*Plane) DeleteBackup ¶
DeleteBackup deletes a backup's archives and record.
func (*Plane) DeleteDomain ¶
DeleteDomain removes a domain. As with CreateDomain, routesPending reports that the proxy is not updated yet.
func (*Plane) DeleteProject ¶
DeleteProject deletes a project with its services, their containers, volumes, and backups.
func (*Plane) DeleteService ¶
DeleteService deletes a service with its container, volumes, and backups.
func (*Plane) DeleteVolume ¶
DeleteVolume deletes a volume and its data.
func (*Plane) DeployPush ¶
DeployPush deploys a service's pending push and removes it, or keeps it to try again if the service cannot take a deployment now. A push is dropped instead if the service no longer deploys that branch on push, or if a deployment was created since the push arrived, which the push must not supersede.
func (*Plane) Deployment ¶
Deployment returns a deployment.
func (*Plane) Deployments ¶
func (p *Plane) Deployments(ctx context.Context, serviceID string, limit int) ([]DeploymentView, error)
Deployments returns up to limit of a service's newest deployments, newest first, with whether each one's image is still on the server. A limit outside 1 to MaxDeployments means MaxDeployments.
func (*Plane) DownloadUpdate ¶
DownloadUpdate starts downloading the newest release.
func (*Plane) FollowBuildLog ¶
func (p *Plane) FollowBuildLog(ctx context.Context, deploymentID string, line func(string), status func(store.DeploymentStatus)) error
FollowBuildLog replays a deployment's build log and follows it while the deployment is in progress, calling line for every line and status with the current status and each change. It returns nil once the deployment has finished, or the error of ctx if ctx ends first.
func (*Plane) FollowRuntimeLogs ¶
func (p *Plane) FollowRuntimeLogs(ctx context.Context, serviceID string, tail int, w io.Writer) error
FollowRuntimeLogs writes the last tail lines of the output of a service's active container to w, then follows it until ctx ends or the container stops. The values of the variables the container was started with are masked. It returns deploy.ErrNoContainer if the service has no active container.
func (*Plane) FollowShedLog ¶
FollowShedLog calls emit with the kept lines of shed's own log, then with each new line until ctx is done. Values are not masked.
func (*Plane) HostMetrics ¶
HostMetrics returns the host's resource usage over rng, as for ServiceMetrics.
func (*Plane) InstallUpdate ¶
InstallUpdate swaps in the downloaded release. shed runs it once restarted, which is up to the caller.
func (*Plane) LinkOnePassword ¶ added in v0.2.5
func (p *Plane) LinkOnePassword(ctx context.Context, serviceID, environment, token string) (ServiceView, error)
LinkOnePassword links a service to a 1Password Environment, read with a service account token, in place of its current link. A blank token keeps the token of the current link. The Environment is read once with the token first; if that fails, the request is invalid and nothing is saved.
func (*Plane) ListProjects ¶
func (p *Plane) ListProjects(ctx context.Context) ([]ProjectSummary, error)
ListProjects returns every project with a summary of its services.
func (*Plane) OnePasswordVariables ¶ added in v0.2.4
func (p *Plane) OnePasswordVariables(ctx context.Context, serviceID string) (map[string]string, error)
OnePasswordVariables returns the variables of the 1Password Environment a service links, or none if it links none.
func (*Plane) OpenBackup ¶
func (p *Plane) OpenBackup(ctx context.Context, id string) (rc io.ReadCloser, fileName string, err error)
OpenBackup opens a backup's archive, decrypted but still compressed, and returns the name it downloads as. The caller closes it.
func (*Plane) ProjectRecord ¶
ProjectRecord returns the stored project, without the lookups of its services that Project makes.
func (*Plane) ReceivePush ¶
ReceivePush stores push as its service's pending push and tries to deploy it. It returns only the error of storing it: a push that cannot deploy now is kept for ReplayPushes. Storing it under pushMu means the deployment recorded as its predecessor is the one any earlier push or manual deploy created, not one about to be created.
func (*Plane) RenameProject ¶
RenameProject renames a project.
func (*Plane) ReplayPushes ¶
ReplayPushes deploys pending pushes: right away, which replays those a restart interrupted, and then every few seconds, which deploys those that arrived while their service was held or fenced once it no longer is. It returns when ctx is done. Start it after the deployer has reconciled.
func (*Plane) ResolvedVariables ¶
ResolvedVariables returns the variables of a service's next deployment, injected ones included, with references expanded.
func (*Plane) RestartService ¶
RestartService restarts a service's container.
func (*Plane) RestoreBackup ¶
RestoreBackup starts restoring a backup into its service, or into shed.db.
func (*Plane) RuntimeLogs ¶
RuntimeLogs returns the last n lines of the output of a service's active container, n clamped to 1 through MaxLogLines, with the values of the variables it was started with masked. Each line starts with its RFC 3339 timestamp. It returns deploy.ErrNoContainer if the service has no active container.
func (*Plane) ServiceBackups ¶
ServiceBackups returns a service's backup policy, its newest backups, and its latest restore.
func (*Plane) ServiceMetrics ¶
ServiceMetrics returns a service's resource usage over rng: "1h", "6h", "24h", or "7d", empty meaning "1h".
func (*Plane) ServiceRecord ¶
ServiceRecord returns the stored settings of a service, without the lookups of its live state that Service makes.
func (*Plane) ServicesForPush ¶
ServicesForPush returns the app services that deploy a branch of a repository on push.
func (*Plane) SetAutoDownload ¶
SetAutoDownload sets whether new releases are downloaded when found.
func (*Plane) SetBackupSettings ¶
func (p *Plane) SetBackupSettings(ctx context.Context, in backup.SettingsInput) (backup.Settings, error)
SetBackupSettings saves the S3 destination and encryption settings.
func (*Plane) SetServiceBackupPolicy ¶
func (p *Plane) SetServiceBackupPolicy(ctx context.Context, serviceID string, in backup.PolicyInput) (backup.Policy, error)
SetServiceBackupPolicy saves a service's backup policy.
func (*Plane) SetSystemBackupPolicy ¶
func (p *Plane) SetSystemBackupPolicy(ctx context.Context, in backup.PolicyInput) (backup.Policy, error)
SetSystemBackupPolicy saves the backup policy of shed.db.
func (*Plane) SetVariables ¶
func (p *Plane) SetVariables(ctx context.Context, serviceID string, vars map[string]string) (map[string]string, error)
SetVariables replaces a service's own variables and returns them. They apply from its next deployment.
func (*Plane) ShedLog ¶
ShedLog returns the last n lines of shed's own log, n clamped to 1 through MaxLogLines, with the saved values of every service's variables masked.
func (*Plane) StartService ¶
StartService starts a stopped service.
func (*Plane) StopService ¶
StopService stops a service's container and keeps it stopped.
func (*Plane) SyncRoutes ¶
SyncRoutes applies routes again after a domain change failed to, with backoff, until it succeeds. It returns when ctx is done.
func (*Plane) SystemBackups ¶
func (p *Plane) SystemBackups(ctx context.Context) (BackupList, error)
SystemBackups returns the backup policy and newest backups of shed.db.
func (*Plane) TestBackupS3 ¶
TestBackupS3 checks that an S3 destination can be written, without saving it.
func (*Plane) UnlinkOnePassword ¶ added in v0.2.5
UnlinkOnePassword removes a service's 1Password link and its token, if it has one.
func (*Plane) UpdateService ¶
func (p *Plane) UpdateService(ctx context.Context, id string, patch ServicePatch) (ServiceView, error)
UpdateService saves settings of a service. They apply from its next deployment.
func (*Plane) UpdateStatus ¶
UpdateStatus returns the state of shed's updates.
func (*Plane) VariableNames ¶
VariableNames returns the names of the variables a service's next deployment would see: its own, the ones from its 1Password Environment, and the ones shed injects. It never returns values.
type ProjectSummary ¶
type ProjectSummary struct {
store.Project
Services []ServiceSummary
}
ProjectSummary is a project in a list, with a summary of each service.
type ProjectView ¶
type ProjectView struct {
store.Project
Services []ServiceView
}
ProjectView is a project with its full services.
type ServicePatch ¶
type ServicePatch struct {
Repo *string
Branch *string
RootDir *string
Image *string
DockerfilePath *string
StartCommand *string
Port *int
HealthcheckPath *string
PublicPort *int
CPULimit *float64
MemoryLimit *int64
AutoDeploy *bool
WaitForCI *bool
}
ServicePatch holds the settings to change; nil fields are kept.
type ServiceSummary ¶
type ServiceSummary struct {
ID string
Name string
Kind string
Status deploy.ServiceStatus
}
ServiceSummary is the name, kind, and live status of a service.
type ServiceView ¶
type ServiceView struct {
store.Service
// OnePassword is nil if the service links no 1Password Environment.
OnePassword *OnePasswordLink
// Status is derived from the service's deployments and container;
// offline if it has neither.
Status deploy.ServiceStatus
Domains []store.Domain
Volumes []store.Volume
// LatestDeployment is nil if the service has never been deployed.
LatestDeployment *DeploymentView
// RestoreFence is set while a failed restore keeps the service from
// starting.
RestoreFence *store.RestoreFence
}
ServiceView is a service with its settings, 1Password link, live status, domains, volumes, latest deployment, and restore fence. It holds no variable values or tokens.
type Store ¶
type Store interface {
Projects(ctx context.Context) ([]store.Project, error)
Project(ctx context.Context, id string) (store.Project, error)
CreateProject(ctx context.Context, name string) (store.Project, error)
RenameProject(ctx context.Context, id, name string) error
Services(ctx context.Context, projectID string) ([]store.Service, error)
AllServices(ctx context.Context) ([]store.Service, error)
Service(ctx context.Context, id string) (store.Service, error)
CreateService(ctx context.Context, sv store.Service) (store.Service, error)
UpdateService(ctx context.Context, sv store.Service) error
DeleteService(ctx context.Context, id string) error
ServicesForPush(ctx context.Context, repo, branch string) ([]store.Service, error)
Variables(ctx context.Context, serviceID string) (map[string]string, error)
SetVariables(ctx context.Context, serviceID string, vars map[string]string) error
OnePasswordLink(ctx context.Context, serviceID string) (store.OnePasswordLink, error)
SetOnePasswordLink(ctx context.Context, l store.OnePasswordLink) error
DeleteOnePasswordLink(ctx context.Context, serviceID string) error
Domains(ctx context.Context, serviceID string) ([]store.Domain, error)
CreateDomain(ctx context.Context, serviceID, host string, generated bool) (store.Domain, error)
DeleteDomain(ctx context.Context, id string) error
Volumes(ctx context.Context, serviceID string) ([]store.Volume, error)
CreateVolume(ctx context.Context, serviceID, mountPath string) (store.Volume, error)
Deployment(ctx context.Context, id string) (store.Deployment, error)
Deployments(ctx context.Context, serviceID string, limit int) ([]store.Deployment, error)
LatestDeployment(ctx context.Context, serviceID string) (store.Deployment, error)
RestoreFence(ctx context.Context, serviceID string) (store.RestoreFence, error)
LatestRestore(ctx context.Context, serviceID string) (store.Restore, error)
Backup(ctx context.Context, id string) (store.Backup, error)
SetPendingPush(ctx context.Context, p store.PendingPush) (store.PendingPush, error)
PendingPush(ctx context.Context, serviceID string) (store.PendingPush, error)
PendingPushes(ctx context.Context) ([]store.PendingPush, error)
DeletePendingPush(ctx context.Context, serviceID, id string) error
}
Store is the state Plane reads and changes. *store.Store implements it.
type Updates ¶
type Updates interface {
Status(ctx context.Context) (update.Status, error)
Check(ctx context.Context) (update.Status, error)
Download(ctx context.Context) (update.Status, error)
SetAutoDownload(ctx context.Context, on bool) (update.Status, error)
Install(ctx context.Context) (update.Status, error)
}
Updates checks for, downloads, and installs new versions of shed. *update.Updater implements it.
type VariableName ¶
type VariableName struct {
Name string
// Injected is set for variables shed provides, such as PORT and
// SHED_PRIVATE_DOMAIN, and clear for the service's own.
Injected bool
// OnePassword is set for variables from the service's 1Password
// Environment that it does not override with its own.
OnePassword bool
// Reference is set for own variables whose value refers to other
// variables with ${{ }}.
Reference bool
}
VariableName describes one variable of a service without its value.
type VariableNames ¶
type VariableNames struct {
// Variables are sorted by name. An own variable that overrides an
// injected one is listed once, as own.
Variables []VariableName
// ResolveError says why the variables do not resolve, if they do not.
// The injected and 1Password names are then missing.
ResolveError string
}
VariableNames lists the variables a service's next deployment would see.