server

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 68 Imported by: 0

Documentation

Overview

Package server is donkey's control plane: a REST API running inside the cluster, building with the in-cluster BuildKit and applying the same manifests the CLI used to apply directly. Identity comes from the donkey gateway in front of it (OIDC login, forwarded as headers) or from a sealed CLI token it verifies itself.

Index

Constants

View Source
const (
	PortFromConfig = "config"
	PortFromCode   = "code"
	PortFromEnv    = "env"
	PortGuessed    = "guess"
)

Where a port came from, for a review screen that would rather explain than ask.

View Source
const (
	LevelInfo  = "info"
	LevelWarn  = "warn"
	LevelBlock = "block"
)

Levels. A block is a reason not to deploy at all — the deploy would refuse it anyway, and saying so before the upload beats saying it after the build.

View Source
const (
	// InsightUnmaintained: the running build is older than the platform allows.
	InsightUnmaintained = "unmaintained"
	// InsightPopular: among the platform's most used apps.
	InsightPopular = "popular"
)

Insights are what donkey has noticed about an app, good or bad. Nobody sets them: they are worked out from what donkey observes, so the next deploy or a busier week changes them. The console labels apps with them and words them; the API carries only the kind and the facts behind it.

View Source
const (
	// SecurityClean: nothing with a fix at or above the threshold, no
	// credential in the image.
	SecurityClean = "clean"
	// SecurityFixable: fixes are available below the threshold.
	SecurityFixable = "fixable"
	// SecurityWarning: a reported secret or unsupported OS needs attention,
	// but the policy allowed deployment.
	SecurityWarning = "warning"
	// SecurityWaived: the image runs because a space admin or the
	// assistant waived what would have refused it.
	SecurityWaived = "waived"
	// SecurityNeedsAction: the image would be refused today.
	SecurityNeedsAction = "needs-action"
)

The states a running app's security badge can show.

View Source
const (
	FindingVulnBlocking = "vuln-blocking" // block: a fixable finding at or above the threshold
	FindingVulnJudged   = "vuln-judged"   // warn: the assistant read the app as not affected
	FindingVulnWaived   = "vuln-waived"   // warn: a space admin accepted it
	FindingVulnFixable  = "vuln-fixable"  // warn: fixes available below the threshold
	FindingVulnUnfixed  = "vuln-unfixed"  // info: no fix published yet
	FindingVulnClean    = "vuln-clean"    // info: nothing with a fix
	FindingOSEndOfLife  = "os-end-of-life"
	FindingSecretImage  = "secret-in-image"
)

Finding codes the console keys off. The level says what the deploy did; the code says why.

View Source
const PackagesAddressHeader = "X-Donkey-Packages-Address"

PackagesAddressHeader carries the address `donkey packages` listens on at the developer's machine. The mirror writes the links in its answers — the tarballs in npm metadata, the files of a PyPI index — to its own address, and that local one is the only address the developer's package manager can follow.

Variables

View Source
var Version = "dev"

Version is stamped via -ldflags "-X github.com/adrianliechti/donkey/internal/server.Version=…". It rides on /v1/ping so a CLI can tell when it is talking to an older or newer control plane than itself.

Functions

func Blocking

func Blocking(findings []Finding) bool

Blocking reports whether any finding is a reason not to deploy.

Types

type ActiveDeploy

type ActiveDeploy struct {
	Space string `json:"space"`
	App   string `json:"app"`
	// Stage is queued, detecting, building, releasing — and done or failed
	// once it is over.
	Stage string `json:"stage"`
	// Line is the latest progress line, as the deploy's own log said it.
	Line string `json:"line,omitempty"`
	// By is who started it; Via is console or cli.
	By         string     `json:"by,omitempty"`
	Via        string     `json:"via"`
	StartedAt  time.Time  `json:"startedAt"`
	FinishedAt *time.Time `json:"finishedAt,omitempty"`
	Error      string     `json:"error,omitempty"`
}

