Documentation
¶
Overview ¶
Package setupguide derives the Get started checklist from real instance state. It is pure: callers gather an Input, Derive returns the guide.
Index ¶
Constants ¶
const ( ReasonTLSUpstream = "tls_terminated_upstream" ReasonProxyMode = "proxy_mode" ReasonHTTPOnly = "http_only" ReasonNoRules = "no_alert_rule" ReasonCertsPending = "certificates_pending" ReasonACMEOff = "acme_disabled" ReasonManual = "marked_done" )
Reason codes explain why a step is not applicable or only partly done.
const ( OverrideSkipped = "skipped" OverrideDone = "done" )
Override values an operator can record.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Guide ¶
type Guide struct {
Steps []Step `json:"steps"`
ReadyPercent int `json:"ready_percent"`
Done int `json:"done"`
Total int `json:"total"`
NextStep StepID `json:"next_step,omitempty"`
Complete bool `json:"complete"`
Hidden bool `json:"hidden"`
ServerAddress string `json:"server_address,omitempty"`
// Milestone and NextMilestone track first-app progress for the UI.
Milestone Milestone `json:"milestone,omitempty"`
NextMilestone Milestone `json:"next_milestone,omitempty"`
}
Guide is the derived checklist.
type Input ¶
type Input struct {
SecuredAdmin bool
// EmailConfigured and SignInApprover say a new browser can be approved
// without a dashboard that is already open: email can be sent, or a CLI
// token holds signin:approve.
EmailConfigured bool
SignInApprover bool
SecurityReviewed bool
DashboardURL string
ServerAddress string
BehindProxy bool
ACMEEnabled bool
GitConnected bool
Apps int
Domains []DomainTLS
DNSProviderConnected bool
BackupTargets int
ControlPlaneBackups int
VerifiedBackups int
Channels int
AlertRules int
Users int
PendingInvites int
AutomaticUpgrades bool
Unavailable map[StepID]bool
// Overrides holds operator overrides keyed by step id.
Overrides map[StepID]string
Hidden bool
}
Input is everything Derive needs. Zero values mean "nothing set up yet".
type Milestone ¶
type Milestone string
Milestone names how far an install has come toward its first running app. The value doubles as the key the UI translates.
const ( MilestoneInstallDone Milestone = "install_done" MilestoneHTTPSOn Milestone = "https_on" MilestoneFirstDomain Milestone = "first_domain" MilestoneFirstAppDeployed Milestone = "first_app_deployed" MilestoneFirstBackup Milestone = "first_backup" MilestoneRestoreVerified Milestone = "restore_verified" )
First-app milestones, in order. Every one maps to a tracked step except install_done, which holds once the guide exists at all.
func FirstAppMilestone ¶
FirstAppMilestone returns the last milestone reached in order and the one after it. next is empty once every milestone is reached.
type RestoreDrill ¶
type RestoreDrill struct {
Due bool `json:"due"`
Reason RestoreReason `json:"reason"`
// DaysSince counts whole days since the last verified restore, or since
// the last backup when none was ever verified. Zero for no_backup.
DaysSince int `json:"days_since"`
}
RestoreDrill is the outcome of RestoreDrillDue.
func RestoreDrillDue ¶
func RestoreDrillDue(lastBackup, lastVerified, now time.Time, days int) RestoreDrill
RestoreDrillDue reports whether a restore drill should be prompted. Zero times mean "never"; days comes from the caller's config or setting.
type RestoreReason ¶
type RestoreReason string
RestoreReason says why a restore drill is or is not due.
const ( RestoreNoBackup RestoreReason = "no_backup" RestoreNeverVerified RestoreReason = "never_verified" RestoreVerificationOld RestoreReason = "verification_stale" RestoreOK RestoreReason = "ok" )
Restore drill reasons.
type Step ¶
type Step struct {
ID StepID `json:"id"`
Title string `json:"title"`
State State `json:"state"`
Optional bool `json:"optional"`
EstimateMinutes int `json:"estimate_minutes"`
Href string `json:"href"`
BlockedBy []StepID `json:"blocked_by,omitempty"`
Reason string `json:"reason,omitempty"`
Progress *Progress `json:"progress,omitempty"`
Manual bool `json:"manual,omitempty"`
}
Step is one derived checklist entry.
type StepID ¶
type StepID string
StepID names one checklist step.
const ( StepSecureAdmin StepID = "secure_admin" StepSignInRecovery StepID = "sign_in_recovery" StepSecurityReview StepID = "security_review" StepPublicAddress StepID = "public_address" StepGitProvider StepID = "git_provider" StepFirstApp StepID = "first_app" StepAppDomain StepID = "app_domain" StepDNS StepID = "dns" StepTLS StepID = "tls" StepBackupTarget StepID = "backup_target" StepFirstBackup StepID = "first_backup" StepVerifiedBackup StepID = "verified_restore" StepNotifications StepID = "notifications" StepTeammate StepID = "teammate" StepUpgrades StepID = "upgrades" )
Step identifiers, in presentation order.