upgrade

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: AGPL-3.0 Imports: 32 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package upgrade installs only release artifacts verified against an operator's local trust policy. The console cannot supply a new trust root or shell command.

Index

Constants

View Source
const DecommissionedExitEnv = "EDGEWEIR_DECOMMISSIONED_EXIT"

DecommissionedExitEnv set to "3" tells the command that its parent (the unit, and through it the supervisor) stops on ExitDecommissioned. The unit of 1.7.0 sets it. Without it a decommissioned node exits with 2: a node upgraded in place by the console keeps its 1.6.x unit and 1.6.x supervisor, which restart status 3 but stop on 2 (since 1.4.0).

View Source
const DefaultSource = "https://github.com/marvinli001/edgeweir-node/releases/download"
View Source
const ExitDecommissioned = 3

ExitDecommissioned is the exit status of a node the console decommissioned (agent.ErrDecommissioned): it must not run again until it is enrolled anew. systemd counts it as a clean stop (SuccessExitStatus=3, RestartPreventExitStatus=3).

Variables

View Source
var ErrDecommissioned = errors.New("edgeweir-node run exited with status 3: the console decommissioned this node; not restarting it")

ErrDecommissioned stops the supervisor when the node exits with ExitDecommissioned.

View Source
var ErrUsage = errors.New("edgeweir-node run exited with status 2 (invalid flags or local settings); not restarting it")

ErrUsage stops the supervisor when the node exits with status 2: its flags or local settings are wrong, and starting it again cannot help.

Functions

func DecommissionedExit added in v1.7.0

func DecommissionedExit() int

DecommissionedExit is the exit status of a decommissioned node: ExitDecommissioned when DecommissionedExitEnv says the parent stops on it, else 2.

func Run

func Run(ctx context.Context, opts Options) error

Run owns the stable parent process. Its installed executable is never overwritten.

func Socket

func Socket(stateDir string) string

Types

type Bundle

type Bundle struct {
	TaskID  string `json:"task_id"`
	Version string `json:"version"`
	Dir     string `json:"dir"`
	SHA256  string `json:"sha256"`
}

func Prepare

func Prepare(ctx context.Context, o Trust, t Task) (Bundle, error)

type Capabilities added in v1.3.0

type Capabilities struct {
	Enabled bool `json:"enabled"`
	Engine  bool `json:"engine"`
	Logs    bool `json:"logs"`
	// GET /debug-logs (debug-logs-v1).
	DebugLogs bool `json:"debug_logs"`
}

Capabilities are what the supervisor offers its child.

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(socket string) *Client

func (*Client) Ack

func (c *Client) Ack(ctx context.Context, id string) error

func (*Client) AckLogs added in v1.3.0

func (c *Client) AckLogs(ctx context.Context, ack LogsAck) error

AckLogs lets the supervisor drop what ack names.

func (*Client) Available

func (c *Client) Available(ctx context.Context) bool

func (*Client) Capabilities added in v1.3.0

func (c *Client) Capabilities(ctx context.Context) (Capabilities, error)

Capabilities returns what the supervisor offers.

func (*Client) Engine

func (c *Client) Engine(ctx context.Context) bool

Engine reports whether the supervisor runs OpenResty for its children.

func (*Client) EngineStatus

func (c *Client) EngineStatus(ctx context.Context) (running bool, starts int, err error)

EngineStatus returns the state of the supervisor's OpenResty.

func (*Client) Healthy

func (c *Client) Healthy(ctx context.Context, version string) error

func (*Client) ReadDebugLogs added in v1.6.0

func (c *Client) ReadDebugLogs(ctx context.Context, f nodelog.DebugFilter) (*nodelog.DebugSnapshot, error)

ReadDebugLogs returns the entries of the supervisor's ring that f selects.

func (*Client) ReadLogs added in v1.3.0

func (c *Client) ReadLogs(ctx context.Context, instance string, after uint64) (*LogsPage, error)

ReadLogs returns the entries after after in the supervisor's buffer instance (all it holds for another instance).

func (*Client) ReportHealth

func (c *Client) ReportHealth(ctx context.Context, version string, healthy bool) error

func (*Client) Result

func (c *Client) Result(ctx context.Context) (*Result, error)

func (*Client) Stage

func (c *Client) Stage(ctx context.Context, t Task) error

type LogsAck added in v1.3.0

type LogsAck struct {
	Instance        string `json:"instance"`
	Upto            uint64 `json:"upto"`
	RateLimitedMark uint64 `json:"rate_limited_mark"`
	OverflowMark    uint64 `json:"overflow_mark"`
}