ActiveDeploy is one deploy on the board.

type AddonRequest

type AddonRequest struct {
	// Type is empty when the request attaches a service the space already
	// has; naming one creates the service first if it is missing.
	Type string `json:"type"`
	Name string `json:"name"`
	// Parameters are the type's own settings, as the catalog's schema
	// describes them. Version and Storage are shorthand for the parameters
	// of those names.
	Parameters map[string]any `json:"parameters,omitempty"`
	Version    string         `json:"version,omitempty"`
	Storage    string         `json:"storage,omitempty"`
	External   bool           `json:"external"`
	URL        string         `json:"url"`
}

type AppInsight

type AppInsight struct {
	Kind string `json:"kind"`
	// Since is when the running build was made (unmaintained).
	Since string `json:"since,omitempty"`
	// People is how many people use the app on an average day (popular).
	People int `json:"people,omitempty"`
}

type AppListEntry

type AppListEntry struct {
	Name     string `json:"name"`
	Space    string `json:"space"`
	Healthy  bool   `json:"healthy"`
	Ready    string `json:"ready"`
	Image    string `json:"image"`
	URL      string `json:"url"`
	Restarts int32  `json:"restarts,omitempty"`
	// StartedAt is when the newest pod came up (RFC 3339; empty when none).
	StartedAt string `json:"startedAt,omitempty"`
	// Mode, exposure, stack, disk and attached services — what the
	// console's cards show without a per-app request.
	Exposure   string   `json:"exposure,omitempty"`
	Mode       string   `json:"mode,omitempty"`
	Stack      string   `json:"stack,omitempty"`
	HasStorage bool     `json:"hasStorage,omitempty"`
	Addons     []string `json:"addons,omitempty"`
	// Security is the vulnerability scan's outcome for the running image.
	Security *AppSecurity `json:"security,omitempty"`
	// Insights are what donkey has noticed about the app (see insights.go).
	Insights []AppInsight `json:"insights,omitempty"`
}

AppListEntry is one row of the admin console's overview.

type AppRelease

type AppRelease struct {
	StartedAt  string       `json:"startedAt"`
	FinishedAt string       `json:"finishedAt"`
	Plan       *Plan        `json:"plan"`
	Update     DeployUpdate `json:"update"`
	Lines      []string     `json:"lines"`
	BuildLog   string       `json:"buildLog,omitempty"`
	// Scan is what the vulnerability scan found and what the policy made
	// of it, for the image this release built or reused.
	Scan   *AppScan     `json:"scan,omitempty"`
	Result DeployResult `json:"result"`
	// Decisions is what this deploy settled (storage, health route), kept
	// with the image it was verified against: a `--no-build` rollback to
	// this record's tag adopts these, not whatever a newer analysis found.
	Decisions json.RawMessage `json:"decisions,omitempty"`
	// Truncated is retained for reading older records that omitted output.
	Truncated bool `json:"truncated,omitempty"`
	// contains filtered or unexported fields
}

AppRelease is one deploy as the release screen rendered it live. Records are versioned on the data volume — one per build, success or failure, newest-first with bounded retention — so the console can show history, not just the latest attempt. The files a build used or wrote (its recipe, repairs and settings) are not copied in: they are the build's commit in the source history, and Update.Recipe says where the recipe sits.

type AppScan

type AppScan struct {
	Scanner     string `json:"scanner"`
	OS          string `json:"os,omitempty"`
	EndOfLife   bool   `json:"endOfLife,omitempty"`
	DBUpdatedAt string `json:"dbUpdatedAt,omitempty"`
	// Policy is what the findings were judged against.
	Policy  ScanPolicy  `json:"policy"`
	Summary ScanSummary `json:"summary"`
	// Findings are what the deploy stream said, in order.
	Findings        []Finding             `json:"findings"`
	Vulnerabilities []build.Vulnerability `json:"vulnerabilities"`
	Secrets         []build.Secret        `json:"secrets"`
	// Verdicts are the assistant's readings of the findings that would have
	// refused the image, whether or not they waived anything.
	Verdicts []ai.Verdict `json:"verdicts,omitempty"`
	// Blocked says the policy refused the image.
	Blocked bool `json:"blocked"`
	// ScannedAt is when the image was read.
	ScannedAt string `json:"scannedAt,omitempty"`
	// SBOM is the scanner's own inventory of the image (SPDX), gzip and
	// base64 so the record stays one JSON document. It is what a later
	// scan of the same image reads instead of the image.
	SBOM string `json:"sbom,omitempty"`
}

AppScan is what the scan of a release found and what the policy made of it, kept with the release record: the console's Deployment tab shows it, and a rollback to the image re-reads it against the policy of that day.

func (*AppScan) SBOMBytes

func (a *AppScan) SBOMBytes() ([]byte, error)

SBOMBytes unpacks the stored inventory; nil when the record has none.

func (*AppScan) Shown

func (a *AppScan) Shown() *AppScan

Shown is the record as the deploy stream carries it: everything but the inventory, which only the stored record needs.

type AppSecurity

type AppSecurity struct {
	State       string      `json:"state"`
	Summary     ScanSummary `json:"summary"`
	ScannedAt   string      `json:"scannedAt,omitempty"`
	DBUpdatedAt string      `json:"dbUpdatedAt,omitempty"`
	// Failed refreshes keep the last successful findings and their timestamp.
	RefreshError string `json:"refreshError,omitempty"`
	AttemptedAt  string `json:"attemptedAt,omitempty"`
}

AppSecurity is the scan's outcome as the running app carries it: what a fleet row, a space tile or the app's page shows without opening the release. It travels on the workload (an annotation, a label) the way the stack does, so the control plane stays stateless.

type CertificateStatusResponse

type CertificateStatusResponse struct {
	State       string `json:"state"`
	Mode        string `json:"mode"`
	Issuer      string `json:"issuer,omitempty"`
	Reason      string `json:"reason,omitempty"`
	Message     string `json:"message,omitempty"`
	ExpiresAt   string `json:"expiresAt,omitempty"`
	RenewalTime string `json:"renewalTime,omitempty"`
	Renewing    bool   `json:"renewing,omitempty"`
}

type Config

type Config struct {
	Listen string

	Registry config.Registry
	// RegistryMirrors lets the solve-session token client apply Registry's
	// private CA to the exact mirror hosts configured in buildkitd.
	RegistryMirrors map[string]string
	Domain          string
	BuildkitAddr    string
	PackagesURL     string
	// NamespacePrefix maps a space onto its own namespace; ignored when
	// WorkloadNamespace names one namespace for the whole installation.
	NamespacePrefix string
	// SystemNamespace is where the control plane lives — and the identity of
	// this installation, which is what keeps several donkeys on one cluster
	// out of each other's objects.
	SystemNamespace string
	// WorkloadNamespace, when set, is the single namespace every app lives
	// in; donkey neither creates nor deletes it.
	WorkloadNamespace string
	// IsolateSpaces fences every space with a NetworkPolicy (Kubernetes
	// runtime only — Docker spaces are separate networks and isolated as is).
	IsolateSpaces bool
	// RestrictEgress adds the egress half of that fence — a space's pods reach
	// only their own space, donkey-ai, donkey-proxy, donkey-telemetry and DNS, never the
	// internet. Off by default; only meaningful with IsolateSpaces.
	RestrictEgress bool
	// AIURL is donkey-ai's address — the console's /ai/v1 calls are
	// forwarded there. The address only, no path: what the console asks for
	// is what gets proxied.
	AIURL string
	// OrchestratorURL is donkey-orchestrator's address. donkey-server
	// forwards plans, deploys and the changes serialized with them there —
	// see orchestrator.go. The address only, no path.
	OrchestratorURL string
	// TelemetryURL is the private query listener of the traffic telemetry
	// service. App exporters use a different port and credential.
	TelemetryURL          string
	TelemetryOTLPEndpoint string

	OIDCIssuer       string
	OIDCClientID     string
	OIDCClientSecret string
	// OIDCScope is donkey's own API (e.g. api://<donkey-client-id>/<scope>):
	// the user's token console viewers hand on to the services they call.
	OIDCScope string

	// DefaultPlatform is the build platform when neither the deploy nor
	// donkey.yaml names one — matches the cluster's nodes.
	DefaultPlatform string

	// Build is the builder's settings and the environment every build gets.
	Build config.BuildSettings
	// AddonImages are repositories pulled directly by the runtime for managed
	// services; BuildKit's registry mirrors do not participate in those pulls.
	AddonImages config.InstallAddonImages
	// BusyboxImage is pulled by the runtime for file and volume helpers.
	BusyboxImage string
	// AddonImagePullSecrets names existing secrets in each workload namespace
	// that Kubernetes should use when pulling managed service and file-helper images.
	AddonImagePullSecrets []string
	AddonPlugins          config.AddonPlugins
	CommonOfferings       config.CommonOfferings
	ProxyServices         config.ProxyServices
	// Runtime names the provider in use (kubernetes or docker); the catalog
	// hides services a plugin does not offer there.
	Runtime string
	// TLS carries the cert-manager issuer used for exact-host Certificates in
	// Kubernetes. Docker's gateway issues certificates independently.
	TLS config.InstallTLS
	// ExternalDNS publishes optional exact-host DNSEndpoints at the gateway
	// VIP as apps are exposed.
	ExternalDNS config.InstallExternalDNS

	// SessionKey is the installation's sealing key — the server verifies
	// the CLI tokens the gateway mints with it (the direct, port-forwarded
	// path next to the gateway's identity headers).
	SessionKey []byte
	// TelemetryKey authenticates the gateway, app exporters, and private query
	// client independently of login-session rotation.
	TelemetryKey []byte
	// PlatformAdmins optionally seeds the persisted platform settings. With no
	// seed, the first verified sign-in becomes the first platform admin.
	PlatformAdmins *config.AccessConfig
	AIModel        string
	// DataDir is the orchestrator's volume: source/ holds Git history,
	// deployments/ holds releases and SBOMs, and scanner/ holds databases.
	DataDir string
}

func FromEnv

func FromEnv() (*Config, error)

func (*Config) AppHost

func (c *Config) AppHost(space string, app *config.AppConfig) string

AppHost is the address of an app — see config.AppHost for the rule.

func (*Config) AppURL

func (c *Config) AppURL(space string, app *config.AppConfig) string

func (*Config) Scheme

func (c *Config) Scheme() string

Scheme is always https for apps: the login gateway's cookies require it.

type DNSStatusResponse

type DNSStatusResponse struct {
	State      string   `json:"state"`
	Observed   bool     `json:"observed"`
	RecordType string   `json:"recordType,omitempty"`
	Expected   []string `json:"expected,omitempty"`
	Message    string   `json:"message,omitempty"`
}

type DeployResult

type DeployResult struct {
	Apps     []DeployResult `json:"apps,omitempty"`
	OK       bool           `json:"ok"`
	App      string         `json:"app"`
	Space    string         `json:"space,omitempty"`
	ImageRef string         `json:"imageRef,omitempty"`
	URL      string         `json:"url,omitempty"`
	Error    string         `json:"error,omitempty"`
	// Diagnosis carries the AI failure analysis when a deploy failed.
	Diagnosis string         `json:"diagnosis,omitempty"`
	Proposals []ai.FixAction `json:"proposals,omitempty"`
	Manifests string         `json:"manifests,omitempty"` // dry-run only
}

DeployResult is the final JSON line of a deploy stream.

type DeployUpdate

type DeployUpdate struct {
	App        string        `json:"app,omitempty"`
	Result     *DeployResult `json:"result,omitempty"`
	Stage      string        `json:"stage,omitempty"`
	BaseImages []string      `json:"baseImages,omitempty"`
	// Recipe is where the Dockerfile this build used sits in the build
	// context, reported once it is settled — the app's own, or the one the
	// assistant wrote. The file itself is in the source history.
	Recipe  string            `json:"recipe,omitempty"`
	Changes []ai.SourceChange `json:"changes,omitempty"`
	// Scan is the vulnerability scan's outcome as soon as it is known, so a
	// release being watched shows its findings while the build goes on.
	// Without the inventory: the record keeps that, the stream need not.
	Scan *AppScan `json:"scan,omitempty"`
}

DeployUpdate is structured release progress for clients that can render a state panel beside the human-readable log. Unknown update fields are safe for older clients to ignore.

type DiagnoseResponse

type DiagnoseResponse struct {
	Diagnosis      string         `json:"diagnosis,omitempty"`
	Proposals      []ai.FixAction `json:"proposals,omitempty"`
	Pods           []string       `json:"pods,omitempty"`
	Events         []string       `json:"events,omitempty"`
	Logs           string         `json:"logs,omitempty"`
	AssistantError string         `json:"assistantError,omitempty"`
}

DiagnoseResponse is what the console's "explain what's wrong" shows: the raw evidence always, the assistant's reading of it when it answers.

type DoctorCheck

type DoctorCheck struct {
	Name   string `json:"name"`
	OK     bool   `json:"ok"`
	Detail string `json:"detail,omitempty"`
}

type EndpointStatusResponse

type EndpointStatusResponse struct {
	Host        string                    `json:"host"`
	Certificate CertificateStatusResponse `json:"certificate"`
	DNS         DNSStatusResponse         `json:"dns"`
}

type FileInfo

type FileInfo struct {
	Name string `json:"name"`
	Size int64  `json:"size"`
	// Mode is the ls-style spelling, e.g. "-rw-rw-r--".
	Mode string `json:"mode"`
	// ModTime is RFC 3339 UTC.
	ModTime string `json:"modTime"`
	IsDir   bool   `json:"isDir"`
	// IsLink marks a shortcut — neither a file to download nor a folder to
	// open.
	IsLink bool `json:"isLink,omitempty"`
}

type Finding

type Finding struct {
	Level string `json:"level"`
	// Code names the finding for callers that render it themselves. It is
	// stable: the console keys its layout off these.
	Code string `json:"code"`
	// Title is the finding in one sentence, in the user's language.
	Title string `json:"title"`
	// Detail is the evidence behind it — usually the assistant's reason.
	Detail string `json:"detail,omitempty"`
	// Fix is what to do about it, when there is something to do.
	Fix string `json:"fix,omitempty"`
	// File points at where in the app it was found, when it is one place.
	File string `json:"file,omitempty"`
}

Finding is one thing donkey noticed about an app. They exist so the deploy stream, the CLI and the console say the same thing: the text is written once here, and a caller that can do better than a sentence keys off Code.

func (Finding) Text

func (f Finding) Text() string

Text renders a finding as the one line a terminal shows. The console uses the fields directly.

type ListFilesResponse

type ListFilesResponse struct {
	Path    string     `json:"path"`
	Entries []FileInfo `json:"entries"`
	// Truncated says the folder holds more than one listing shows.
	Truncated bool `json:"truncated,omitempty"`
	// Folders is only filled for the disk's root, where the folder names are
	// donkey's own (one per storage path).
	Folders []StorageFolderInfo `json:"folders,omitempty"`
}

type NetworkResponse

type NetworkResponse struct {
	// Mode is web or api. Exposure is public, protected or internal.
	Mode     string `json:"mode"`
	Exposure string `json:"exposure"`
	URL      string `json:"url,omitempty"`
	// DefaultHost is the generated <app>.<space>.<domain> address. Host is the
	// configured donkey.yaml shape when it differs: a name, "@", or a full
	// hostname.
	DefaultHost string       `json:"defaultHost"`
	FQDN        string       `json:"fqdn"`
	Domains     []string     `json:"domains"`
	Host        string       `json:"host,omitempty"`
	Port        int          `json:"port,omitempty"`
	Routes      []RouteEntry `json:"routes,omitempty"`
	AllowPublic bool         `json:"allowPublic"`
	CORS        string       `json:"cors"`
	// Analytics is false when the app opted out of web analytics. It only
	// counts for web apps with an address; see config.AppConfig.CountsVisits.
	Analytics bool `json:"analytics"`
}

NetworkResponse is what the console's network settings show: read from the runtime's actual state, never from stored intent.

type Plan

type Plan struct {
	// ID names this plan for the deploy that follows it. It expires — losing
	// one costs a re-upload, never a build.
	ID string `json:"id"`
	// App is the config the deploy would use, with everything donkey.yaml
	// left open already filled in.
	App   PlanApp   `json:"app"`
	Build PlanBuild `json:"build"`
	// Findings are what to know before saying yes. A block among them means
	// the deploy would refuse — better heard now than after the build.
	Findings []Finding `json:"findings"`
	// Root is the folder inside the upload that holds the app; empty means
	// the upload itself is the app.
	Root string `json:"root,omitempty"`
	// HasConfig says the app brought its own donkey.yaml. Then the file
	// decides and these fields only report what it says.
	HasConfig bool `json:"hasConfig"`
	// AppType and Notes are the assistant's own words about the app.
	AppType string `json:"appType,omitempty"`
	Notes   string `json:"notes,omitempty"`
	// The full set every time: a choice turned down stays visible and
	// unticked, because a control that vanishes when cleared can never be set
	// again. Both are things donkey *creates* — it never proposes a command to
	// run, because a model-written command executed by default is not a
	// feature worth having.
	Volumes  []PlanVolume  `json:"volumes"`
	Services []PlanService `json:"services"`
	// Skipped is what the upload lost on the way in (secret-shaped files,
	// build artifacts, VCS internals).
	Skipped []string `json:"skipped,omitempty"`
	// Config is the donkey.yaml this plan amounts to. A browser deploy has no
	// folder to write it back to, so it is shown for copying into the project.
	Config string `json:"config"`
	// Ready is false when something blocks the deploy.
	Ready     bool   `json:"ready"`
	ExpiresAt string `json:"expiresAt"`
}

Plan is what a review screen (or `donkey init`) shows.

type PlanApp

type PlanApp struct {
	Name    string   `json:"name"`
	Space   string   `json:"space"`
	Host    string   `json:"host"`
	Domains []string `json:"domains"`
	Port    int      `json:"port"`
	// PortSource is donkey.yaml, the code, the PORT convention, or a guess —
	// a review screen would rather explain a port than ask for one.
	PortSource  string   `json:"portSource"`
	PortReason  string   `json:"portReason,omitempty"`
	Healthcheck string   `json:"healthcheck,omitempty"`
	Storage     []string `json:"storage"`
	StorageSize string   `json:"storageSize,omitempty"`
	// Exposure is public, protected or internal — how the app will be reached.
	Exposure string `json:"exposure"`
	// Mode is web (the default) or api.
	Mode string `json:"mode"`
	// CORS selects the gateway's cross-origin policy.
	CORS string `json:"cors"`
	// URL is the address the app will answer on (empty for internal).
	URL string `json:"url,omitempty"`
}

PlanApp is the app as this plan would deploy it.

type PlanBuild

type PlanBuild struct {
	// Summary is the one-line description of how the app gets built.
	Summary  string `json:"summary"`
	Strategy string `json:"strategy"`
	// The remaining fields are deterministic evidence from the uploaded
	// files. They let review and release screens explain the build without
	// scraping prose from the progress log.
	Runtimes        []PlanSignal        `json:"runtimes,omitempty"`
	Frameworks      []PlanSignal        `json:"frameworks,omitempty"`
	Versions        []PlanSignal        `json:"versions,omitempty"`
	PackageManagers []PlanSignal        `json:"packageManagers,omitempty"`
	BaseImages      []string            `json:"baseImages,omitempty"`
	SystemPackages  []PlanSystemPackage `json:"systemPackages,omitempty"`
}

