apps

package
v0.3.0-dev.12 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 6 Imported by: ? 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 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 publishes an image and runs a deploy job on release tags. That job requests a Forgejo Actions ID token with audience "yawn-app:<id>"; the deploy hand-off verifies the token against the slot (repository by immutable ID, release tag prefix, exact workflow file), then deploys exactly the requested image digest to the slot's target, health-checks it and rolls back on failure.

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

View Source
const SchemaVersion = 1

SchemaVersion of apps.json.

Variables

This section is empty.

Functions

func Audience

func Audience(id string) string

Audience is the ID-token audience an app's deploy job must request.

Types

type App

type App struct {
	ID     string `json:"id"`
	Source Source `json:"source"`
	// 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"`
	Target Target `json:"target"`
	// Health is the URL that must answer 2xx/3xx after a deploy.
	Health string `json:"health"`
	// 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 deploy slot.

type Apps

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

Apps is the declared set of deploy slots.

func Load

func Load(data []byte) (s *Apps, err error)

Load parses apps.json, refusing unknown fields and other schema versions, and re-validates every slot exactly as Add does.

func New

func New() *Apps

New returns an empty set.

func (*Apps) Add

func (s *Apps) Add(a App) *App

Add validates and records a slot. It panics on any invalid or ambiguous declaration, so a bad slot fails synth.

func (*Apps) Get

func (s *Apps) Get(id string) *App

Get returns the slot with this ID, or nil.

func (*Apps) JSON

func (s *Apps) JSON() ([]byte, error)

JSON implements core.Document.

func (*Apps) List

func (s *Apps) List() []*App

List returns the slots sorted by ID.

type Document

type Document struct {
	Version int    `json:"schema_version"`
	Apps    []*App `json:"apps"`
}

Document is the apps.json layout.

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"`
	// 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"`
}

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"
)

Jump to

Keyboard shortcuts

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