LogsAck acknowledges entries up to Upto and the drops counted up to the marks of one buffer instance.

type LogsPage added in v1.3.0

type LogsPage struct {
	// Instance names the supervisor's buffer; numbers start over in a
	// new one.
	Instance string          `json:"instance"`
	Entries  []nodelog.Entry `json:"entries"`
	// Last is the number of the last entry returned (after when none).
	Last uint64 `json:"last"`
	// Entries the supervisor dropped since the last acknowledgement, and
	// its counters (the acknowledgement's marks).
	DroppedRateLimited uint64 `json:"dropped_rate_limited"`
	DroppedOverflow    uint64 `json:"dropped_overflow"`
	RateLimitedMark    uint64 `json:"rate_limited_mark"`
	OverflowMark       uint64 `json:"overflow_mark"`
}

LogsPage is the answer of GET /logs.

type Options

type Options struct {
	Trust        Trust
	Executable   string
	LuaDir       string
	Version      string
	RunArgs      []string
	Log          *slog.Logger
	Output       io.Writer
	TrialTimeout time.Duration
	StableWindow time.Duration
	// Engine is OpenResty the supervisor runs for its children (see
	// engine.go); nil: each child runs it itself.
	Engine *engine.Config
	// AllowDowngrade lets an upgrade task install an older version than
	// the active one (refused otherwise: an older signed release may have
	// known flaws).
	AllowDowngrade bool
	// Logs holds the supervisor's own warnings and events and OpenResty's
	// error log (Engine.LogSink) for its children (GET /logs); nil: none.
	Logs *nodelog.Collector
	// DebugLogs is the supervisor's debug log ring (its own records and
	// OpenResty's error log of every level) for its children (GET
	// /debug-logs); nil: none.
	DebugLogs *nodelog.Ring
	// contains filtered or unexported fields
}

type RemoteEngine

type RemoteEngine struct {
	// contains filtered or unexported fields
}

RemoteEngine is the agent's engine when the supervisor runs OpenResty: tests and reloads go through the supervisor socket, version and module probes run the binary locally. Run only watches for restarts.

func NewRemoteEngine

func NewRemoteEngine(socket string, local *engine.Nginx) *RemoteEngine

NewRemoteEngine returns the engine for a child of a supervisor that runs OpenResty (Client.Engine); local is the same binary, for probes.

func (*RemoteEngine) ModuleFeatures

func (e *RemoteEngine) ModuleFeatures(ctx context.Context) ([]string, error)

func (*RemoteEngine) Reload

func (e *RemoteEngine) Reload(ctx context.Context) error

Reload makes the supervisor's OpenResty load the installed configuration, starting it when it does not run.

func (*RemoteEngine) Run

func (e *RemoteEngine) Run(ctx context.Context) error

Run signals Started whenever the supervisor's OpenResty (re)started after the agent began watching, until ctx is done. OpenResty keeps running when the agent stops.

func (*RemoteEngine) Running

func (e *RemoteEngine) Running() bool

Running reports what the supervisor said last.

func (*RemoteEngine) Started

func (e *RemoteEngine) Started() <-chan struct{}

func (*RemoteEngine) Test

func (e *RemoteEngine) Test(ctx context.Context, conf string) error

Test runs `nginx -t` in the supervisor.

func (*RemoteEngine) Version

func (e *RemoteEngine) Version(ctx context.Context) (string, error)

type Result

type Result struct {
	ErrorCode  string    `json:"error_code,omitempty"`
	TaskID     string    `json:"task_id"`
	Version    string    `json:"version"`
	Success    bool      `json:"success"`
	RolledBack bool      `json:"rolled_back"`
	Message    string    `json:"message"`
	FinishedAt time.Time `json:"finished_at"`
}

type Supervisor

type Supervisor struct {
	// contains filtered or unexported fields
}

func (*Supervisor) ServeHTTP

func (s *Supervisor) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Task

type Task struct {
	ID           string `json:"id"`
	Version      string `json:"version"`
	ArchiveURL   string `json:"archive_url"`
	SHA256       string `json:"sha256"`
	ChecksumsURL string `json:"checksums_url"`
	SignatureURL string `json:"signature_url"`
}

type Trust

type Trust struct {
	StateDir  string
	Source    string
	Cosign    string
	PublicKey string // Optional operator-provided local public key; never from Task.
	AllowHTTP bool   // Explicitly configured local test/air-gap mirror only.
}

Jump to

Keyboard shortcuts

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