type PlanChange

type PlanChange struct {
	File string `json:"file"`
	Diff string `json:"diff"`
}

type PlanConnection

type PlanConnection struct {
	App    string `json:"app"`
	Target string `json:"target"`
	Env    string `json:"env,omitempty"`
	Value  string `json:"value,omitempty"`
	Reason string `json:"reason"`
}

type PlanEdit

type PlanEdit struct {
	Name        string   `json:"name"`
	Space       string   `json:"space"`
	Host        *string  `json:"host,omitempty"`
	Port        int      `json:"port"`
	Healthcheck string   `json:"healthcheck"`
	Storage     []string `json:"storage"`
	// Services names the services to have, by name.
	Services []string `json:"services"`
	// Exposure is public, protected or internal.
	Exposure string `json:"exposure"`
	Mode     string `json:"mode"`
	CORS     string `json:"cors"`
}

PlanEdit is the review screen's answer: what the person deploying decided after reading the plan. Every field is authoritative — an omitted storage list means "no disk", not "you decide".

type PlanService

type PlanService struct {
	Type   string `json:"type"`
	Name   string `json:"name"`
	Reason string `json:"reason,omitempty"`
	// Exists says the space already runs one under this name, so deploying
	// connects to it instead of creating a second.
	Exists bool `json:"exists"`
	// Known is false for a type donkey has no recipe for: it is reported,
	// never offered.
	Known    bool `json:"known"`
	Selected bool `json:"selected"`
}

PlanService is one backing service the app will have — declared in donkey.yaml, or proposed by the assistant.

type PlanSignal

type PlanSignal struct {
	Value    string `json:"value"`
	Evidence string `json:"evidence,omitempty"`
}

PlanSignal is one detected build fact and the file that proves it.

type PlanSystemPackage

type PlanSystemPackage struct {
	Dependency string   `json:"dependency"`
	Build      []string `json:"build,omitempty"`
	Runtime    []string `json:"runtime,omitempty"`
}

PlanSystemPackage explains which application dependency needs native packages, keeping build-only packages separate from final-image packages.

type PlanVolume

type PlanVolume struct {
	Path     string `json:"path"`
	Reason   string `json:"reason,omitempty"`
	Selected bool   `json:"selected"`
}

PlanVolume is one folder whose contents have to survive a restart.

type ProjectPlan

type ProjectPlan struct {
	ID          string           `json:"id"`
	Apps        []*Plan          `json:"apps"`
	Connections []PlanConnection `json:"connections"`
	Changes     []PlanChange     `json:"changes"`
	Findings    []Finding        `json:"findings"`
	Ready       bool             `json:"ready"`
}

ProjectPlan is one review and one deploy for every app in an upload.

type PutEnvRequest

type PutEnvRequest struct {
	Env     map[string]string `json:"env"`
	Restart bool              `json:"restart"`
}

type PutNetworkRequest

type PutNetworkRequest struct {
	Mode     string `json:"mode"`
	Exposure string `json:"exposure"`
	CORS     string `json:"cors"`
	// Analytics turns web analytics on or off; omitted keeps what the app has.
	Analytics *bool `json:"analytics"`
	// Host is where the app should answer instead of its default
	// address — see config.AppHost: a plain name sits under the space, "@"
	// is the space's own address, anything with a dot is an exact hostname,
	// and empty puts it back on the default.
	Host string `json:"host"`
}

type RouteEntry

type RouteEntry struct {
	Host string `json:"host"`
	Path string `json:"path"`
}

RouteEntry is one extra address a request can reach the app on.

type ScanPolicy

