setupguide

package
v0.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

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

View Source
const (
	ReasonTLSUpstream  = "tls_terminated_upstream"
	ReasonProxyMode    = "proxy_mode"
	ReasonUnavailable  = "unavailable"
	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.

View Source
const (
	OverrideSkipped = "skipped"
	OverrideDone    = "done"
)

Override values an operator can record.

Variables

This section is empty.

Functions

func ValidStep

func ValidStep(id string) bool

ValidStep reports whether id names a known step.

Types

type DomainTLS

type DomainTLS struct {
	Name        string
	CertHealthy bool
}

DomainTLS is one attached app domain and whether it has a healthy cert.

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.

func Derive

func Derive(in Input) Guide

Derive computes the guide. Derived "done" always wins over an override, so a skipped step that later completes shows as done.

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 lists steps whose source data could not be read.
	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

func FirstAppMilestone(g Guide) (current, next Milestone)

FirstAppMilestone returns the last milestone reached in order and the one after it. next is empty once every milestone is reached.

type Progress

type Progress struct {
	Done  int `json:"done"`
	Total int `json:"total"`
}

Progress counts done items of a multi-item step.

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 State

type State string

State is a step's current state.

const (
	StateTodo          State = "todo"
	StateInProgress    State = "in_progress"
	StateDone          State = "done"
	StateSkipped       State = "skipped"
	StateNotApplicable State = "not_applicable"
)

Step states.

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.

func StepIDs

func StepIDs() []StepID

StepIDs returns every step id in presentation order.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL