Documentation
¶
Overview ¶
Package apps declares application deploy slots: which repository may deploy which application, to which target, with which secrets.
An app owns its deployment, not its infrastructure. The infrastructure app (john/arch) declares a slot; the app repository's release does two things, each proven with a Forgejo Actions ID token checked against the slot (repository by immutable ID, release tag prefix, exact workflow file):
- publish (audience "yawn-sign:<id>", Source.Publish): builds and pushes the image; the deployer then signs that digest after checking the tag is on main with green checks;
- deploy (audience "yawn-app:<id>", Source.Workflow): the deployer verifies the signature and deploys exactly that digest to the slot's target, health-checks it and rolls back on failure.
A slot's Artifact says what a release produces:
- ArtifactImage (default): a container image, signed with cosign over its digest and deployable to the slot's Target;
- ArtifactProvider: an OpenTofu provider release (zips + SHA256SUMS on the Forgejo release). The "digest" is sha256 of the SHA256SUMS file; signing GPG-signs that exact file and publishes the provider in the registry at Provider.Address. Provider slots are never deployed: no Target, Health, Workflow or Secrets.
Containers, addresses, routes, DNS and monitors stay in the infrastructure app. A slot never grants an app repository any infrastructure credential.
Slots synthesize to .yawn/apps.json (data only, no secrets).
Index ¶
Constants ¶
const SchemaVersion = 1
SchemaVersion of apps.json.
Variables ¶
This section is empty.
Functions ¶
func SignAudience ¶
SignAudience is the ID-token audience an app's publish job must request to get a digest signed.
Types ¶
type App ¶
type App struct {
ID string `json:"id"`
// Artifact defaults to ArtifactImage.
Artifact Artifact `json:"artifact"`
Source Source `json:"source"`
// Provider is set for ArtifactProvider slots only.
Provider *Provider `json:"provider,omitempty"`
// Image is the registry repository, e.g. "code.yawn.dev/john/corn"; the
// deploy names an exact digest of it, never a tag.
Image string `json:"image,omitempty"`
Target Target `json:"target"`
// Health is the URL that must answer 2xx/3xx after a deploy.
Health string `json:"health,omitempty"`
// Secrets are xyOps secret IDs granted only to this app's deploy.
Secrets []string `json:"secrets,omitempty"`
Notes string `json:"notes,omitempty"`
}
App is one release slot.
type Apps ¶
type Apps struct {
// contains filtered or unexported fields
}
Apps is the declared set of deploy slots.
func Load ¶
Load parses apps.json, refusing unknown fields and other schema versions, and re-validates every slot exactly as Add does.
type ImageSelector ¶
ImageSelector is the image intent checked into Git. Channels resolve to a digest during planning; an explicit digest needs no channel lookup. It does not confer permission to use a registry or deploy an image.
func ParseImageSelector ¶
func ParseImageSelector(ref string) (ImageSelector, error)
ParseImageSelector accepts a fully qualified release channel (dev, preview, rc, latest) or explicit SHA-256 digest. When both a tag and digest are present, the digest is authoritative and the tag is only descriptive.
type Provider ¶
type Provider struct {
// Address is the registry address, e.g. "registry.yawn.dev/john/xyops".
Address string `json:"address"`
// FilePrefix is the release asset prefix, e.g. "terraform-provider-xyops".
FilePrefix string `json:"file_prefix"`
// Platforms are the published platforms, e.g. ["linux_amd64","linux_arm64"].
Platforms []string `json:"platforms"`
// Protocols are the plugin protocol versions served, e.g. ["6.0"].
Protocols []string `json:"protocols"`
}
Provider describes an OpenTofu provider slot.
type Source ¶
type Source struct {
// Repository is "owner/name", for humans and workflow_ref matching.
Repository string `json:"repository"`
// RepositoryID and OwnerID are Forgejo's immutable numeric IDs.
RepositoryID string `json:"repository_id"`
OwnerID string `json:"owner_id"`
// Workflow is the deploy workflow file, e.g. ".forgejo/workflows/deploy.yml".
Workflow string `json:"workflow"`
// Publish is the workflow file that builds and pushes the image, e.g.
// ".forgejo/workflows/publish.yml". Only its token can get a digest
// signed. May equal Workflow when one workflow publishes and deploys.
Publish string `json:"publish"`
// TagPrefix selects release tags, e.g. "v" for refs/tags/v1.2.3.
TagPrefix string `json:"tag_prefix"`
// AllowManual also accepts workflow_dispatch at such a tag (redeploys,
// rollbacks to an earlier release).
AllowManual bool `json:"allow_manual,omitempty"`
// RequiredChecks are the commit status contexts that must be "success"
// on the release tag's commit before its image is signed, e.g.
// "Website checks / checks (push)".
RequiredChecks []string `json:"required_checks"`
}
Source pins who may deploy: one repository, identified by immutable IDs, deploying from release tags with one exact workflow file.
type Target ¶
type Target struct {
Kind TargetKind `json:"kind"`
// Service is the fleet service ID (ComposeLXC).
Service string `json:"service,omitempty"`
// Host names the host for ComposeHost, e.g. "vps".
Host string `json:"host,omitempty"`
// Project is the Compose project name; Compose files and data live
// under /opt/<project> on the target.
Project string `json:"project"`
// ComposeService is the one Compose service a deploy recreates.
ComposeService string `json:"compose_service"`
}
Target is where the app runs.
type TargetKind ¶
type TargetKind string
TargetKind is where an app runs.
const ( // ComposeLXC runs the app with Docker Compose inside a Proxmox container // declared in the same app (identified by the fleet service ID). ComposeLXC TargetKind = "compose-lxc" // ComposeHost runs the app with Docker Compose on a host outside Proxmox // (e.g. the VPS or a workstation), reached through a reviewed, // root-owned helper installed by the operator. ComposeHost TargetKind = "compose-host" )