type ScanPolicy struct {
	Block         string                  `json:"block"`
	IgnoreUnfixed bool                    `json:"ignoreUnfixed"`
	Secrets       string                  `json:"secrets"`
	Triage        bool                    `json:"triage"`
	Waivers       []config.SecurityWaiver `json:"waivers,omitempty"`
}

ScanPolicy is the installation's rules, resolved, plus the space's waivers for the app in question.

type ScanSummary

type ScanSummary struct {
	Critical int `json:"critical"`
	High     int `json:"high"`
	Medium   int `json:"medium"`
	Low      int `json:"low"`
	Unknown  int `json:"unknown,omitempty"`
	Fixable  int `json:"fixable"`
	Unfixed  int `json:"unfixed"`
	Secrets  int `json:"secrets"`
	// Blocking is what refused, or would have refused, the image before
	// any waiver or verdict; Waived and Judged are what let it through.
	Blocking int `json:"blocking"`
	Waived   int `json:"waived"`
	Judged   int `json:"judged"`
}

ScanSummary is the report in numbers, for the places that show one line.

func (ScanSummary) Text

func (s ScanSummary) Text() string

Text is the summary as one line.

type Server

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

func New

func New(cfg *Config, rt runtime.Provider) (*Server, error)

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

Run serves the API and console until the process is asked to stop, then takes itself out of rotation and closes what is still open.

func (*Server) RunOrchestrator

func (s *Server) RunOrchestrator(ctx context.Context) error

RunOrchestrator serves the orchestrated routes until the process is asked to stop, then drains: new deploys are refused and the running ones are given until drainTimeout to finish. Without this, every orchestrator upgrade would kill whatever was mid-build.

type SourceBuild

type SourceBuild struct {
	Sequence int64 `json:"sequence"`
	OK       *bool `json:"ok,omitempty"`
}

SourceBuild is one build that used a commit. OK is unknown (nil) once the build's record has aged out of the bounded build history.

type SourceCommit

type SourceCommit struct {
	history.Commit
	Builds []SourceBuild `json:"builds,omitempty"`
	Live   bool          `json:"live,omitempty"`
}

SourceCommit is a history entry with its builds resolved, and whether it is what the app runs right now.

type SourceCommitDetail

type SourceCommitDetail struct {
	SourceCommit
	Changes []history.Change `json:"changes"`
}

type StatusResponse

type StatusResponse struct {
	Found    bool     `json:"found"`
	Healthy  bool     `json:"healthy"`
	Ready    string   `json:"ready"`
	Image    string   `json:"image"`
	URL      string   `json:"url"`
	Pods     []string `json:"pods"`
	Restarts int32    `json:"restarts,omitempty"`
	// StartedAt is when the newest pod came up (RFC 3339; empty when none).
	StartedAt string `json:"startedAt,omitempty"`
	// HasStorage is true when the app owns a disk. The file browser is only
	// meaningful then — an app with no volume has nothing donkey can show
	// that a redeploy would not rebuild.
	HasStorage bool `json:"hasStorage"`
	// Mode is web or api; exposure is public, protected or internal.
	Mode     string `json:"mode,omitempty"`
	Exposure string `json:"exposure,omitempty"`
	// Port the app listens on (donkey.yaml's `port`).
	Port int `json:"port,omitempty"`
	// Stack is what the app is written in (detect.Stack), for its icon.
	Stack string `json:"stack,omitempty"`
	// Security is the vulnerability scan's outcome for the running image.
	Security *AppSecurity `json:"security,omitempty"`
	// Endpoint is the asynchronously prepared edge behind URL. It is omitted
	// for internal apps and runtimes without endpoint diagnostics.
	Endpoint *EndpointStatusResponse `json:"endpoint,omitempty"`
}

type StorageFolderInfo

type StorageFolderInfo struct {
	Name string `json:"name"`
	Path string `json:"path"`
}

StorageFolderInfo says which folder of the disk is which path in the app.

Jump to

Keyboard shortcuts

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