Documentation
¶
Overview ¶
Package staticsite is a static release as files a host serves as they are (design/subsystems/deploy-targets.md, "Bucket websites"): the site's files from its release image, plus the two files AppTown's file server would otherwise compute, and the witness that a public address serves exactly this publication. It knows no provider; a file-host driver uploads the set in its order and asks the witness.
Index ¶
- Constants
- Variables
- func Answer(ctx context.Context, address string) (status int, body string, err error)
- func Gone(ctx context.Context, address string, tries int, interval time.Duration) error
- func Identity(release, imageDigest string, browser map[string]string) (string, error)
- func Witness(ctx context.Context, address, identity string, tries int, ...) error
- type File
- type Pass
- type Set
Constants ¶
const MaxBytes = 200 << 20
MaxBytes bounds a published site: every release uploads all of it, and AppTown holds it in memory while it does. Larger sites keep their own server on a container target.
const Root = "/srv"
Root is where a self-serving static image keeps its site.
Variables ¶
var ( EnvKey = strings.TrimPrefix("/_apptown/env.js", "/") ReleaseKey = strings.TrimPrefix(appcontract.ReleasePath, "/") InstanceKey = "_apptown/instance" )
EnvKey and ReleaseKey are the two files AppTown writes into every set. InstanceKey is reserved too: a bucket website's private mark naming the installation that made the bucket (s3bucket), never a site's file.
var ErrNotWitnessed = errors.New("the address does not answer this publication yet")
ErrNotWitnessed: the address did not answer this publication within the budget. It is not a failure: a host or its cache may still be catching up, and the attempt stays uncertain for a later look.
Functions ¶
func Gone ¶
Gone asks address for its marker until the host answers that it serves nothing there (404): what take-down witnesses. Only that answer is absence. No answer, a server error or any other status is not evidence that the site stopped, so after the last try the withdrawal is unconfirmed, saying what answered.
func Identity ¶
Identity is what a publication's marker answers: <part>@<revision>+<set>, where <set> names the image and the browser values together, so the same revision published with other values is another publication. It is computed before the marker is written.
func Witness ¶
func Witness(ctx context.Context, address, identity string, tries int, interval time.Duration, logf func(string, ...any)) error
Witness asks address for its marker, tries times interval apart, until it answers exactly identity. Every request carries a fresh query and no-cache, so no cache answers for the host. Anything else after the last try is ErrNotWitnessed, saying what answered.
Types ¶
type Pass ¶
type Pass int
Pass is when a file is uploaded: assets first, then the entry files (HTML and the browser values), then the marker, last of all.
type Set ¶
Set is one publication: its files in upload order, its identity (what the marker answers) and a digest over every key and body.