Documentation
¶
Index ¶
- Variables
- type AppDeployer
- type Reconciler
- func (r *Reconciler) AppConfig(slug string) (*compose.AppConfig, error)
- func (r *Reconciler) AppServices(ctx context.Context, slug string) ([]deployer.ServiceStatus, error)
- func (r *Reconciler) CancelOne(ctx context.Context, slug string) error
- func (r *Reconciler) DeployOne(ctx context.Context, composePath, appName string) error
- func (r *Reconciler) IsDeploying(slug string) bool
- func (r *Reconciler) ListDeployEvents(ctx context.Context, slug string) ([]store.DeployEvent, error)
- func (r *Reconciler) ListVersions(ctx context.Context, slug string) ([]store.ComposeVersion, error)
- func (r *Reconciler) PullOne(ctx context.Context, slug string) error
- func (r *Reconciler) Reconcile(ctx context.Context) error
- func (r *Reconciler) RefreshRoutes(ctx context.Context) error
- func (r *Reconciler) RefreshStatuses(ctx context.Context)
- func (r *Reconciler) RemoveOne(ctx context.Context, appName string) error
- func (r *Reconciler) RestartOne(ctx context.Context, slug string) error
- func (r *Reconciler) RollbackOne(ctx context.Context, slug string, versionID int64) error
- func (r *Reconciler) ScaleOne(ctx context.Context, slug string, scales map[string]int) error
- func (r *Reconciler) SetAuditRecorder(rec *audit.Recorder)
- func (r *Reconciler) SetDockerClient(c docker.Client)
- func (r *Reconciler) SetEventBus(b *events.Bus)
- func (r *Reconciler) StartOne(ctx context.Context, slug string) error
- func (r *Reconciler) StopOne(ctx context.Context, slug string) error
- func (r *Reconciler) SubscribeDeployLog(slug string) (<-chan deployer.OutputLine, func(), bool)
- func (r *Reconciler) Watch(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
var ErrVersionNotFound = errors.New("version not found for this app")
ErrVersionNotFound is returned by RollbackOne when the version does not exist or belongs to a different app.
Functions ¶
This section is empty.
Types ¶
type AppDeployer ¶
type AppDeployer interface {
Deploy(ctx context.Context, app *compose.AppConfig, auths ...deployer.RegistryAuth) deployer.DeployResult
RollbackDeploy(ctx context.Context, app *compose.AppConfig, version int, composeVersionID *int64, auths ...deployer.RegistryAuth) deployer.DeployResult
Teardown(ctx context.Context, projectName string) error
Restart(ctx context.Context, app *compose.AppConfig) deployer.DeployResult
Stop(ctx context.Context, projectName string) error
Start(ctx context.Context, projectName string) error
Pull(ctx context.Context, app *compose.AppConfig, auths []deployer.RegistryAuth) deployer.DeployResult
Scale(ctx context.Context, app *compose.AppConfig, scales map[string]int) error
Status(ctx context.Context, projectName string) ([]deployer.ServiceStatus, error)
Cancel(ctx context.Context, app *compose.AppConfig) error
}
AppDeployer is the interface the reconciler uses to deploy and remove apps.
type Reconciler ¶
type Reconciler struct {
// contains filtered or unexported fields
}
Reconciler syncs the apps directory with the running containers and store.
func New ¶
func New(st *store.Store, d AppDeployer, p proxy.Proxy, appsDir string, cfg *config.Config, syncer *configsync.Syncer) *Reconciler
New creates a Reconciler. syncer may be nil (disables configsync recovery). It also registers data_dir and apps_dir with the compose validator so no app can bind-mount SimpleDeploy's own data or another app's folder.
func (*Reconciler) AppConfig ¶
func (r *Reconciler) AppConfig(slug string) (*compose.AppConfig, error)
AppConfig returns the parsed compose config for the given app slug.
func (*Reconciler) AppServices ¶
func (r *Reconciler) AppServices(ctx context.Context, slug string) ([]deployer.ServiceStatus, error)
func (*Reconciler) CancelOne ¶
func (r *Reconciler) CancelOne(ctx context.Context, slug string) error
func (*Reconciler) DeployOne ¶
func (r *Reconciler) DeployOne(ctx context.Context, composePath, appName string) error
DeployOne deploys a single app from a compose file path.
func (*Reconciler) IsDeploying ¶
func (r *Reconciler) IsDeploying(slug string) bool
func (*Reconciler) ListDeployEvents ¶
func (r *Reconciler) ListDeployEvents(ctx context.Context, slug string) ([]store.DeployEvent, error)
func (*Reconciler) ListVersions ¶
func (r *Reconciler) ListVersions(ctx context.Context, slug string) ([]store.ComposeVersion, error)
func (*Reconciler) Reconcile ¶
func (r *Reconciler) Reconcile(ctx context.Context) error
Reconcile diffs the apps directory against the store and deploys/removes as needed.
func (*Reconciler) RefreshRoutes ¶
func (r *Reconciler) RefreshRoutes(ctx context.Context) error
RefreshRoutes re-parses the compose files on disk and reloads the proxy routes without redeploying containers. Used after endpoint/access label changes where only routing needs to change. Also updates the stored compose hash so a subsequent Reconcile doesn't falsely redeploy.
func (*Reconciler) RefreshStatuses ¶
func (r *Reconciler) RefreshStatuses(ctx context.Context)
RefreshStatuses polls every running/unstable app and flips between those two states based on actual container health. Conservative on purpose: only detects post-deploy crash loops, never overwrites stopped/error/ degraded statuses (which are owned by explicit user actions and the reconciler's own Reconcile pass) so it cannot race with Stop/Start.
func (*Reconciler) RemoveOne ¶
func (r *Reconciler) RemoveOne(ctx context.Context, appName string) error
RemoveOne removes a single app by slug.
func (*Reconciler) RestartOne ¶
func (r *Reconciler) RestartOne(ctx context.Context, slug string) error
func (*Reconciler) RollbackOne ¶
func (*Reconciler) SetAuditRecorder ¶
func (r *Reconciler) SetAuditRecorder(rec *audit.Recorder)
SetAuditRecorder wires an audit recorder for archive events. Nil-safe.
func (*Reconciler) SetDockerClient ¶
func (r *Reconciler) SetDockerClient(c docker.Client)
SetDockerClient wires a Docker client for container-IP upstream resolution. Nil is safe; routes fall back to DNS names in that case.
func (*Reconciler) SetEventBus ¶
func (r *Reconciler) SetEventBus(b *events.Bus)
SetEventBus wires the realtime events bus for status flips. Nil-safe.
func (*Reconciler) SubscribeDeployLog ¶
func (r *Reconciler) SubscribeDeployLog(slug string) (<-chan deployer.OutputLine, func(), bool)
SubscribeDeployLog returns a channel of deploy output lines for the given app slug.
func (*Reconciler) Watch ¶
func (r *Reconciler) Watch(ctx context.Context) error
Watch runs an fsnotify watcher on appsDir (and dataDir, for global sidecar edits) and reconciles on changes. An initial Reconcile runs immediately. Per-app sidecar edits route to a debounced ApplyAppSidecar call so the DB follows FS-authoritative state. Returns nil when ctx is cancelled.