server

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 24 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 server owns locally managed znserver instances. It is shared by the command line and terminal app; neither frontend runs lifecycle shell snippets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Instance

type Instance struct {
	Name            string `json:"name"`
	Vault           string `json:"vault"`
	Bind            string `json:"bind"`
	BasePath        string `json:"basePath,omitempty"`
	Version         string `json:"version"`
	SHA256          string `json:"sha256"`
	PreviousVersion string `json:"previousVersion,omitempty"`
	PreviousSHA256  string `json:"previousSha256,omitempty"`
}

func (Instance) URL

func (i Instance) URL() string

type Manager

type Manager struct {
	Root          string
	Releases      ReleaseSource
	Service       Service
	Check         func(context.Context, Instance) error
	HealthTimeout time.Duration
}

func DefaultManager

func DefaultManager() *Manager

func NewManager

func NewManager(root string) *Manager

func (*Manager) BinaryPath

func (m *Manager) BinaryPath(i Instance) string

func (*Manager) Configure

func (m *Manager) Configure(ctx context.Context, name string, changes map[string]string) (Instance, error)

Configure changes runtime settings transactionally, retaining the same token.

func (*Manager) Dir

func (m *Manager) Dir(name string) string

func (*Manager) Install

func (m *Manager) Install(ctx context.Context, opts Options) (Instance, error)

Install downloads a verified binary and creates private runtime configuration. Repeating the same installation preserves its version, credentials and vault.

func (*Manager) List

func (m *Manager) List() ([]Instance, error)

func (*Manager) Load

func (m *Manager) Load(name string) (Instance, error)

func (*Manager) LogPath

func (m *Manager) LogPath(name string) string

func (*Manager) Logs

func (m *Manager) Logs(name string, output io.Writer) error

func (*Manager) Register

func (m *Manager) Register(i Instance, makeDefault bool) error

Register persists a terminal profile only after authenticated verification.

func (*Manager) Rollback

func (m *Manager) Rollback(ctx context.Context, name string) (Instance, error)

func (*Manager) Run

func (m *Manager) Run(ctx context.Context, name string, output io.Writer) error

Run is a foreground development runtime. Holding the instance lock prevents another command from replacing its executable or configuration while it runs.

func (*Manager) Setup

func (m *Manager) Setup(ctx context.Context, opts Options) (Instance, error)

func (*Manager) Start

func (m *Manager) Start(ctx context.Context, name string) error

func (*Manager) Status

func (m *Manager) Status(ctx context.Context, name string) (Status, error)

func (*Manager) Stop

func (m *Manager) Stop(ctx context.Context, name string) error

func (*Manager) TokenPath

func (m *Manager) TokenPath(name string) string

func (*Manager) Update

func (m *Manager) Update(ctx context.Context, name, version string) (Instance, error)

type Options

type Options struct {
	Name, Vault, Bind, BasePath, Version string
	NoStart, NoDefault                   bool
}

type Service

type Service interface {
	Start(context.Context, ServiceSpec) error
	Stop(context.Context, ServiceSpec) error
	Active(context.Context, ServiceSpec) (bool, error)
}

Stop also disables the login service, so an intentionally stopped instance stays stopped after login or an update's temporary health check.

type ServiceSpec

type ServiceSpec struct {
	Label, Executable, Dir, LogPath string
	Env                             map[string]string
}

type Status

type Status struct {
	Instance
	URL     string `json:"url"`
	Active  bool   `json:"active"`
	Healthy bool   `json:"healthy"`
	Error   string `json:"error,omitempty"`
}

Jump to

Keyboard shortcuts

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